diff options
author | Kaz <kazbloxmc@gmail.com> | 2020-09-16 21:39:44 -0400 |
---|---|---|
committer | Kaz <kazbloxmc@gmail.com> | 2020-09-16 21:39:44 -0400 |
commit | 5a70f99e16c5c2bb1bd32672dde581054990fae5 (patch) | |
tree | dadd776f69f0e24c963e962c3dc46e0d0968129d /src | |
parent | 171154a0975b1c734b5b2069f1bdb3ca2bab26f2 (diff) |
battle_script_commands.c: Eliminate the last nonmatching (swapped expressions).
Diffstat (limited to 'src')
-rw-r--r-- | src/battle_script_commands.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c2c4e6c41..14866bbca 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4666,19 +4666,16 @@ static void Cmd_jumpifcantswitch(void) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) { - #ifndef NONMATCHING - asm("":::"r5"); - #endif // NONMATCHING if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) party = gEnemyParty; else party = gPlayerParty; - i = 0; + lastMonId = 0; 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 && !GetMonData(&party[i], MON_DATA_IS_EGG) @@ -4687,7 +4684,7 @@ static void Cmd_jumpifcantswitch(void) break; } - if (i == lastMonId) + if (i == lastMonId + 3) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); else gBattlescriptCurrInstr += 6; @@ -4700,18 +4697,18 @@ static void Cmd_jumpifcantswitch(void) { party = gPlayerParty; - i = 0; + lastMonId = 0; if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gActiveBattler)) == TRUE) - i = 3; + lastMonId = 3; } else { party = gEnemyParty; if (gActiveBattler == 1) - i = 0; + lastMonId = 0; else - i = 3; + lastMonId = 3; } } else @@ -4721,12 +4718,12 @@ static void Cmd_jumpifcantswitch(void) else party = gPlayerParty; - i = 0; + lastMonId = 0; 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 && !GetMonData(&party[i], MON_DATA_IS_EGG) @@ -4735,7 +4732,7 @@ static void Cmd_jumpifcantswitch(void) break; } - if (i == lastMonId) + if (i == lastMonId + 3) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); else gBattlescriptCurrInstr += 6; @@ -4744,11 +4741,11 @@ static void Cmd_jumpifcantswitch(void) { party = gEnemyParty; - i = 0; + lastMonId = 0; 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 && !GetMonData(&party[i], MON_DATA_IS_EGG) @@ -4757,7 +4754,7 @@ static void Cmd_jumpifcantswitch(void) break; } - if (i == lastMonId) + if (i == lastMonId + 3) gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2); else gBattlescriptCurrInstr += 6; |