battle_script_commands.c: Eliminate the last nonmatching (swapped expressions).

This commit is contained in:
Kaz 2020-09-16 21:39:44 -04:00
parent 171154a097
commit 5a70f99e16

View File

@ -4666,19 +4666,16 @@ static void Cmd_jumpifcantswitch(void)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{ {
#ifndef NONMATCHING
asm("":::"r5");
#endif // NONMATCHING
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
party = gEnemyParty; party = gEnemyParty;
else else
party = gPlayerParty; party = gPlayerParty;
i = 0; lastMonId = 0;
if (gActiveBattler & 2) if (gActiveBattler & 2)
i = 3; lastMonId = 3;
for (lastMonId = i + 3; i < lastMonId; i++) for (i = lastMonId; i < lastMonId + 3; i++)
{ {
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG) && !GetMonData(&party[i], MON_DATA_IS_EGG)
@ -4687,7 +4684,7 @@ static void Cmd_jumpifcantswitch(void)
break; break;
} }
if (i == lastMonId) if (i == lastMonId + 3)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
else else
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
@ -4700,18 +4697,18 @@ static void Cmd_jumpifcantswitch(void)
{ {
party = gPlayerParty; party = gPlayerParty;
i = 0; lastMonId = 0;
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE) if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
i = 3; lastMonId = 3;
} }
else else
{ {
party = gEnemyParty; party = gEnemyParty;
if (gActiveBattler == 1) if (gActiveBattler == 1)
i = 0; lastMonId = 0;
else else
i = 3; lastMonId = 3;
} }
} }
else else
@ -4721,12 +4718,12 @@ static void Cmd_jumpifcantswitch(void)
else else
party = gPlayerParty; party = gPlayerParty;
i = 0; lastMonId = 0;
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE) if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
i = 3; lastMonId = 3;
} }
for (lastMonId = i + 3; i < lastMonId; i++) for (i = lastMonId; i < lastMonId + 3; i++)
{ {
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG) && !GetMonData(&party[i], MON_DATA_IS_EGG)
@ -4735,7 +4732,7 @@ static void Cmd_jumpifcantswitch(void)
break; break;
} }
if (i == lastMonId) if (i == lastMonId + 3)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
else else
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
@ -4744,11 +4741,11 @@ static void Cmd_jumpifcantswitch(void)
{ {
party = gEnemyParty; party = gEnemyParty;
i = 0; lastMonId = 0;
if (gActiveBattler == B_POSITION_OPPONENT_RIGHT) if (gActiveBattler == B_POSITION_OPPONENT_RIGHT)
i = 3; lastMonId = 3;
for (lastMonId = i + 3; i < lastMonId; i++) for (i = lastMonId; i < lastMonId + 3; i++)
{ {
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG) && !GetMonData(&party[i], MON_DATA_IS_EGG)
@ -4757,7 +4754,7 @@ static void Cmd_jumpifcantswitch(void)
break; break;
} }
if (i == lastMonId) if (i == lastMonId + 3)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
else else
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;