Document gUnknown_03006298

This commit is contained in:
kageru 2020-10-07 23:03:46 +02:00
parent 13f37cf974
commit 52ebc4252e
No known key found for this signature in database
GPG Key ID: 8282A2BEA4ADA3D2
5 changed files with 28 additions and 26 deletions

View File

@ -1 +1 @@
gUnknown_03006298 gFrontierTempParty

View File

@ -43,7 +43,9 @@ extern const struct BattleFrontierTrainer gBattleFrontierTrainers[];
extern const struct FacilityMon gSlateportBattleTentMons[]; extern const struct FacilityMon gSlateportBattleTentMons[];
extern const struct BattleFrontierTrainer gSlateportBattleTentTrainers[]; extern const struct BattleFrontierTrainer gSlateportBattleTentTrainers[];
extern u16 gUnknown_03006298[]; // Temporary storage for monIds of the opponent team
// during team generation in battle factory and similar facilities.
extern u16 gFrontierTempParty[];
extern const struct BattleFrontierTrainer *gFacilityTrainers; extern const struct BattleFrontierTrainer *gFacilityTrainers;
extern const struct FacilityMon *gFacilityTrainerMons; extern const struct FacilityMon *gFacilityTrainerMons;

View File

@ -207,7 +207,7 @@ static void InitFactoryChallenge(void)
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
gSaveBlock2Ptr->frontier.rentalMons[i].monId = 0xFFFF; gSaveBlock2Ptr->frontier.rentalMons[i].monId = 0xFFFF;
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
gUnknown_03006298[i] = 0xFFFF; gFrontierTempParty[i] = 0xFFFF;
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
gTrainerBattleOpponent_A = 0; gTrainerBattleOpponent_A = 0;
@ -355,7 +355,7 @@ static void GenerateOpponentMons(void)
species[i] = gFacilityTrainerMons[monId].species; species[i] = gFacilityTrainerMons[monId].species;
heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]; heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId];
gUnknown_03006298[i] = monId; gFrontierTempParty[i] = monId;
i++; i++;
} }
} }
@ -376,11 +376,11 @@ static void SetRentalsToOpponentParty(void)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
gSaveBlock2Ptr->frontier.rentalMons[i + 3].monId = gUnknown_03006298[i]; gSaveBlock2Ptr->frontier.rentalMons[i + 3].monId = gFrontierTempParty[i];
gSaveBlock2Ptr->frontier.rentalMons[i + 3].ivs = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ATK_IV, NULL); gSaveBlock2Ptr->frontier.rentalMons[i + 3].ivs = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ATK_IV, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i + 3].personality = GetMonData(&gEnemyParty[i], MON_DATA_PERSONALITY, NULL); gSaveBlock2Ptr->frontier.rentalMons[i + 3].personality = GetMonData(&gEnemyParty[i], MON_DATA_PERSONALITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityNum = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ABILITY_NUM, NULL); gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityNum = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ABILITY_NUM, NULL);
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[gUnknown_03006298[i]].itemTableId]); SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[gFrontierTempParty[i]].itemTableId]);
} }
} }
@ -595,7 +595,7 @@ static void GetOpponentMostCommonMonType(void)
typesCount[i] = 0; typesCount[i] = 0;
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
u32 species = gFacilityTrainerMons[gUnknown_03006298[i]].species; u32 species = gFacilityTrainerMons[gFrontierTempParty[i]].species;
typesCount[gBaseStats[species].type1]++; typesCount[gBaseStats[species].type1]++;
if (gBaseStats[species].type1 != gBaseStats[species].type2) if (gBaseStats[species].type1 != gBaseStats[species].type2)
@ -631,7 +631,7 @@ static void GetOpponentBattleStyle(void)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
u16 monId = gUnknown_03006298[i]; u16 monId = gFrontierTempParty[i];
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++)
{ {
u8 battleStyle = GetMoveBattleStyle(gFacilityTrainerMons[monId].moves[j]); u8 battleStyle = GetMoveBattleStyle(gFacilityTrainerMons[monId].moves[j]);

View File

@ -420,7 +420,7 @@ static void GenerateOpponentMons(void)
species[i] = gFacilityTrainerMons[sRandMonSetId].species; species[i] = gFacilityTrainerMons[sRandMonSetId].species;
heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[sRandMonSetId].itemTableId]; heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[sRandMonSetId].itemTableId];
gUnknown_03006298[i] = sRandMonSetId; gFrontierTempParty[i] = sRandMonSetId;
i++; i++;
} }
} }

View File

@ -46,7 +46,7 @@ EWRAM_DATA const struct BattleFrontierTrainer *gFacilityTrainers = NULL;
EWRAM_DATA const struct FacilityMon *gFacilityTrainerMons = NULL; EWRAM_DATA const struct FacilityMon *gFacilityTrainerMons = NULL;
// IWRAM common // IWRAM common
u16 gUnknown_03006298[MAX_FRONTIER_PARTY_SIZE]; u16 gFrontierTempParty[MAX_FRONTIER_PARTY_SIZE];
// This file's functions. // This file's functions.
static void InitTowerChallenge(void); static void InitTowerChallenge(void);
@ -1856,7 +1856,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId)
otID = T1_READ_32(gSaveBlock2Ptr->playerTrainerId); otID = T1_READ_32(gSaveBlock2Ptr->playerTrainerId);
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
u16 monId = gUnknown_03006298[i]; u16 monId = gFrontierTempParty[i];
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[firstMonId + i], CreateMonWithEVSpreadNatureOTID(&gEnemyParty[firstMonId + i],
gFacilityTrainerMons[monId].species, gFacilityTrainerMons[monId].species,
level, level,
@ -1884,7 +1884,7 @@ static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++) for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{ {
u16 monId = gUnknown_03006298[i]; u16 monId = gFrontierTempParty[i];
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[firstMonId + i], CreateMonWithEVSpreadNatureOTID(&gEnemyParty[firstMonId + i],
gFacilityTrainerMons[monId].species, gFacilityTrainerMons[monId].species,
level, level,
@ -2224,11 +2224,11 @@ static void GetApprenticeMultiPartnerParty(u16 trainerId)
} }
} }
gUnknown_03006298[0] = validSpecies[Random() % count]; gFrontierTempParty[0] = validSpecies[Random() % count];
do do
{ {
gUnknown_03006298[1] = validSpecies[Random() % count]; gFrontierTempParty[1] = validSpecies[Random() % count];
} while (gUnknown_03006298[0] == gUnknown_03006298[1]); } while (gFrontierTempParty[0] == gFrontierTempParty[1]);
} }
static void GetRecordMixFriendMultiPartnerParty(u16 trainerId) static void GetRecordMixFriendMultiPartnerParty(u16 trainerId)
@ -2252,11 +2252,11 @@ static void GetRecordMixFriendMultiPartnerParty(u16 trainerId)
} }
} }
gUnknown_03006298[2] = validSpecies[Random() % count]; gFrontierTempParty[2] = validSpecies[Random() % count];
do do
{ {
gUnknown_03006298[3] = validSpecies[Random() % count]; gFrontierTempParty[3] = validSpecies[Random() % count];
} while (gUnknown_03006298[2] == gUnknown_03006298[3]); } while (gFrontierTempParty[2] == gFrontierTempParty[3]);
} }
static void LoadMultiPartnerCandidatesData(void) static void LoadMultiPartnerCandidatesData(void)
@ -2420,15 +2420,15 @@ static void sub_81646BC(u16 trainerId, u16 monId)
} }
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
move = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[gUnknown_03006298[gSpecialVar_0x8005 + 1]].moves[0]; move = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[gFrontierTempParty[gSpecialVar_0x8005 + 1]].moves[0];
species = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[gUnknown_03006298[gSpecialVar_0x8005 + 1]].species; species = gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[gFrontierTempParty[gSpecialVar_0x8005 + 1]].species;
} }
else else
{ {
s32 i; s32 i;
move = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[gUnknown_03006298[gSpecialVar_0x8005 - 1]].moves[0]; move = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[gFrontierTempParty[gSpecialVar_0x8005 - 1]].moves[0];
species = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[gUnknown_03006298[gSpecialVar_0x8005 - 1]].species; species = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].party[gFrontierTempParty[gSpecialVar_0x8005 - 1]].species;
for (i = 0; i < PLAYER_NAME_LENGTH; i++) for (i = 0; i < PLAYER_NAME_LENGTH; i++)
gStringVar3[i] = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].playerName[i]; gStringVar3[i] = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].playerName[i];
gStringVar3[i] = EOS; gStringVar3[i] = EOS;
@ -2497,13 +2497,13 @@ static void ShowPartnerCandidateMessage(void)
} }
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE) else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{ {
gSaveBlock2Ptr->frontier.trainerIds[18] = gUnknown_03006298[2]; gSaveBlock2Ptr->frontier.trainerIds[18] = gFrontierTempParty[2];
gSaveBlock2Ptr->frontier.trainerIds[19] = gUnknown_03006298[3]; gSaveBlock2Ptr->frontier.trainerIds[19] = gFrontierTempParty[3];
} }
else else
{ {
gSaveBlock2Ptr->frontier.trainerIds[18] = gUnknown_03006298[0]; gSaveBlock2Ptr->frontier.trainerIds[18] = gFrontierTempParty[0];
gSaveBlock2Ptr->frontier.trainerIds[19] = gUnknown_03006298[1]; gSaveBlock2Ptr->frontier.trainerIds[19] = gFrontierTempParty[1];
} }
for (k = 0; k < 14; k++) for (k = 0; k < 14; k++)
{ {