label some battle struct fields

This commit is contained in:
DizzyEggg 2017-11-12 17:06:31 +01:00
parent cd879d6f8a
commit 9febe24d9f
10 changed files with 69 additions and 80 deletions

View File

@ -1,8 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
.align 2, 0 @ Don't pad with nop.

View File

@ -623,7 +623,7 @@ struct BattleStruct
u8 sentInPokes;
bool8 selectionScriptFinished[BATTLE_BANKS_COUNT];
u8 field_58[4];
u8 field_5C[4];
u8 monToSwitchIntoId[BATTLE_BANKS_COUNT];
u8 field_60[4][3];
u8 runTries;
u8 caughtMonNick[11];
@ -695,7 +695,7 @@ struct BattleStruct
u8 field_1A4[96];
u8 field_204[104];
u8 field_26C[40];
u8 field_294[4];
u8 AI_monToSwitchIntoId[BATTLE_BANKS_COUNT];
u8 field_298[8];
u8 field_2A0;
u8 field_2A1;

View File

@ -2853,9 +2853,9 @@ static void BattleStartClearSetData(void)
*(i + 3 * 8 + (u8*)(gBattleStruct->mirrorMoveArrays) + 0) = 0;
}
for (i = 0; i < 4; i++)
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
{
*(gBattleStruct->field_294 + i) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + i) = 6;
}
gBattleStruct->field_DF = 0;
@ -3682,7 +3682,7 @@ static void TryDoEventsBeforeFirstTurn(void)
}
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
{
*(gBattleStruct->field_5C + i) = 6;
*(gBattleStruct->monToSwitchIntoId + i) = 6;
gActionForBanks[i] = ACTION_INIT_VALUE;
gChosenMovesByBanks[i] = MOVE_NONE;
}
@ -3793,7 +3793,7 @@ void BattleTurnPassed(void)
}
for (i = 0; i < 4; i++)
*(gBattleStruct->field_5C + i) = 6;
*(gBattleStruct->monToSwitchIntoId + i) = 6;
*(&gBattleStruct->field_91) = gAbsentBankFlags;
BattleHandleAddTextPrinter(gText_EmptyString3, 0);
@ -3884,7 +3884,7 @@ void sub_803BDA0(u8 bank)
gUnknown_0203CF00[i] = *(bank * 3 + i + (u8*)(gBattleStruct->field_60));
r4 = pokemon_order_func(gBattlePartyID[bank]);
r1 = pokemon_order_func(*(gBattleStruct->field_5C + bank));
r1 = pokemon_order_func(*(gBattleStruct->monToSwitchIntoId + bank));
sub_81B8FB0(r4, r1);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -3932,7 +3932,7 @@ static void HandleTurnActionSelectionState(void)
gBattleCommunication[gActiveBank] = STATE_BEFORE_ACTION_CHOSEN;
break;
case STATE_BEFORE_ACTION_CHOSEN: // choose an action
*(gBattleStruct->field_5C + gActiveBank) = 6;
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = 6;
if (gBattleTypeFlags & BATTLE_TYPE_MULTI
|| !(identity & BIT_MON)
|| gBattleStruct->field_91 & gBitTable[GetBankByIdentity(identity ^ BIT_MON)]
@ -4050,9 +4050,9 @@ static void HandleTurnActionSelectionState(void)
else
{
if (gActiveBank == 2 && gActionForBanks[0] == ACTION_SWITCH)
EmitChoosePokemon(0, 0, *(gBattleStruct->field_5C + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBank]);
EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBank]);
else if (gActiveBank == 3 && gActionForBanks[1] == ACTION_SWITCH)
EmitChoosePokemon(0, 0, *(gBattleStruct->field_5C + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBank]);
EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBank]);
else
EmitChoosePokemon(0, 0, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBank]);
}
@ -4339,7 +4339,7 @@ static void HandleTurnActionSelectionState(void)
for (i = 0; i < gNoOfAllBanks; i++)
{
if (gActionForBanks[i] == ACTION_SWITCH)
sub_80571DC(i, *(gBattleStruct->field_5C + i));
sub_80571DC(i, *(gBattleStruct->monToSwitchIntoId + i));
}
}
}
@ -4363,7 +4363,7 @@ static bool8 sub_803CDB8(void)
static void sub_803CDF8(void)
{
*(gBattleStruct->field_5C + gActiveBank) = gBattleBufferB[gActiveBank][1];
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = gBattleBufferB[gActiveBank][1];
RecordedBattle_SetBankAction(gActiveBank, gBattleBufferB[gActiveBank][1]);
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)
@ -5618,7 +5618,7 @@ static void HandleAction_NothingIsFainted(void)
static void HandleAction_ActionFinished(void)
{
*(gBattleStruct->field_5C + gBanksByTurnOrder[gCurrentTurnActionNumber]) = 6;
*(gBattleStruct->monToSwitchIntoId + gBanksByTurnOrder[gCurrentTurnActionNumber]) = 6;
gCurrentTurnActionNumber++;
gCurrentActionFuncId = gActionsByTurnOrder[gCurrentTurnActionNumber];
SpecialStatusesClear();

View File

@ -38,7 +38,7 @@ static bool8 ShouldSwitchIfPerishSong(void)
if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG
&& gDisableStructs[gActiveBank].perishSong1 == 0)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -120,7 +120,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % 3 < 2)
{
// we found a mon
*(gBattleStruct->field_294 + gActiveBank) = i;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -206,9 +206,9 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
continue;
if (i == gBattlePartyID[bankIn2])
continue;
if (i == *(gBattleStruct->field_5C + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
continue;
if (i == *(gBattleStruct->field_5C + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
continue;
species = GetMonData(&party[i], MON_DATA_SPECIES);
@ -220,7 +220,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (absorbingTypeAbility == monAbility && Random() & 1)
{
// we found a mon
*(gBattleStruct->field_294 + gActiveBank) = i;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -240,13 +240,13 @@ static bool8 ShouldSwitchIfNaturalCure(void)
if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -257,7 +257,7 @@ static bool8 ShouldSwitchIfNaturalCure(void)
return TRUE;
if (Random() & 1)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -400,9 +400,9 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
continue;
if (i == gBattlePartyID[bankIn2])
continue;
if (i == *(gBattleStruct->field_5C + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
continue;
if (i == *(gBattleStruct->field_5C + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
continue;
species = GetMonData(&party[i], MON_DATA_SPECIES);
@ -425,7 +425,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
moveFlags = AI_TypeCalc(move, gBattleMons[bankIn1].species, gBattleMons[bankIn1].ability);
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0)
{
*(gBattleStruct->field_294 + gActiveBank) = i;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -508,9 +508,9 @@ static bool8 ShouldSwitch(void)
continue;
if (i == gBattlePartyID[bankIn2])
continue;
if (i == *(gBattleStruct->field_5C + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
continue;
if (i == *(gBattleStruct->field_5C + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
continue;
availableToSwitch++;
@ -554,7 +554,7 @@ void AI_TrySwitchOrUseItem(void)
{
if (ShouldSwitch())
{
if (*(gBattleStruct->field_294 + gActiveBank) == 6)
if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) == 6)
{
s32 monToSwitchId = GetMostSuitableMonToSwitchInto();
if (monToSwitchId == 6)
@ -590,19 +590,19 @@ void AI_TrySwitchOrUseItem(void)
continue;
if (monToSwitchId == gBattlePartyID[bankIn2])
continue;
if (monToSwitchId == *(gBattleStruct->field_5C + bankIn1))
if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + bankIn1))
continue;
if (monToSwitchId == *(gBattleStruct->field_5C + bankIn2))
if (monToSwitchId == *(gBattleStruct->monToSwitchIntoId + bankIn2))
continue;
break;
}
}
*(gBattleStruct->field_294 + gActiveBank) = monToSwitchId;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = monToSwitchId;
}
*(gBattleStruct->field_5C + gActiveBank) = *(gBattleStruct->field_294 + gActiveBank);
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBank);
return;
}
else if (ShouldUseItem())
@ -614,28 +614,25 @@ void AI_TrySwitchOrUseItem(void)
EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBank ^ BIT_SIDE) << 8);
}
#define TYPE_FORESIGHT 0xFE
#define TYPE_ENDTABLE 0xFF
static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 *var)
{
s32 i = 0;
while (gTypeEffectiveness[i] != TYPE_ENDTABLE)
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
{
if (gTypeEffectiveness[i] == TYPE_FORESIGHT)
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
{
i += 3;
continue;
}
else if (gTypeEffectiveness[i] == atkType)
else if (TYPE_EFFECT_ATK_TYPE(i) == atkType)
{
// check type1
if (gTypeEffectiveness[i + 1] == defType1)
*var = (*var * gTypeEffectiveness[i + 2]) / 10;
if (TYPE_EFFECT_DEF_TYPE(i) == defType1)
*var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / 10;
// check type2
if (gTypeEffectiveness[i + 1] == defType2 && defType1 != defType2)
*var = (*var * gTypeEffectiveness[i + 2]) / 10;
if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2)
*var = (*var * TYPE_EFFECT_MULTIPLIER(i)) / 10;
}
i += 3;
}
@ -654,8 +651,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
u8 invalidMons;
u16 move;
if (*(gBattleStruct->field_5C + gActiveBank) != 6)
return *(gBattleStruct->field_5C + gActiveBank);
if (*(gBattleStruct->monToSwitchIntoId + gActiveBank) != 6)
return *(gBattleStruct->monToSwitchIntoId + gActiveBank);
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
return gBattlePartyID[gActiveBank] + 1;
@ -711,8 +708,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
&& !(gBitTable[i] & invalidMons)
&& gBattlePartyID[bankIn1] != i
&& gBattlePartyID[bankIn2] != i
&& i != *(gBattleStruct->field_5C + bankIn1)
&& i != *(gBattleStruct->field_5C + bankIn2))
&& i != *(gBattleStruct->monToSwitchIntoId + bankIn1)
&& i != *(gBattleStruct->monToSwitchIntoId + bankIn2))
{
u8 type1 = gBaseStats[species].type1;
u8 type2 = gBaseStats[species].type2;
@ -771,9 +768,9 @@ u8 GetMostSuitableMonToSwitchInto(void)
continue;
if (gBattlePartyID[bankIn2] == i)
continue;
if (i == *(gBattleStruct->field_5C + bankIn1))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn1))
continue;
if (i == *(gBattleStruct->field_5C + bankIn2))
if (i == *(gBattleStruct->monToSwitchIntoId + bankIn2))
continue;
for (j = 0; j < 4; j++)

View File

@ -1168,7 +1168,7 @@ static void OpponentHandleLoadMonSprite(void)
static void OpponentHandleSwitchInAnim(void)
{
*(gBattleStruct->field_5C + gActiveBank) = 6;
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = 6;
gBattlePartyID[gActiveBank] = gBattleBufferA[gActiveBank][1];
sub_80613DC(gActiveBank, gBattleBufferA[gActiveBank][2]);
gBattleBankFunc[gActiveBank] = sub_805FDF0;
@ -1627,7 +1627,7 @@ static void OpponentHandleChoosePokemon(void)
{
s32 chosenMonId;
if (*(gBattleStruct->field_294 + gActiveBank) == 6)
if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) == 6)
{
chosenMonId = GetMostSuitableMonToSwitchInto();
@ -1670,12 +1670,12 @@ static void OpponentHandleChoosePokemon(void)
}
else
{
chosenMonId = *(gBattleStruct->field_294 + gActiveBank);
*(gBattleStruct->field_294 + gActiveBank) = 6;
chosenMonId = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBank);
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
}
*(gBattleStruct->field_5C + gActiveBank) = chosenMonId;
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = chosenMonId;
EmitChosenMonReturnValue(1, chosenMonId, NULL);
OpponentBufferExecCompleted();
}

View File

@ -1581,7 +1581,7 @@ static void PlayerPartnerHandleChoosePokemon(void)
}
}
*(gBattleStruct->field_5C + gActiveBank) = chosenMonId;
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = chosenMonId;
EmitChosenMonReturnValue(1, chosenMonId, NULL);
PlayerPartnerBufferExecCompleted();
}

View File

@ -1474,8 +1474,8 @@ static void RecordedOpponentHandleChooseItem(void)
static void RecordedOpponentHandleChoosePokemon(void)
{
*(gBattleStruct->field_5C + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank);
EmitChosenMonReturnValue(1, *(gBattleStruct->field_5C + gActiveBank), NULL);
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank);
EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBank), NULL);
RecordedOpponentBufferExecCompleted();
}

View File

@ -1492,8 +1492,8 @@ static void RecordedPlayerHandleChooseItem(void)
static void RecordedPlayerHandleChoosePokemon(void)
{
*(gBattleStruct->field_5C + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank);
EmitChosenMonReturnValue(1, *(gBattleStruct->field_5C + gActiveBank), NULL);
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = RecordedBattle_ReadBankAction(gActiveBank);
EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBank), NULL);
RecordedPlayerBufferExecCompleted();
}

View File

@ -5330,7 +5330,7 @@ static void atk4C_get_switched_mon_data(void)
gActiveBank = GetBattleBank(gBattlescriptCurrInstr[1]);
gBattlePartyID[gActiveBank] = *(gBattleStruct->field_5C + gActiveBank);
gBattlePartyID[gActiveBank] = *(gBattleStruct->monToSwitchIntoId + gActiveBank);
EmitGetMonData(0, REQUEST_ALL_BATTLE, gBitTable[gBattlePartyID[gActiveBank]]);
MarkBufferBankForExecution(gActiveBank);
@ -5574,7 +5574,7 @@ static void atk4F_jump_if_cannot_switch(void)
static void sub_804CF10(u8 arg0)
{
*(gBattleStruct->field_58 + gActiveBank) = gBattlePartyID[gActiveBank];
*(gBattleStruct->field_5C + gActiveBank) = 6;
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = 6;
gBattleStruct->field_93 &= ~(gBitTable[gActiveBank]);
EmitChoosePokemon(0, 1, arg0, 0, gBattleStruct->field_60[gActiveBank]);
@ -5638,7 +5638,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBank].flag40)
{
sub_804CF10(gBattleStruct->field_5C[2]);
sub_804CF10(gBattleStruct->monToSwitchIntoId[2]);
gSpecialStatuses[gActiveBank].flag40 = 1;
}
else
@ -5660,7 +5660,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBank].flag40)
{
sub_804CF10(gBattleStruct->field_5C[0]);
sub_804CF10(gBattleStruct->monToSwitchIntoId[0]);
gSpecialStatuses[gActiveBank].flag40 = 1;
}
else if (!(flags & 1))
@ -5681,7 +5681,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBank].flag40)
{
sub_804CF10(gBattleStruct->field_5C[3]);
sub_804CF10(gBattleStruct->monToSwitchIntoId[3]);
gSpecialStatuses[gActiveBank].flag40 = 1;
}
else
@ -5703,7 +5703,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBank].flag40)
{
sub_804CF10(gBattleStruct->field_5C[1]);
sub_804CF10(gBattleStruct->monToSwitchIntoId[1]);
gSpecialStatuses[gActiveBank].flag40 = 1;
}
else if (!(flags & 2))
@ -5766,7 +5766,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBank].flag40)
{
sub_804CF10(gBattleStruct->field_5C[0]);
sub_804CF10(gBattleStruct->monToSwitchIntoId[0]);
gSpecialStatuses[gActiveBank].flag40 = 1;
}
}
@ -5782,7 +5782,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBank].flag40)
{
sub_804CF10(gBattleStruct->field_5C[1]);
sub_804CF10(gBattleStruct->monToSwitchIntoId[1]);
gSpecialStatuses[gActiveBank].flag40 = 1;
}
}
@ -5836,10 +5836,10 @@ static void atk50_openpartyscreen(void)
{
gActiveBank = bank;
*(gBattleStruct->field_58 + gActiveBank) = gBattlePartyID[gActiveBank];
*(gBattleStruct->field_5C + gActiveBank) = 6;
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = 6;
gBattleStruct->field_93 &= ~(gBitTable[gActiveBank]);
EmitChoosePokemon(0, hitmarkerFaintBits, *(gBattleStruct->field_5C + (gActiveBank ^ 2)), 0, gBattleStruct->field_60[gActiveBank]);
EmitChoosePokemon(0, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBank ^ 2)), 0, gBattleStruct->field_60[gActiveBank]);
MarkBufferBankForExecution(gActiveBank);
gBattlescriptCurrInstr += 6;
@ -5886,7 +5886,7 @@ static void atk51_switch_handle_order(void)
{
if (gBattleBufferB[i][0] == 0x22)
{
*(gBattleStruct->field_5C + i) = gBattleBufferB[i][1];
*(gBattleStruct->monToSwitchIntoId + i) = gBattleBufferB[i][1];
if (!(gBattleStruct->field_93 & gBitTable[i]))
{
RecordedBattle_SetBankAction(i, gBattleBufferB[i][1]);
@ -5908,7 +5908,7 @@ static void atk51_switch_handle_order(void)
// fall through
case 3:
gBattleCommunication[0] = gBattleBufferB[gActiveBank][1];
*(gBattleStruct->field_5C + gActiveBank) = gBattleBufferB[gActiveBank][1];
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = gBattleBufferB[gActiveBank][1];
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
@ -5922,7 +5922,7 @@ static void atk51_switch_handle_order(void)
}
else if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
sub_80571DC(gActiveBank, *(gBattleStruct->field_5C + gActiveBank));
sub_80571DC(gActiveBank, *(gBattleStruct->monToSwitchIntoId + gActiveBank));
}
else
{
@ -8029,7 +8029,7 @@ static void atk8F_forcerandomswitch(void)
|| GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE
|| GetMonData(&party[i], MON_DATA_HP) == 0);
}
*(gBattleStruct->field_5C + gBankTarget) = i;
*(gBattleStruct->monToSwitchIntoId + gBankTarget) = i;
if (!sub_81B1250())
sub_803BDA0(gBankTarget);

View File

@ -1805,7 +1805,7 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2)
&& GetMonData(&party[i], MON_DATA_SPECIES2) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG
// FIXME: Using index[array] instead of array[index] is BAD!
&& i != r1 && i != r2 && i != r7[gBattleStruct->field_5C] && i != r6[gBattleStruct->field_5C])
&& i != r1 && i != r2 && i != r7[gBattleStruct->monToSwitchIntoId] && i != r6[gBattleStruct->monToSwitchIntoId])
break;
}
return (i == 6);