Add misc party constant usage

This commit is contained in:
GriffinR 2020-04-09 15:18:53 -04:00
parent 22fa4cb178
commit 7a5deff0bc
10 changed files with 62 additions and 60 deletions

View File

@ -67,6 +67,7 @@
#define FRONTIER_DOUBLES_PARTY_SIZE 4 #define FRONTIER_DOUBLES_PARTY_SIZE 4
#define FRONTIER_MULTI_PARTY_SIZE 2 #define FRONTIER_MULTI_PARTY_SIZE 2
#define MAX_FRONTIER_PARTY_SIZE FRONTIER_DOUBLES_PARTY_SIZE #define MAX_FRONTIER_PARTY_SIZE FRONTIER_DOUBLES_PARTY_SIZE
#define UNION_ROOM_PARTY_SIZE 2
// string lengths // string lengths
#define ITEM_NAME_LENGTH 14 #define ITEM_NAME_LENGTH 14

View File

@ -24,8 +24,8 @@ extern struct PartyMenu gPartyMenu;
extern bool8 gPartyMenuUseExitCallback; extern bool8 gPartyMenuUseExitCallback;
extern u8 gSelectedMonPartyId; extern u8 gSelectedMonPartyId;
extern MainCallback gPostMenuFieldCallback; extern MainCallback gPostMenuFieldCallback;
extern u8 gSelectedOrderFromParty[4]; extern u8 gSelectedOrderFromParty[MAX_FRONTIER_PARTY_SIZE];
extern u8 gBattlePartyCurrentOrder[3]; extern u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2];
extern void (*gItemUseCB)(u8, TaskFunc); extern void (*gItemUseCB)(u8, TaskFunc);

View File

@ -2578,7 +2578,7 @@ static void CreateDomeOpponentMons(u16 tournamentTrainerId)
// Create mon if it was selected, starting from back // Create mon if it was selected, starting from back
for (i = FRONTIER_PARTY_SIZE - 1; i >= 0; i--) for (i = FRONTIER_PARTY_SIZE - 1; i >= 0; i--)
{ {
if (selectedMonBits & 4) if (selectedMonBits & (1 << (FRONTIER_PARTY_SIZE - 1)))
{ {
CreateDomeOpponentMon(monsCount, tournamentTrainerId, i, otId); CreateDomeOpponentMon(monsCount, tournamentTrainerId, i, otId);
monsCount++; monsCount++;

View File

@ -874,20 +874,20 @@ static bool8 TryInflictRandomStatus(void)
{ {
u8 j, i; u8 j, i;
u8 count; u8 count;
u8 indices[3]; u8 indices[FRONTIER_PARTY_SIZE];
u32 status; u32 status;
u16 species; u16 species;
bool8 statusChosen; bool8 statusChosen;
struct Pokemon *mon; struct Pokemon *mon;
for (i = 0; i < 3; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
indices[i] = i; indices[i] = i;
for (j = 0; j < 10; j++) for (j = 0; j < 10; j++)
{ {
u8 temp, id; u8 temp, id;
i = Random() % 3; i = Random() % FRONTIER_PARTY_SIZE;
id = Random() % 3; id = Random() % FRONTIER_PARTY_SIZE;
SWAP(indices[i], indices[id], temp); SWAP(indices[i], indices[id], temp);
} }
@ -921,7 +921,7 @@ static bool8 TryInflictRandomStatus(void)
{ {
status = sStatusFlags; status = sStatusFlags;
j = 0; j = 0;
for (i = 0; i < 3; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
mon = &gPlayerParty[indices[i]]; mon = &gPlayerParty[indices[i]];
if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE
@ -963,7 +963,7 @@ static bool8 TryInflictRandomStatus(void)
} }
j = 0; j = 0;
for (i = 0; i < 3; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
mon = &gPlayerParty[indices[i]]; mon = &gPlayerParty[indices[i]];
if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE
@ -995,7 +995,7 @@ static bool8 AtLeastOneHealthyMon(void)
count = 3; count = 3;
healthyMonsCount = 0; healthyMonsCount = 0;
for (i = 0; i < 3; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
struct Pokemon *mon = &gPlayerParty[i]; struct Pokemon *mon = &gPlayerParty[i];
if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE
@ -1262,23 +1262,23 @@ static void Task_DoStatusInflictionScreenFlash(u8 taskId)
static void TryHealMons(u8 healCount) static void TryHealMons(u8 healCount)
{ {
u8 j, i, k; u8 j, i, k;
u8 indices[3]; u8 indices[FRONTIER_PARTY_SIZE];
if (healCount == 0) if (healCount == 0)
return; return;
for (i = 0; i < 3; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
indices[i] = i; indices[i] = i;
for (k = 0; k < 10; k++) for (k = 0; k < 10; k++)
{ {
u8 temp; u8 temp;
i = Random() % 3; i = Random() % FRONTIER_PARTY_SIZE;
j = Random() % 3; j = Random() % FRONTIER_PARTY_SIZE;
SWAP(indices[i], indices[j], temp); SWAP(indices[i], indices[j], temp);
} }
for (i = 0; i < 3; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
bool32 canBeHealed = FALSE; bool32 canBeHealed = FALSE;
struct Pokemon *mon = &gPlayerParty[indices[i]]; struct Pokemon *mon = &gPlayerParty[indices[i]];
@ -1483,7 +1483,7 @@ static bool8 AtLeastTwoAliveMons(void)
mon = &gPlayerParty[0]; mon = &gPlayerParty[0];
countDead = 0; countDead = 0;
for (i = 0; i < 3; i++, mon++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++, mon++)
{ {
if (GetMonData(mon, MON_DATA_HP) == 0) if (GetMonData(mon, MON_DATA_HP) == 0)
countDead++; countDead++;

View File

@ -24,6 +24,7 @@
#include "tv.h" #include "tv.h"
#include "battle_factory.h" #include "battle_factory.h"
#include "constants/apprentice.h" #include "constants/apprentice.h"
#include "constants/battle_dome.h"
#include "constants/battle_frontier.h" #include "constants/battle_frontier.h"
#include "constants/battle_frontier_mons.h" #include "constants/battle_frontier_mons.h"
#include "constants/battle_tent_mons.h" #include "constants/battle_tent_mons.h"
@ -2054,7 +2055,7 @@ void DoSpecialTrainerBattle(void)
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES) if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE; gBattleTypeFlags |= BATTLE_TYPE_DOUBLE;
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN) if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
FillFrontierTrainerParty(2); FillFrontierTrainerParty(DOME_BATTLE_PARTY_SIZE);
CreateTask(Task_StartBattleAfterTransition, 1); CreateTask(Task_StartBattleAfterTransition, 1);
sub_806E694(0); sub_806E694(0);
BattleTransition_StartOnField(sub_80B100C(3)); BattleTransition_StartOnField(sub_80B100C(3));
@ -2211,12 +2212,12 @@ static void nullsub_116(void)
static void GetApprenticeMultiPartnerParty(u16 trainerId) static void GetApprenticeMultiPartnerParty(u16 trainerId)
{ {
s32 i, count; s32 i, count;
u32 validSpecies[3]; u32 validSpecies[MULTI_PARTY_SIZE];
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL); u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL); u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
count = 0; count = 0;
for (i = 0; i < 3; i++) for (i = 0; i < MULTI_PARTY_SIZE; i++)
{ {
u16 apprenticeSpecies = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[i].species; u16 apprenticeSpecies = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[i].species;
if (apprenticeSpecies != species1 && apprenticeSpecies != species2) if (apprenticeSpecies != species1 && apprenticeSpecies != species2)
@ -2340,7 +2341,7 @@ static void LoadMultiPartnerCandidatesData(void)
&& gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode) && gSaveBlock2Ptr->apprentices[i].lvlMode - 1 == lvlMode)
{ {
k = 0; k = 0;
for (j = 0; j < 3; j++) for (j = 0; j < MULTI_PARTY_SIZE; j++)
{ {
if (species1 != gSaveBlock2Ptr->apprentices[i].party[j].species if (species1 != gSaveBlock2Ptr->apprentices[i].party[j].species
&& species2 != gSaveBlock2Ptr->apprentices[i].party[j].species) && species2 != gSaveBlock2Ptr->apprentices[i].party[j].species)
@ -2948,26 +2949,26 @@ static void FillPartnerParty(u16 trainerId)
if (trainerId == TRAINER_STEVEN_PARTNER) if (trainerId == TRAINER_STEVEN_PARTNER)
{ {
for (i = 0; i < 3; i++) for (i = 0; i < MULTI_PARTY_SIZE; i++)
{ {
do do
{ {
j = Random32(); j = Random32();
} while (IsShinyOtIdPersonality(STEVEN_OTID, j) || sStevenMons[i].nature != GetNatureFromPersonality(j)); } while (IsShinyOtIdPersonality(STEVEN_OTID, j) || sStevenMons[i].nature != GetNatureFromPersonality(j));
CreateMon(&gPlayerParty[3 + i], CreateMon(&gPlayerParty[MULTI_PARTY_SIZE + i],
sStevenMons[i].species, sStevenMons[i].species,
sStevenMons[i].level, sStevenMons[i].level,
sStevenMons[i].fixedIV, sStevenMons[i].fixedIV,
TRUE, i, // BUG: personality was stored in the 'j' variable. As a result, Steven's pokemon do not have the intended natures. TRUE, i, // BUG: personality was stored in the 'j' variable. As a result, Steven's pokemon do not have the intended natures.
OT_ID_PRESET, STEVEN_OTID); OT_ID_PRESET, STEVEN_OTID);
for (j = 0; j < PARTY_SIZE; j++) for (j = 0; j < PARTY_SIZE; j++)
SetMonData(&gPlayerParty[3 + i], MON_DATA_HP_EV + j, &sStevenMons[i].evs[j]); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_HP_EV + j, &sStevenMons[i].evs[j]);
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++)
SetMonMoveSlot(&gPlayerParty[3 + i], sStevenMons[i].moves[j], j); SetMonMoveSlot(&gPlayerParty[MULTI_PARTY_SIZE + i], sStevenMons[i].moves[j], j);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, gTrainers[TRAINER_STEVEN].trainerName); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, gTrainers[TRAINER_STEVEN].trainerName);
j = MALE; j = MALE;
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
CalculateMonStats(&gPlayerParty[3 + i]); CalculateMonStats(&gPlayerParty[MULTI_PARTY_SIZE + i]);
} }
} }
else if (trainerId == TRAINER_EREADER) else if (trainerId == TRAINER_EREADER)
@ -2980,10 +2981,10 @@ static void FillPartnerParty(u16 trainerId)
level = SetFacilityPtrsGetLevel(); level = SetFacilityPtrsGetLevel();
ivs = GetFrontierTrainerFixedIvs(trainerId); ivs = GetFrontierTrainerFixedIvs(trainerId);
otID = Random32(); otID = Random32();
for (i = 0; i < 2; i++) for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
{ {
monId = gSaveBlock2Ptr->frontier.trainerIds[i + 18]; monId = gSaveBlock2Ptr->frontier.trainerIds[i + 18];
CreateMonWithEVSpreadNatureOTID(&gPlayerParty[3 + i], CreateMonWithEVSpreadNatureOTID(&gPlayerParty[MULTI_PARTY_SIZE + i],
gFacilityTrainerMons[monId].species, gFacilityTrainerMons[monId].species,
level, level,
gFacilityTrainerMons[monId].nature, gFacilityTrainerMons[monId].nature,
@ -2993,23 +2994,23 @@ static void FillPartnerParty(u16 trainerId)
friendship = MAX_FRIENDSHIP; friendship = MAX_FRIENDSHIP;
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++)
{ {
SetMonMoveSlot(&gPlayerParty[3 + i], gFacilityTrainerMons[monId].moves[j], j); SetMonMoveSlot(&gPlayerParty[MULTI_PARTY_SIZE + i], gFacilityTrainerMons[monId].moves[j], j);
if (gFacilityTrainerMons[monId].moves[j] == MOVE_FRUSTRATION) if (gFacilityTrainerMons[monId].moves[j] == MOVE_FRUSTRATION)
friendship = 0; friendship = 0;
} }
SetMonData(&gPlayerParty[3 + i], MON_DATA_FRIENDSHIP, &friendship); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_FRIENDSHIP, &friendship);
SetMonData(&gPlayerParty[3 + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++)
trainerName[j] = gFacilityTrainers[trainerId].trainerName[j]; trainerName[j] = gFacilityTrainers[trainerId].trainerName[j];
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, &trainerName); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, &trainerName);
j = IsFrontierTrainerFemale(trainerId); j = IsFrontierTrainerFemale(trainerId);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
} }
} }
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
trainerId -= TRAINER_RECORD_MIXING_FRIEND; trainerId -= TRAINER_RECORD_MIXING_FRIEND;
for (i = 0; i < 2; i++) for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
{ {
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId]; struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId];
struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.trainerIds[18 + i]]; struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.trainerIds[18 + i]];
@ -3027,20 +3028,20 @@ static void FillPartnerParty(u16 trainerId)
if (monData.nickname[0] == EXT_CTRL_CODE_BEGIN && monData.nickname[1] == EXT_CTRL_CODE_JPN) if (monData.nickname[0] == EXT_CTRL_CODE_BEGIN && monData.nickname[1] == EXT_CTRL_CODE_JPN)
trainerName[5] = EOS; trainerName[5] = EOS;
} }
CreateBattleTowerMon2(&gPlayerParty[3 + i], &monData, TRUE); CreateBattleTowerMon2(&gPlayerParty[MULTI_PARTY_SIZE + i], &monData, TRUE);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, trainerName); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, trainerName);
j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_FRIEND); j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_FRIEND);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
} }
} }
else else
{ {
trainerId -= TRAINER_RECORD_MIXING_APPRENTICE; trainerId -= TRAINER_RECORD_MIXING_APPRENTICE;
for (i = 0; i < 2; i++) for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
{ {
CreateApprenticeMon(&gPlayerParty[3 + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.trainerIds[18 + i]); CreateApprenticeMon(&gPlayerParty[MULTI_PARTY_SIZE + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.trainerIds[18 + i]);
j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_APPRENTICE); j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_APPRENTICE);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
} }
} }
} }
@ -3351,7 +3352,7 @@ static void SetNextBattleTentOpponent(void)
static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
{ {
s32 i, j; s32 i, j;
u16 chosenMonIndices[4]; u16 chosenMonIndices[MAX_FRONTIER_PARTY_SIZE];
u8 friendship; u8 friendship;
u8 level = SetTentPtrsGetLevel(); u8 level = SetTentPtrsGetLevel();
u8 fixedIV = 0; u8 fixedIV = 0;

View File

@ -94,7 +94,7 @@ static const u8 sFrontierBrainStreakAppearances[NUM_FRONTIER_FACILITIES][4] =
[FRONTIER_FACILITY_PYRAMID] = {21, 70, 35, 0}, [FRONTIER_FACILITY_PYRAMID] = {21, 70, 35, 0},
}; };
static const struct FrontierBrainMon sFrontierBrainsMons[][2][3] = static const struct FrontierBrainMon sFrontierBrainsMons[][2][FRONTIER_PARTY_SIZE] =
{ {
[FRONTIER_FACILITY_TOWER] = [FRONTIER_FACILITY_TOWER] =
{ {
@ -1778,9 +1778,9 @@ void ResetWinStreaks(void)
s32 battleMode, lvlMode; s32 battleMode, lvlMode;
gSaveBlock2Ptr->frontier.winStreakActiveFlags = 0; gSaveBlock2Ptr->frontier.winStreakActiveFlags = 0;
for (battleMode = 0; battleMode < 4; battleMode++) for (battleMode = 0; battleMode < FRONTIER_MODE_COUNT; battleMode++)
{ {
for (lvlMode = 0; lvlMode < 2; lvlMode++) for (lvlMode = 0; lvlMode < FRONTIER_LVL_TENT; lvlMode++)
{ {
gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0; gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0;
if (battleMode < FRONTIER_MODE_MULTIS) if (battleMode < FRONTIER_MODE_MULTIS)

View File

@ -155,7 +155,7 @@ static const struct CompressedSpritePalette sHallOfFame_ConfettiSpritePalette[]
{}, {},
}; };
static const s16 sHallOfFame_MonFullTeamPositions[6][4] = static const s16 sHallOfFame_MonFullTeamPositions[PARTY_SIZE][4] =
{ {
{120, 210, 120, 40}, {120, 210, 120, 40},
{326, 220, 56, 40}, {326, 220, 56, 40},
@ -165,7 +165,7 @@ static const s16 sHallOfFame_MonFullTeamPositions[6][4] =
{310, -92, 40, 88} {310, -92, 40, 88}
}; };
static const s16 sHallOfFame_MonHalfTeamPositions[3][4] = static const s16 sHallOfFame_MonHalfTeamPositions[PARTY_SIZE / 2][4] =
{ {
{120, 234, 120, 64}, {120, 234, 120, 64},
{326, 244, 56, 64}, {326, 244, 56, 64},
@ -544,7 +544,7 @@ static void Task_Hof_DisplayMon(u8 taskId)
u16 currMonId = gTasks[taskId].tDisplayedMonId; u16 currMonId = gTasks[taskId].tDisplayedMonId;
struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId]; struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId];
if (gTasks[taskId].tMonNumber > 3) if (gTasks[taskId].tMonNumber > PARTY_SIZE / 2)
{ {
xPos = sHallOfFame_MonFullTeamPositions[currMonId][0]; xPos = sHallOfFame_MonFullTeamPositions[currMonId][0];
yPos = sHallOfFame_MonFullTeamPositions[currMonId][1]; yPos = sHallOfFame_MonFullTeamPositions[currMonId][1];
@ -893,7 +893,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
u16 spriteId; u16 spriteId;
s16 posX, posY; s16 posX, posY;
if (gTasks[taskId].tMonNo > 3) if (gTasks[taskId].tMonNo > PARTY_SIZE / 2)
{ {
posX = sHallOfFame_MonFullTeamPositions[i][2]; posX = sHallOfFame_MonFullTeamPositions[i][2];
posY = sHallOfFame_MonFullTeamPositions[i][3]; posY = sHallOfFame_MonFullTeamPositions[i][3];

View File

@ -152,7 +152,7 @@ EWRAM_DATA u8 gSelectedMonPartyId = 0;
EWRAM_DATA MainCallback gPostMenuFieldCallback = NULL; EWRAM_DATA MainCallback gPostMenuFieldCallback = NULL;
static EWRAM_DATA u16 *sSlot1TilemapBuffer = 0; // for switching party slots static EWRAM_DATA u16 *sSlot1TilemapBuffer = 0; // for switching party slots
static EWRAM_DATA u16 *sSlot2TilemapBuffer = 0; // static EWRAM_DATA u16 *sSlot2TilemapBuffer = 0; //
EWRAM_DATA u8 gSelectedOrderFromParty[4] = {0}; EWRAM_DATA u8 gSelectedOrderFromParty[MAX_FRONTIER_PARTY_SIZE] = {0};
static EWRAM_DATA u16 sPartyMenuItemId = 0; static EWRAM_DATA u16 sPartyMenuItemId = 0;
static EWRAM_DATA u16 sUnused_0203CEFE = 0; static EWRAM_DATA u16 sUnused_0203CEFE = 0;
EWRAM_DATA u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2] = {0}; // bits 0-3 are the current pos of Slot 1, 4-7 are Slot 2, and so on EWRAM_DATA u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2] = {0}; // bits 0-3 are the current pos of Slot 1, 4-7 are Slot 2, and so on
@ -5624,9 +5624,9 @@ static u8 GetMaxBattleEntries(void)
switch (VarGet(VAR_FRONTIER_FACILITY)) switch (VarGet(VAR_FRONTIER_FACILITY))
{ {
case FACILITY_MULTI_OR_EREADER: case FACILITY_MULTI_OR_EREADER:
return 3; return MULTI_PARTY_SIZE;
case FACILITY_UNION_ROOM: case FACILITY_UNION_ROOM:
return 2; return UNION_ROOM_PARTY_SIZE;
default: // Battle Frontier default: // Battle Frontier
return gSpecialVar_0x8005; return gSpecialVar_0x8005;
} }
@ -5639,7 +5639,7 @@ static u8 GetMinBattleEntries(void)
case FACILITY_MULTI_OR_EREADER: case FACILITY_MULTI_OR_EREADER:
return 1; return 1;
case FACILITY_UNION_ROOM: case FACILITY_UNION_ROOM:
return 2; return UNION_ROOM_PARTY_SIZE;
default: // Battle Frontier default: // Battle Frontier
return gSpecialVar_0x8005; return gSpecialVar_0x8005;
} }
@ -6074,7 +6074,7 @@ static void Task_MultiPartnerPartySlideIn(u8 taskId)
SlideMultiPartyMenuBoxSpritesOneStep(taskId); SlideMultiPartyMenuBoxSpritesOneStep(taskId);
if (tXPos == 0) if (tXPos == 0)
{ {
for (i = 3; i < PARTY_SIZE; i++) for (i = MULTI_PARTY_SIZE; i < PARTY_SIZE; i++)
{ {
if (gMultiPartnerParty[i - MULTI_PARTY_SIZE].species != SPECIES_NONE) if (gMultiPartnerParty[i - MULTI_PARTY_SIZE].species != SPECIES_NONE)
AnimateSelectedPartyIcon(sPartyMenuBoxes[i].monSpriteId, 0); AnimateSelectedPartyIcon(sPartyMenuBoxes[i].monSpriteId, 0);

View File

@ -4394,7 +4394,7 @@ u8 CalculatePlayerPartyCount(void)
{ {
gPlayerPartyCount = 0; gPlayerPartyCount = 0;
while (gPlayerPartyCount < 6 while (gPlayerPartyCount < PARTY_SIZE
&& GetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) && GetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
{ {
gPlayerPartyCount++; gPlayerPartyCount++;
@ -4407,7 +4407,7 @@ u8 CalculateEnemyPartyCount(void)
{ {
gEnemyPartyCount = 0; gEnemyPartyCount = 0;
while (gEnemyPartyCount < 6 while (gEnemyPartyCount < PARTY_SIZE
&& GetMonData(&gEnemyParty[gEnemyPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE) && GetMonData(&gEnemyParty[gEnemyPartyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
{ {
gEnemyPartyCount++; gEnemyPartyCount++;
@ -4494,7 +4494,7 @@ void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord)
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleResources->secretBase->party.heldItems[i]); SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleResources->secretBase->party.heldItems[i]);
for (j = 0; j < 6; j++) for (j = 0; j < NUM_STATS; j++)
SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gBattleResources->secretBase->party.EVs[i]); SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gBattleResources->secretBase->party.EVs[i]);
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++)

View File

@ -451,15 +451,15 @@ void sub_801AAD4(void)
{ {
s32 i; s32 i;
sub_8014210(10); sub_8014210(10);
for (i = 0; i < 2; i++) for (i = 0; i < UNION_ROOM_PARTY_SIZE; i++)
{ {
gEnemyParty[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; gEnemyParty[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1];
} }
for (i = 0; i < 6; i++) for (i = 0; i < PARTY_SIZE; i++)
{ {
ZeroMonData(&gPlayerParty[i]); ZeroMonData(&gPlayerParty[i]);
} }
for (i = 0; i < 2; i++) for (i = 0; i < UNION_ROOM_PARTY_SIZE; i++)
{ {
gPlayerParty[i] = gEnemyParty[i]; gPlayerParty[i] = gEnemyParty[i];
} }