Merge pull request #1265 from Kurausukun/berry_crush

fakematch fixes, begin documenting Berry Crush (based on #1187)
This commit is contained in:
GriffinR
2020-12-14 23:22:41 -05:00
committed by GitHub
34 changed files with 317 additions and 368 deletions

View File

@@ -4666,19 +4666,16 @@ static void Cmd_jumpifcantswitch(void)
}
else 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;
@@ -5035,14 +5032,9 @@ static void Cmd_openpartyscreen(void)
hitmarkerFaintBits = gHitMarker >> 0x1C;
gBattlerFainted = 0;
while (1)
{
if (gBitTable[gBattlerFainted] & hitmarkerFaintBits)
break;
if (gBattlerFainted >= gBattlersCount)
break;
while (!(gBitTable[gBattlerFainted] & hitmarkerFaintBits)
&& gBattlerFainted < gBattlersCount)
gBattlerFainted++;
}
if (gBattlerFainted == gBattlersCount)
gBattlescriptCurrInstr = jumpPtr;