From 779764b70dd113df4090dc09949e5a6b0dd71db0 Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Wed, 9 Sep 2020 10:35:40 -0400 Subject: Fix Battle_Script_commands fakematch --- src/battle_script_commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7ded6fcd8..309b375e7 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7134,11 +7134,11 @@ static void Cmd_forcerandomswitch(void) register s32 lastMonId asm("r8") = 0; // + 1 #endif // NONMATCHING - s32 firstMonId = 0; - s32 monsCount = 0; + s32 firstMonId; + s32 monsCount; struct Pokemon* party = NULL; s32 validMons = 0; - s32 minNeeded = 0; + s32 minNeeded; if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER)) { -- cgit v1.2.3 From a3a8c23e00d410f40dc70a35d9eed24b39102e40 Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Wed, 9 Sep 2020 11:18:04 -0400 Subject: Match battle_script commands --- src/battle_script_commands.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 309b375e7..1c11ca6bd 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7248,16 +7248,18 @@ static void Cmd_forcerandomswitch(void) { if (TryDoForceSwitchOut()) { + do{ do { i = Random() % monsCount; i += firstMonId; } while (i == battler2PartyId - || i == battler1PartyId - || GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE + || i == battler1PartyId); + + }while(GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE - || GetMonData(&party[i], MON_DATA_HP) == 0); + || GetMonData(&party[i], MON_DATA_HP) == 0); // Should be one while loop, conjoined by an ||, but that doesn't match. Equivalent logic though } *(gBattleStruct->monToSwitchIntoId + gBattlerTarget) = i; -- cgit v1.2.3 From 56afdee7fc1a49343bfb6904e747a07f1399ff7e Mon Sep 17 00:00:00 2001 From: PokeCodec <67983839+PokeCodec@users.noreply.github.com> Date: Wed, 9 Sep 2020 14:38:04 -0400 Subject: Remove register variable mention --- src/battle_script_commands.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/battle_script_commands.c') diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 1c11ca6bd..e3405bc0c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7127,14 +7127,8 @@ static void Cmd_forcerandomswitch(void) s32 i; s32 battler1PartyId = 0; s32 battler2PartyId = 0; - - #ifdef NONMATCHING - s32 lastMonId = 0; // + 1 - #else - register s32 lastMonId asm("r8") = 0; // + 1 - #endif // NONMATCHING - s32 firstMonId; + s32 lastMonId = 0; // + 1 s32 monsCount; struct Pokemon* party = NULL; s32 validMons = 0; @@ -7248,16 +7242,14 @@ static void Cmd_forcerandomswitch(void) { if (TryDoForceSwitchOut()) { - do{ do { - i = Random() % monsCount; - i += firstMonId; - } - while (i == battler2PartyId - || i == battler1PartyId); - - }while(GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE + do + { + i = Random() % monsCount; + i += firstMonId; + } while (i == battler2PartyId || i == battler1PartyId); + } while (GetMonData(&party[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&party[i], MON_DATA_IS_EGG) == TRUE || GetMonData(&party[i], MON_DATA_HP) == 0); // Should be one while loop, conjoined by an ||, but that doesn't match. Equivalent logic though } -- cgit v1.2.3