mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
more battle frontier 2
This commit is contained in:
parent
269d7c2510
commit
e850517123
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,9 @@ struct ApprenticeTrainer
|
||||
u16 otId;
|
||||
u8 facilityClass;
|
||||
u16 species[APPRENTICE_SPECIES_COUNT];
|
||||
u8 rest[14];
|
||||
u8 unk;
|
||||
u8 unk_;
|
||||
u16 easyChatWords[6];
|
||||
};
|
||||
|
||||
extern const struct ApprenticeTrainer gApprentices[];
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define GUARD_BATTLE_FRONTIER_2_H
|
||||
|
||||
#define FRONTIER_BEFORE_TEXT 0
|
||||
#define FRONTIER_WIN_TEXT 1
|
||||
#define FRONTIER_LOSE_TEXT 2
|
||||
#define FRONTIER_PLAYER_LOST_TEXT 1
|
||||
#define FRONTIER_PLAYER_WON_TEXT 2
|
||||
|
||||
void CopyFrontierTrainerText(u8 whichText, u16 trainerId);
|
||||
void sub_81A8934(u8);
|
||||
@ -15,5 +15,7 @@ void sub_81AA078(u16*, u8);
|
||||
void sub_81A4C30(void);
|
||||
bool8 sub_81A6BF4(void);
|
||||
u8 sub_81A6CA8(u8, u8);
|
||||
void sub_81A3908(void);
|
||||
u32 GetCurrentFacilityWinStreak(void);
|
||||
|
||||
#endif // GUARD_BATTLE_FRONTIER_2_H
|
||||
|
@ -331,8 +331,8 @@ struct EmeraldBattleTowerRecord
|
||||
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
|
||||
/*0x0C*/ u8 trainerId[4];
|
||||
/*0x10*/ u16 greeting[6];
|
||||
/*0x1C*/ u16 unk1C[6];
|
||||
/*0x28*/ u16 unk28[6];
|
||||
/*0x1C*/ u16 speechWon[6];
|
||||
/*0x28*/ u16 speechLost[6];
|
||||
/*0x34*/ struct UnknownPokemonStruct party[4];
|
||||
/*0xE4*/ u8 language;
|
||||
/*0xE8*/ u32 checksum;
|
||||
@ -400,8 +400,8 @@ struct BattleFrontier
|
||||
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
|
||||
/*0xCB4*/ u16 field_CB4[20];
|
||||
/*0xCDC*/ u32 field_CDC;
|
||||
/*0xCE0*/ u16 winStreaks[4][2];
|
||||
/*0xCF0*/ u16 field_CF0[4][2];
|
||||
/*0xCE0*/ u16 towerWinStreaks[4][2];
|
||||
/*0xCF0*/ u16 towerRecordWinStreaks[4][2];
|
||||
/*0xD06*/ u16 field_D00;
|
||||
/*0xD06*/ u16 field_D02;
|
||||
/*0xD06*/ u16 field_D04;
|
||||
@ -418,34 +418,29 @@ struct BattleFrontier
|
||||
/*0xD09*/ u8 filler_D09;
|
||||
/*0xD0A*/ u8 field_D0A;
|
||||
/*0xD0B*/ u8 field_D0B;
|
||||
/*0xD0C*/ u16 field_D0C[2][2];
|
||||
/*0xD14*/ u16 field_D14[2][2];
|
||||
/*0xD1C*/ u16 field_D1C[2][2];
|
||||
/*0xD0C*/ u16 domeWinStreaks[2][2];
|
||||
/*0xD14*/ u16 domeRecordWinStreaks[2][2];
|
||||
/*0xD1C*/ u16 domeTotalChampionships[2][2];
|
||||
/*0xD24*/ struct BattleDomeTrainer domeTrainers[DOME_TOURNAMENT_TRAINERS_COUNT];
|
||||
/*0xD64*/ u16 domeMonId[DOME_TOURNAMENT_TRAINERS_COUNT][3];
|
||||
/*0xD64*/ u16 domeMonIds[DOME_TOURNAMENT_TRAINERS_COUNT][3];
|
||||
/*0xD64*/ u16 field_DC4[2];
|
||||
/*0xDC8*/ u16 field_DC8[2][2];
|
||||
/*0xDD0*/ u16 field_DD0[2][2];
|
||||
/*0xDC8*/ u16 palaceWinStreaks[2][2];
|
||||
/*0xDD0*/ u16 palaceRecordWinStreaks[2][2];
|
||||
/*0xDD8*/ u16 field_DD8;
|
||||
/*0xDDA*/ u16 field_DDA[2];
|
||||
/*0xDDE*/ u16 field_DDE[2];
|
||||
/*0xDE2*/ u16 field_DE2[2][2];
|
||||
/*0xDEA*/ u16 field_DEA[2];
|
||||
/*0xDEE*/ u16 field_DEE;
|
||||
/*0xDF0*/ u16 field_DF0;
|
||||
/*0xDF2*/ u16 field_DF2;
|
||||
/*0xDF4*/ u16 field_DF4;
|
||||
/*0xDF6*/ u16 field_DF6;
|
||||
/*0xDF8*/ u16 field_DF8;
|
||||
/*0xDFA*/ u16 field_DFA;
|
||||
/*0xDFC*/ u16 field_DFC;
|
||||
/*0xDFE*/ u16 field_DFE;
|
||||
/*0xE00*/ u16 field_E00;
|
||||
/*0xDDA*/ u16 arenaWinStreaks[2];
|
||||
/*0xDDE*/ u16 arenaRecordStreaks[2];
|
||||
/*0xDE2*/ u16 factoryWinStreaks[2][2];
|
||||
/*0xDEA*/ u16 factoryRecordWinStreaks[2][2];
|
||||
/*0xDF6*/ u16 factoryRentsCount[2][2];
|
||||
/*0xDFA*/ u16 factoryRecordRentsCount[2][2];
|
||||
/*0xE02*/ u16 field_E02;
|
||||
/*0xE04*/ u16 field_E04[2];
|
||||
/*0xE08*/ u16 field_E08[9];
|
||||
/*0xE1A*/ u16 field_E1A[2];
|
||||
/*0xE1E*/ u16 field_E1E[7];
|
||||
/*0xE04*/ u16 pikeWinStreaks[2];
|
||||
/*0xE08*/ u16 pikeRecordStreaks[2];
|
||||
/*0xE0C*/ u16 pikeTotalStreaks[2];
|
||||
/*0xE10*/ u16 field_E10[5];
|
||||
/*0xE1A*/ u16 pyramidWinStreaks[2];
|
||||
/*0xE1E*/ u16 pyramidRecordStreaks[2];
|
||||
/*0xE1E*/ u16 field_E1F[5];
|
||||
/*0xE2C*/ struct PyramidBag pyramidBag;
|
||||
/*0xE58*/ u16 field_E58;
|
||||
/*0xE6A*/ u16 field_E6A;
|
||||
@ -517,7 +512,7 @@ struct SaveBlock2
|
||||
/*0x1FC*/ struct PokemonJumpResults pokeJump;
|
||||
/*0x20C*/ struct BerryPickingResults berryPick;
|
||||
/*0x21C*/ u8 field_21C[1032];
|
||||
/*0x624*/ u16 contestLinkResults[20]; // 4 positions for 5 categories, possibly a struct or a 2d array
|
||||
/*0x624*/ u16 contestLinkResults[5][4]; // 4 positions for 5 categories.
|
||||
/*0x64C*/ struct BattleFrontier frontier;
|
||||
}; // sizeof=0xF2C
|
||||
|
||||
|
@ -51,5 +51,7 @@ void BravoTrainerPokemonProfile_BeforeInterview1(u16 move);
|
||||
void UpdateTVScreensOnMap(int, int);
|
||||
void TV_PrintIntToStringVar(u8 varIdx, int value);
|
||||
void SaveRecordedItemPurchasesForTVShow(void);
|
||||
bool8 sub_80EE818(void);
|
||||
void sub_80EE8C8(u16 winStreak, u8 facilityAndMode);
|
||||
|
||||
#endif //GUARD_TV_H
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "battle.h"
|
||||
#include "battle_setup.h"
|
||||
#include "battle_tower.h"
|
||||
#include "battle_frontier_2.h"
|
||||
#include "battle_message.h"
|
||||
#include "event_data.h"
|
||||
#include "overworld.h"
|
||||
@ -56,12 +57,11 @@ struct UnkStruct_860DD10
|
||||
};
|
||||
|
||||
extern void sub_81B8558(void);
|
||||
extern u32 sub_81A39C4(void);
|
||||
extern u16 sub_81A5060(u8 monId, u8 moveSlotId);
|
||||
extern u8 sub_81A50F0(u8, u8);
|
||||
extern u8 sub_81A50B0(u8);
|
||||
extern void sub_81A4C30(void);
|
||||
extern bool8 sub_81A3610(void);
|
||||
extern u8 sub_81A3610(void);
|
||||
extern u16 sub_81A4FF0(u8);
|
||||
extern void ReducePlayerPartyToThree(void);
|
||||
|
||||
@ -2575,7 +2575,7 @@ static void InitDomeTrainers(void)
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.domeMonId[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES, NULL);
|
||||
gSaveBlock2Ptr->frontier.domeMonIds[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES, NULL);
|
||||
for (j = 0; j < 4; j++)
|
||||
gSaveBlock2Ptr->frontier.field_EFC[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + j, NULL);
|
||||
for (j = 0; j < 6; j++)
|
||||
@ -2590,7 +2590,7 @@ static void InitDomeTrainers(void)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(sub_81A39C4(), 0);
|
||||
trainerId = sub_8162548(GetCurrentFacilityWinStreak(), 0);
|
||||
for (j = 1; j < i; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.domeTrainers[j].trainerId == trainerId)
|
||||
@ -2603,7 +2603,7 @@ static void InitDomeTrainers(void)
|
||||
{
|
||||
do
|
||||
{
|
||||
trainerId = sub_8162548(sub_81A39C4() + 1, 0);
|
||||
trainerId = sub_8162548(GetCurrentFacilityWinStreak() + 1, 0);
|
||||
for (j = 1; j < i; j++)
|
||||
{
|
||||
if (gSaveBlock2Ptr->frontier.domeTrainers[j].trainerId == trainerId)
|
||||
@ -2621,7 +2621,7 @@ static void InitDomeTrainers(void)
|
||||
monTournamentId = RandomizeFacilityTrainerMonId(trainerId);
|
||||
for (k = 0; k < j; k++)
|
||||
{
|
||||
s32 checkingMonId = gSaveBlock2Ptr->frontier.domeMonId[i][k];
|
||||
s32 checkingMonId = gSaveBlock2Ptr->frontier.domeMonIds[i][k];
|
||||
if (checkingMonId == monTournamentId
|
||||
|| species[0] == gFacilityTrainerMons[monTournamentId].species
|
||||
|| species[1] == gFacilityTrainerMons[monTournamentId].species
|
||||
@ -2630,7 +2630,7 @@ static void InitDomeTrainers(void)
|
||||
}
|
||||
} while (k != j);
|
||||
|
||||
gSaveBlock2Ptr->frontier.domeMonId[i][j] = monTournamentId;
|
||||
gSaveBlock2Ptr->frontier.domeMonIds[i][j] = monTournamentId;
|
||||
species[j] = gFacilityTrainerMons[monTournamentId].species;
|
||||
}
|
||||
|
||||
@ -2671,10 +2671,10 @@ static void InitDomeTrainers(void)
|
||||
ivs = GetDomeTrainerMonIvs(gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId);
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
CalcDomeMonStats(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species,
|
||||
CalcDomeMonStats(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].species,
|
||||
monLevel, ivs,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].evSpread,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].nature,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].evSpread,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].nature,
|
||||
statValues);
|
||||
|
||||
statSums[i] += statValues[STAT_ATK];
|
||||
@ -2683,8 +2683,8 @@ static void InitDomeTrainers(void)
|
||||
statSums[i] += statValues[STAT_SPDEF];
|
||||
statSums[i] += statValues[STAT_SPEED];
|
||||
statSums[i] += statValues[STAT_HP];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species].type1];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species].type2];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].species].type1];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].species].type2];
|
||||
}
|
||||
|
||||
for (monTypesCount = 0, j = 0; j < 32; j++)
|
||||
@ -2737,7 +2737,7 @@ static void InitDomeTrainers(void)
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
gSaveBlock2Ptr->frontier.domeMonId[j][i] = sub_81A4FF0(i);
|
||||
gSaveBlock2Ptr->frontier.domeMonIds[j][i] = sub_81A4FF0(i);
|
||||
}
|
||||
|
||||
Free(statSums);
|
||||
@ -2799,7 +2799,7 @@ static void SwapDomeTrainers(s32 id1, s32 id2, u16 *statsArray)
|
||||
SWAP(gSaveBlock2Ptr->frontier.domeTrainers[id1].trainerId, gSaveBlock2Ptr->frontier.domeTrainers[id2].trainerId, temp);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
SWAP(gSaveBlock2Ptr->frontier.domeMonId[id1][i], gSaveBlock2Ptr->frontier.domeMonId[id2][i], temp);
|
||||
SWAP(gSaveBlock2Ptr->frontier.domeMonIds[id1][i], gSaveBlock2Ptr->frontier.domeMonIds[id2][i], temp);
|
||||
}
|
||||
|
||||
static void sub_818F9B0(void)
|
||||
@ -2829,24 +2829,24 @@ static void CreateDomeMon(u8 monPartyId, u16 tournamentTrainerId, u8 tournamentM
|
||||
u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Should be using trainerId instead of tournamentTrainerId. As a result, all Pokemon have ivs of 3.
|
||||
u8 level = SetFacilityPtrsGetLevel();
|
||||
CreateMonWithEVSpreadPersonalityOTID(&gEnemyParty[monPartyId],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].species,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].species,
|
||||
level,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].nature,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].nature,
|
||||
fixedIv,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].evSpread, otId);
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].evSpread, otId);
|
||||
|
||||
happiness = 0xFF;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
SetMonMoveSlot(&gEnemyParty[monPartyId],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].moves[i], i);
|
||||
if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].moves[i] == MOVE_FRUSTRATION)
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].moves[i], i);
|
||||
if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].moves[i] == MOVE_FRUSTRATION)
|
||||
happiness = 0;
|
||||
}
|
||||
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_FRIENDSHIP, &happiness);
|
||||
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HELD_ITEM,
|
||||
&gBattleFrontierHeldItems[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][tournamentMonId]].itemTableId]);
|
||||
&gBattleFrontierHeldItems[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][tournamentMonId]].itemTableId]);
|
||||
}
|
||||
|
||||
static void CreateDomeTrainerMons(u16 tournamentTrainerId)
|
||||
@ -2922,7 +2922,7 @@ static s32 sub_818FCBC(u16 tournamentTrainerId, bool8 arg1)
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][i]].moves[moveId],
|
||||
array[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][i]].moves[moveId],
|
||||
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), 0);
|
||||
}
|
||||
}
|
||||
@ -2950,7 +2950,7 @@ static s32 sub_818FDB8(u16 tournamentTrainerId, bool8 arg1)
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentTrainerId][i]].moves[moveId],
|
||||
array[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentTrainerId][i]].moves[moveId],
|
||||
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), 1);
|
||||
}
|
||||
}
|
||||
@ -4756,7 +4756,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
{
|
||||
if (trainerId == TRAINER_PLAYER)
|
||||
{
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i],
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i],
|
||||
SpriteCb_MonIcon,
|
||||
x | sInfoTrainerMonX[i],
|
||||
y + sInfoTrainerMonY[i],
|
||||
@ -4765,7 +4765,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
}
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
{
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i],
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i],
|
||||
SpriteCb_MonIcon,
|
||||
x | sInfoTrainerMonX[i],
|
||||
y + sInfoTrainerMonY[i],
|
||||
@ -4774,7 +4774,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
}
|
||||
else
|
||||
{
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].species,
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].species,
|
||||
SpriteCb_MonIcon,
|
||||
x | sInfoTrainerMonX[i],
|
||||
y + sInfoTrainerMonY[i],
|
||||
@ -4837,11 +4837,11 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
{
|
||||
textPrinter.currentY = gUnknown_0860D346[i];
|
||||
if (trainerId == TRAINER_PLAYER)
|
||||
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]];
|
||||
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]];
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]];
|
||||
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]];
|
||||
else
|
||||
textPrinter.current_text_offset = gSpeciesNames[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].species];
|
||||
textPrinter.current_text_offset = gSpeciesNames[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].species];
|
||||
|
||||
textPrinter.windowId = 1 + i + windowId;
|
||||
if (i == 1)
|
||||
@ -4879,7 +4879,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
else if (trainerId == TRAINER_PLAYER)
|
||||
allocatedArray[k] += sMovePointsForDomeTrainers[gSaveBlock2Ptr->frontier.field_EFC[i].moves[j]][k];
|
||||
else
|
||||
allocatedArray[k] += sMovePointsForDomeTrainers[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].moves[j]][k];
|
||||
allocatedArray[k] += sMovePointsForDomeTrainers[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].moves[j]][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4952,7 +4952,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
s32 evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].evSpread;
|
||||
s32 evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
|
||||
for (k = 0, j = 0; j < 6; j++)
|
||||
{
|
||||
allocatedArray[j] = 0;
|
||||
@ -4961,7 +4961,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
evBits >>= 1;
|
||||
}
|
||||
k = MAX_TOTAL_EVS / k;
|
||||
evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].evSpread;
|
||||
evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
|
||||
for (j = 0; j < 6; j++)
|
||||
{
|
||||
if (evBits & 1)
|
||||
@ -4972,7 +4972,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
allocatedArray[6] += allocatedArray[0];
|
||||
for (j = 0; j < 5; j++)
|
||||
{
|
||||
nature = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].nature;
|
||||
nature = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].nature;
|
||||
if (gNatureStatTable[nature][j] > 0)
|
||||
{
|
||||
allocatedArray[j + 7] += (allocatedArray[j + 1] * 110) / 100;
|
||||
@ -5210,7 +5210,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
{
|
||||
if (trainerIds[0] == TRAINER_PLAYER)
|
||||
{
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonId[tournamentIds[0]][i],
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonIds[tournamentIds[0]][i],
|
||||
SpriteCb_MonIcon,
|
||||
x | sFirstTrainerMonX[i],
|
||||
y + sFirstTrainerMonY[i],
|
||||
@ -5219,7 +5219,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
}
|
||||
else if (trainerIds[0] == TRAINER_FRONTIER_BRAIN)
|
||||
{
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonId[tournamentIds[0]][i],
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonIds[tournamentIds[0]][i],
|
||||
SpriteCb_MonIcon,
|
||||
x | sFirstTrainerMonX[i],
|
||||
y + sFirstTrainerMonY[i],
|
||||
@ -5228,7 +5228,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
}
|
||||
else
|
||||
{
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentIds[0]][i]].species,
|
||||
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentIds[0]][i]].species,
|
||||
SpriteCb_MonIcon,
|
||||
x | sFirstTrainerMonX[i],
|
||||
y + sFirstTrainerMonY[i],
|
||||
@ -5250,7 +5250,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
{
|
||||
if (trainerIds[1] == TRAINER_PLAYER)
|
||||
{
|
||||
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonId[tournamentIds[1]][i],
|
||||
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonIds[tournamentIds[1]][i],
|
||||
SpriteCb_MonIcon,
|
||||
x | sSecondTrainerMonX[i],
|
||||
y + sSecondTrainerMonY[i],
|
||||
@ -5259,7 +5259,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
}
|
||||
else if (trainerIds[1] == TRAINER_FRONTIER_BRAIN)
|
||||
{
|
||||
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonId[tournamentIds[1]][i],
|
||||
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gSaveBlock2Ptr->frontier.domeMonIds[tournamentIds[1]][i],
|
||||
SpriteCb_MonIcon,
|
||||
x | sSecondTrainerMonX[i],
|
||||
y + sSecondTrainerMonY[i],
|
||||
@ -5268,7 +5268,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
}
|
||||
else
|
||||
{
|
||||
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentIds[1]][i]].species,
|
||||
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentIds[1]][i]].species,
|
||||
SpriteCb_MonIcon,
|
||||
x | sSecondTrainerMonX[i],
|
||||
y + sSecondTrainerMonY[i],
|
||||
@ -5566,7 +5566,7 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
|
||||
if (gSaveBlock2Ptr->frontier.domeTrainers[winnerTournamentId].trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
moveIds[i * 4 + j] = sub_81A5060(i, j);
|
||||
else
|
||||
moveIds[i * 4 + j] = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[winnerTournamentId][i]].moves[j];
|
||||
moveIds[i * 4 + j] = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[winnerTournamentId][i]].moves[j];
|
||||
|
||||
movePower = gBattleMoves[moveIds[i * 4 + j]].power;
|
||||
if (movePower == 0)
|
||||
@ -5584,9 +5584,9 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
|
||||
do
|
||||
{
|
||||
var = Random32();
|
||||
} while (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[loserTournamentId][k]].nature != GetNatureFromPersonality(var));
|
||||
} while (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[loserTournamentId][k]].nature != GetNatureFromPersonality(var));
|
||||
|
||||
targetSpecies = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[loserTournamentId][k]].species;
|
||||
targetSpecies = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[loserTournamentId][k]].species;
|
||||
if (var & 1)
|
||||
targetAbility = gBaseStats[targetSpecies].ability2;
|
||||
else
|
||||
@ -6193,7 +6193,7 @@ static void sub_8194F58(void)
|
||||
monTournamentId = RandomizeFacilityTrainerMonId(trainerId);
|
||||
for (k = 0; k < j; k++)
|
||||
{
|
||||
s32 checkingMonId = gSaveBlock2Ptr->frontier.domeMonId[i][k];
|
||||
s32 checkingMonId = gSaveBlock2Ptr->frontier.domeMonIds[i][k];
|
||||
if (checkingMonId == monTournamentId
|
||||
|| species[0] == gFacilityTrainerMons[monTournamentId].species
|
||||
|| species[1] == gFacilityTrainerMons[monTournamentId].species
|
||||
@ -6202,7 +6202,7 @@ static void sub_8194F58(void)
|
||||
}
|
||||
} while (k != j);
|
||||
|
||||
gSaveBlock2Ptr->frontier.domeMonId[i][j] = monTournamentId;
|
||||
gSaveBlock2Ptr->frontier.domeMonIds[i][j] = monTournamentId;
|
||||
species[j] = gFacilityTrainerMons[monTournamentId].species;
|
||||
}
|
||||
gSaveBlock2Ptr->frontier.domeTrainers[i].isEliminated = 0;
|
||||
@ -6218,10 +6218,10 @@ static void sub_8194F58(void)
|
||||
ivs = GetDomeTrainerMonIvs(gSaveBlock2Ptr->frontier.domeTrainers[i].trainerId);
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
CalcDomeMonStats(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species,
|
||||
CalcDomeMonStats(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].species,
|
||||
monLevel, ivs,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].evSpread,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].nature,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].evSpread,
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].nature,
|
||||
statValues);
|
||||
|
||||
statSums[i] += statValues[STAT_ATK];
|
||||
@ -6230,8 +6230,8 @@ static void sub_8194F58(void)
|
||||
statSums[i] += statValues[STAT_SPDEF];
|
||||
statSums[i] += statValues[STAT_SPEED];
|
||||
statSums[i] += statValues[STAT_HP];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species].type1];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[i][j]].species].type2];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].species].type1];
|
||||
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[i][j]].species].type2];
|
||||
}
|
||||
|
||||
// Because GF hates temporary vars, trainerId acts like monTypesCount here.
|
||||
@ -6347,11 +6347,11 @@ static void DecideRoundWinners(u8 roundId)
|
||||
{
|
||||
for (monId2 = 0; monId2 < 3; monId2++)
|
||||
{
|
||||
points1 += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId1][monId1]].moves[moveSlot],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId2][monId2]].species, 2);
|
||||
points1 += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentId1][monId1]].moves[moveSlot],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentId2][monId2]].species, 2);
|
||||
}
|
||||
}
|
||||
species = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId1][monId1]].species;
|
||||
species = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentId1][monId1]].species;
|
||||
points1 += ( gBaseStats[species].baseHP
|
||||
+ gBaseStats[species].baseAttack
|
||||
+ gBaseStats[species].baseDefense
|
||||
@ -6370,11 +6370,11 @@ static void DecideRoundWinners(u8 roundId)
|
||||
{
|
||||
for (monId2 = 0; monId2 < 3; monId2++)
|
||||
{
|
||||
points2 += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId2][monId1]].moves[moveSlot],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId1][monId2]].species, 2);
|
||||
points2 += GetTypeEffectivenessPoints(gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentId2][monId1]].moves[moveSlot],
|
||||
gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentId1][monId2]].species, 2);
|
||||
}
|
||||
}
|
||||
species = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[tournamentId2][monId1]].species;
|
||||
species = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[tournamentId2][monId1]].species;
|
||||
points2 += ( gBaseStats[species].baseHP
|
||||
+ gBaseStats[species].baseAttack
|
||||
+ gBaseStats[species].baseDefense
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "battle_frontier_2.h"
|
||||
#include "event_data.h"
|
||||
#include "battle_setup.h"
|
||||
#include "overworld.h"
|
||||
@ -14,7 +15,13 @@
|
||||
#include "battle_records.h"
|
||||
#include "international_string_util.h"
|
||||
#include "string_util.h"
|
||||
#include "new_game.h"
|
||||
#include "link.h"
|
||||
#include "tv.h"
|
||||
#include "apprentice.h"
|
||||
#include "recorded_battle.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/trainers.h"
|
||||
|
||||
extern u8 gUnknown_0203CEF8[];
|
||||
|
||||
@ -22,6 +29,7 @@ extern void (* const gUnknown_08611C18[])(void);
|
||||
extern const u16 gUnknown_08611BFC[][2];
|
||||
extern const struct BattleFrontierTrainer gBattleFrontierTrainers[];
|
||||
extern const struct WindowTemplate gUnknown_08611C74;
|
||||
extern const struct WindowTemplate gUnknown_08611C7C;
|
||||
|
||||
extern void sub_81B8558(void);
|
||||
|
||||
@ -31,10 +39,12 @@ void ShowTowerResultsWindow(u8);
|
||||
void ShowDomeResultsWindow(u8);
|
||||
void ShowPalaceResultsWindow(u8);
|
||||
void ShowPikeResultsWindow(void);
|
||||
void sub_81A2C94(u8);
|
||||
void ShowFactoryResultsWindow(u8);
|
||||
void ShowArenaResultsWindow(void);
|
||||
void sub_81A2F38(void);
|
||||
void sub_81A2FF8(void);
|
||||
void ShowPyramidResultsWindow(void);
|
||||
void ShowLinkContestResultsWindow(void);
|
||||
u8 sub_81A3610(void);
|
||||
void sub_81A51A8(u8);
|
||||
|
||||
void sub_81A1780(void)
|
||||
{
|
||||
@ -173,29 +183,29 @@ void sub_81A1B98(void)
|
||||
gSpecialVar_0x8006 = 0;
|
||||
switch (gSpecialVar_0x8005)
|
||||
{
|
||||
case 0:
|
||||
case FRONTIER_FACILITY_TOWER:
|
||||
ShowTowerResultsWindow(gSpecialVar_0x8006);
|
||||
break;
|
||||
case 1:
|
||||
case FRONTIER_FACILITY_DOME:
|
||||
ShowDomeResultsWindow(gSpecialVar_0x8006);
|
||||
break;
|
||||
case 2:
|
||||
case FRONTIER_FACILITY_PALACE:
|
||||
ShowPalaceResultsWindow(gSpecialVar_0x8006);
|
||||
break;
|
||||
case 5:
|
||||
case FRONTIER_FACILITY_PIKE:
|
||||
ShowPikeResultsWindow();
|
||||
break;
|
||||
case 4:
|
||||
sub_81A2C94(gSpecialVar_0x8006);
|
||||
case FRONTIER_FACILITY_FACTORY:
|
||||
ShowFactoryResultsWindow(gSpecialVar_0x8006);
|
||||
break;
|
||||
case 3:
|
||||
case FRONTIER_FACILITY_ARENA:
|
||||
ShowArenaResultsWindow();
|
||||
break;
|
||||
case 6:
|
||||
sub_81A2F38();
|
||||
case FRONTIER_FACILITY_PYRAMID:
|
||||
ShowPyramidResultsWindow();
|
||||
break;
|
||||
case 7:
|
||||
sub_81A2FF8();
|
||||
ShowLinkContestResultsWindow();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -254,6 +264,18 @@ extern const u8 gText_SetKOTourneyResults[];
|
||||
extern const u8 gText_TimesVar1[];
|
||||
extern const u8 gText_BattleSwapSingleResults[];
|
||||
extern const u8 gText_BattleSwapDoubleResults[];
|
||||
extern const u8 gText_FloorsCleared[];
|
||||
extern const u8 gText_BattleQuestResults[];
|
||||
extern const u8 gText_LinkContestResults[];
|
||||
extern const u8 gText_4th[];
|
||||
extern const u8 gText_3rd[];
|
||||
extern const u8 gText_2nd[];
|
||||
extern const u8 gText_1st[];
|
||||
extern const u8 gText_Cool[];
|
||||
extern const u8 gText_Beauty[];
|
||||
extern const u8 gText_Cute[];
|
||||
extern const u8 gText_Smart[];
|
||||
extern const u8 gText_Tough[];
|
||||
|
||||
// Battle Tower.
|
||||
void TowerPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
|
||||
@ -604,7 +626,7 @@ void ShowArenaResultsWindow(void)
|
||||
}
|
||||
|
||||
// Battle Factory.
|
||||
void sub_81A2A28(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
void FactoryPrintStreak(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
{
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
||||
if (num1 > 9999)
|
||||
@ -618,36 +640,36 @@ void sub_81A2A28(const u8 *str, u16 num1, u16 num2, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x3, y, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
|
||||
void sub_81A2B04(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
void FactoryPrintRecordStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
{
|
||||
u16 num1 = gSaveBlock2Ptr->frontier.field_DEA[battleMode][lvlMode];
|
||||
u16 num2 = gSaveBlock2Ptr->frontier.field_DFA[battleMode][lvlMode];
|
||||
sub_81A2A28(gText_Record, num1, num2, x1, x2, x3, y);
|
||||
u16 num1 = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[battleMode][lvlMode];
|
||||
u16 num2 = gSaveBlock2Ptr->frontier.factoryRecordRentsCount[battleMode][lvlMode];
|
||||
FactoryPrintStreak(gText_Record, num1, num2, x1, x2, x3, y);
|
||||
}
|
||||
|
||||
u16 sub_81A2B70(u8 battleMode, u8 lvlMode)
|
||||
u16 FactoryGetWinStreak(u8 battleMode, u8 lvlMode)
|
||||
{
|
||||
u16 winStreak = gSaveBlock2Ptr->frontier.field_DE2[battleMode][lvlMode];
|
||||
u16 winStreak = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode];
|
||||
if (winStreak > 9999)
|
||||
return 9999;
|
||||
else
|
||||
return winStreak;
|
||||
}
|
||||
|
||||
u16 sub_81A2BA0(u8 battleMode, u8 lvlMode)
|
||||
u16 FactoryGetRentsCount(u8 battleMode, u8 lvlMode)
|
||||
{
|
||||
u16 rents = gSaveBlock2Ptr->frontier.field_DF2[battleMode][lvlMode];
|
||||
u16 rents = gSaveBlock2Ptr->frontier.factoryRentsCount[battleMode][lvlMode];
|
||||
if (rents > 9999)
|
||||
return 9999;
|
||||
else
|
||||
return rents;
|
||||
}
|
||||
|
||||
void sub_81A2BD0(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
void FactoryPrintPrevOrCurrentStreak(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
{
|
||||
bool8 isCurrent;
|
||||
u16 winStreak = sub_81A2B70(battleMode, lvlMode);
|
||||
u16 rents = sub_81A2BA0(battleMode, lvlMode);
|
||||
u16 winStreak = FactoryGetWinStreak(battleMode, lvlMode);
|
||||
u16 rents = FactoryGetRentsCount(battleMode, lvlMode);
|
||||
switch (battleMode)
|
||||
{
|
||||
default:
|
||||
@ -666,12 +688,12 @@ void sub_81A2BD0(u8 battleMode, u8 lvlMode, u8 x1, u8 x2, u8 x3, u8 y)
|
||||
}
|
||||
|
||||
if (isCurrent == TRUE)
|
||||
sub_81A2A28(gText_Current, winStreak, rents, x1, x2, x3, y);
|
||||
FactoryPrintStreak(gText_Current, winStreak, rents, x1, x2, x3, y);
|
||||
else
|
||||
sub_81A2A28(gText_Prev, winStreak, rents, x1, x2, x3, y);
|
||||
FactoryPrintStreak(gText_Prev, winStreak, rents, x1, x2, x3, y);
|
||||
}
|
||||
|
||||
void sub_81A2C94(u8 battleMode)
|
||||
void ShowFactoryResultsWindow(u8 battleMode)
|
||||
{
|
||||
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
|
||||
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
||||
@ -686,11 +708,419 @@ void sub_81A2C94(u8 battleMode)
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_RentalSwap, 152, 33, TEXT_SPEED_FF, NULL);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
|
||||
PrintHyphens(10);
|
||||
sub_81A2BD0(battleMode, FRONTIER_LVL_50, 8, 64, 158, 49);
|
||||
sub_81A2B04(battleMode, FRONTIER_LVL_50, 8, 64, 158, 65);
|
||||
sub_81A2BD0(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 113);
|
||||
sub_81A2B04(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 129);
|
||||
FactoryPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_50, 8, 64, 158, 49);
|
||||
FactoryPrintRecordStreak(battleMode, FRONTIER_LVL_50, 8, 64, 158, 65);
|
||||
FactoryPrintPrevOrCurrentStreak(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 113);
|
||||
FactoryPrintRecordStreak(battleMode, FRONTIER_LVL_OPEN, 8, 64, 158, 129);
|
||||
PutWindowTilemap(gRecordsWindowId);
|
||||
CopyWindowToVram(gRecordsWindowId, 3);
|
||||
}
|
||||
|
||||
// Battle Pyramid.
|
||||
void PyramidPrintStreak(const u8 *str, u16 num, u8 x1, u8 x2, u8 y)
|
||||
{
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x1, y, TEXT_SPEED_FF, NULL);
|
||||
if (num > 9999)
|
||||
num = 9999;
|
||||
ConvertIntToDecimalStringN(gStringVar1, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
||||
StringExpandPlaceholders(gStringVar4, gText_FloorsCleared);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x2, y, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
|
||||
void PyramidPrintRecordStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
||||
{
|
||||
u16 num = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode];
|
||||
PyramidPrintStreak(gText_Record, num, x1, x2, y);
|
||||
}
|
||||
|
||||
u16 PyramidGetWinStreak(u8 lvlMode)
|
||||
{
|
||||
u16 winStreak = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
|
||||
if (winStreak > 9999)
|
||||
return 9999;
|
||||
else
|
||||
return winStreak;
|
||||
}
|
||||
|
||||
void PyramidPrintPrevOrCurrentStreak(u8 lvlMode, u8 x1, u8 x2, u8 y)
|
||||
{
|
||||
bool8 isCurrent;
|
||||
u16 winStreak = PyramidGetWinStreak(lvlMode);
|
||||
|
||||
if (lvlMode != FRONTIER_LVL_50)
|
||||
isCurrent = sub_81A1C24(0x2000);
|
||||
else
|
||||
isCurrent = sub_81A1C24(0x1000);
|
||||
|
||||
if (isCurrent == TRUE)
|
||||
PyramidPrintStreak(gText_Current, winStreak, x1, x2, y);
|
||||
else
|
||||
PyramidPrintStreak(gText_Prev, winStreak, x1, x2, y);
|
||||
}
|
||||
|
||||
void ShowPyramidResultsWindow(void)
|
||||
{
|
||||
gRecordsWindowId = AddWindow(&gUnknown_08611C74);
|
||||
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
||||
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
|
||||
StringExpandPlaceholders(gStringVar4, gText_BattleQuestResults);
|
||||
sub_81A1C4C(gStringVar4, 2);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Lv502, 8, 49, TEXT_SPEED_FF, NULL);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_OpenLv, 8, 97, TEXT_SPEED_FF, NULL);
|
||||
PrintHyphens(10);
|
||||
PyramidPrintPrevOrCurrentStreak(FRONTIER_LVL_50, 64, 111, 49);
|
||||
PyramidPrintRecordStreak(FRONTIER_LVL_50, 64, 111, 65);
|
||||
PyramidPrintPrevOrCurrentStreak(FRONTIER_LVL_OPEN, 64, 111, 97);
|
||||
PyramidPrintRecordStreak(FRONTIER_LVL_OPEN, 64, 111, 113);
|
||||
PutWindowTilemap(gRecordsWindowId);
|
||||
CopyWindowToVram(gRecordsWindowId, 3);
|
||||
}
|
||||
|
||||
// Link contest. Why is it in this file?
|
||||
void ShowLinkContestResultsWindow(void)
|
||||
{
|
||||
const u8 *str;
|
||||
s32 i, j;
|
||||
s32 x;
|
||||
|
||||
gRecordsWindowId = AddWindow(&gUnknown_08611C7C);
|
||||
NewMenuHelpers_DrawStdWindowFrame(gRecordsWindowId, FALSE);
|
||||
FillWindowPixelBuffer(gRecordsWindowId, 0x11);
|
||||
|
||||
StringExpandPlaceholders(gStringVar4, gText_LinkContestResults);
|
||||
x = GetStringCenterAlignXOffset(1, gStringVar4, 0xD0);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, x, 1, TEXT_SPEED_FF, NULL);
|
||||
|
||||
str = gText_1st;
|
||||
x = GetStringRightAlignXOffset(1, str, 0x26) + 50;
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
||||
|
||||
str = gText_2nd;
|
||||
x = GetStringRightAlignXOffset(1, str, 0x26) + 88;
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
||||
|
||||
str = gText_3rd;
|
||||
x = GetStringRightAlignXOffset(1, str, 0x26) + 126;
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
||||
|
||||
str = gText_4th;
|
||||
x = GetStringRightAlignXOffset(1, str, 0x26) + 164;
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, str, x, 25, TEXT_SPEED_FF, NULL);
|
||||
|
||||
x = 6;
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Cool, x, 41, TEXT_SPEED_FF, NULL);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Beauty, x, 57, TEXT_SPEED_FF, NULL);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Cute, x, 73, TEXT_SPEED_FF, NULL);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Smart, x, 89, TEXT_SPEED_FF, NULL);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gText_Tough, x, 105, TEXT_SPEED_FF, NULL);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ConvertIntToDecimalStringN(gStringVar4, gSaveBlock2Ptr->contestLinkResults[i][j], STR_CONV_MODE_RIGHT_ALIGN, 4);
|
||||
AddTextPrinterParameterized(gRecordsWindowId, 1, gStringVar4, (j * 38) + 64, (i * 16) + 41, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
PutWindowTilemap(gRecordsWindowId);
|
||||
CopyWindowToVram(gRecordsWindowId, 3);
|
||||
}
|
||||
|
||||
void sub_81A31FC(void)
|
||||
{
|
||||
u8 text[32];
|
||||
s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
|
||||
switch (facility)
|
||||
{
|
||||
case FRONTIER_FACILITY_TOWER:
|
||||
if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
||||
if (battleMode == FRONTIER_MODE_LINK_MULTIS)
|
||||
{
|
||||
StringCopy(text, gLinkPlayers[gBattleScripting.multiplayerId ^ 1].name);
|
||||
StripExtCtrlCodes(text);
|
||||
StringCopy(gSaveBlock2Ptr->frontier.field_EE1[lvlMode], text);
|
||||
WriteUnalignedWord(gLinkPlayers[gBattleScripting.multiplayerId ^ 1].trainerId, gSaveBlock2Ptr->frontier.field_EF1[lvlMode]);
|
||||
}
|
||||
if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
switch (battleMode)
|
||||
{
|
||||
case FRONTIER_MODE_SINGLES:
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 1);
|
||||
break;
|
||||
case FRONTIER_MODE_DOUBLES:
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 2);
|
||||
break;
|
||||
case FRONTIER_MODE_MULTIS:
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 3);
|
||||
break;
|
||||
case FRONTIER_MODE_LINK_MULTIS:
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode], 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRONTIER_FACILITY_DOME:
|
||||
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
|
||||
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
if (battleMode == FRONTIER_MODE_SINGLES)
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode], 5);
|
||||
else
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode], 6);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRONTIER_FACILITY_PALACE:
|
||||
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
|
||||
if (gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
if (battleMode == FRONTIER_MODE_SINGLES)
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode], 11);
|
||||
else
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode], 12);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRONTIER_FACILITY_ARENA:
|
||||
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.arenaRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode];
|
||||
if (gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode], 10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRONTIER_FACILITY_FACTORY:
|
||||
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[battleMode][lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode];
|
||||
gSaveBlock2Ptr->frontier.factoryRecordRentsCount[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.factoryRentsCount[battleMode][lvlMode];
|
||||
if (gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
if (battleMode == FRONTIER_MODE_SINGLES)
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode], 7);
|
||||
else
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode], 8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRONTIER_FACILITY_PIKE:
|
||||
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.pikeRecordStreaks[lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.pikeRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
|
||||
if (gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode], 9);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FRONTIER_FACILITY_PYRAMID:
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode])
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
|
||||
if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > 1
|
||||
&& sub_80EE818())
|
||||
{
|
||||
sub_80EE8C8(gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode], 13);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A35EC(void)
|
||||
{
|
||||
VarGet(VAR_FRONTIER_FACILITY); // Unused return value.
|
||||
gSpecialVar_Result = sub_81A3610();
|
||||
}
|
||||
|
||||
extern const u8 gUnknown_08611550[][4];
|
||||
|
||||
u8 sub_81A3610(void)
|
||||
{
|
||||
s32 ret = 0;
|
||||
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
u16 val = GetCurrentFacilityWinStreak();
|
||||
s32 r5 = val + gUnknown_08611550[facility][3];
|
||||
s32 symbolsCount;
|
||||
|
||||
if (battleMode != FRONTIER_MODE_SINGLES)
|
||||
return 0;
|
||||
|
||||
symbolsCount = sub_81A3B30(facility);
|
||||
switch (symbolsCount)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
if (r5 == gUnknown_08611550[facility][symbolsCount])
|
||||
ret = symbolsCount + 1;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
if (r5 == gUnknown_08611550[facility][0])
|
||||
ret = 3;
|
||||
else if (r5 == gUnknown_08611550[facility][1])
|
||||
ret = 4;
|
||||
else if (r5 > gUnknown_08611550[facility][1] && (r5 - gUnknown_08611550[facility][1]) % gUnknown_08611550[facility][2] == 0)
|
||||
ret = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CopyFrontierTrainerText(u8 whichText, u16 trainerId)
|
||||
{
|
||||
switch (whichText)
|
||||
{
|
||||
case FRONTIER_BEFORE_TEXT:
|
||||
if (trainerId == TRAINER_EREADER)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.greeting);
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
sub_81A51A8(0);
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].greeting);
|
||||
else
|
||||
CopyFriendsApprenticeChallengeText(trainerId - TRAINER_RECORD_MIXING_APPRENTICE);
|
||||
break;
|
||||
case FRONTIER_PLAYER_LOST_TEXT:
|
||||
if (trainerId == TRAINER_EREADER)
|
||||
{
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerLost);
|
||||
}
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
{
|
||||
sub_81A51A8(0);
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
{
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechWin);
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
FrontierSpeechToString(sub_81864E0());
|
||||
else
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].speechWon);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
FrontierSpeechToString(sub_81864E0());
|
||||
else
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].easyChatWords);
|
||||
}
|
||||
break;
|
||||
case FRONTIER_PLAYER_WON_TEXT:
|
||||
if (trainerId == TRAINER_EREADER)
|
||||
{
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.ereaderTrainer.farewellPlayerWon);
|
||||
}
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
{
|
||||
sub_81A51A8(1);
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
{
|
||||
FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose);
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
FrontierSpeechToString(sub_81864E0());
|
||||
else
|
||||
FrontierSpeechToString(gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].speechLost);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
|
||||
{
|
||||
trainerId = sub_81864A8();
|
||||
FrontierSpeechToString(gApprentices[trainerId].easyChatWords);
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerId = gSaveBlock2Ptr->apprentices[trainerId - TRAINER_RECORD_MIXING_APPRENTICE].id;
|
||||
FrontierSpeechToString(gApprentices[trainerId].easyChatWords);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81A3908(void)
|
||||
{
|
||||
s32 battleMode, lvlMode;
|
||||
|
||||
gSaveBlock2Ptr->frontier.field_CDC = 0;
|
||||
for (battleMode = 0; battleMode < 4; battleMode++)
|
||||
{
|
||||
for (lvlMode = 0; lvlMode < 2; lvlMode++)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0;
|
||||
if (battleMode < FRONTIER_MODE_MULTIS)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0;
|
||||
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = 0;
|
||||
gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] = 0;
|
||||
}
|
||||
if (battleMode == FRONTIER_MODE_SINGLES)
|
||||
{
|
||||
gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] = 0;
|
||||
gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode] = 0;
|
||||
gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gSaveBlock2Ptr->frontier.field_CA8 != 0)
|
||||
gSaveBlock2Ptr->frontier.field_CA8 = 1;
|
||||
}
|
||||
|
||||
u32 GetCurrentFacilityWinStreak(void)
|
||||
{
|
||||
s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||
|
||||
switch (facility)
|
||||
{
|
||||
case FRONTIER_FACILITY_TOWER:
|
||||
return gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode];
|
||||
case FRONTIER_FACILITY_DOME:
|
||||
return gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
|
||||
case FRONTIER_FACILITY_PALACE:
|
||||
return gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode];
|
||||
case FRONTIER_FACILITY_ARENA:
|
||||
return gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode];
|
||||
case FRONTIER_FACILITY_FACTORY:
|
||||
return gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode];
|
||||
case FRONTIER_FACILITY_PIKE:
|
||||
return gSaveBlock2Ptr->frontier.pikeWinStreaks[lvlMode];
|
||||
case FRONTIER_FACILITY_PYRAMID:
|
||||
return gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2579,7 +2579,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
||||
case B_TXT_TRAINER1_LOSE_TEXT: // trainerA lose text
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
{
|
||||
CopyFrontierTrainerText(FRONTIER_LOSE_TEXT, gTrainerBattleOpponent_A);
|
||||
CopyFrontierTrainerText(FRONTIER_PLAYER_WON_TEXT, gTrainerBattleOpponent_A);
|
||||
toCpy = gStringVar4;
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||
@ -2595,7 +2595,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
||||
case B_TXT_TRAINER1_WIN_TEXT: // trainerA win text
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
{
|
||||
CopyFrontierTrainerText(FRONTIER_WIN_TEXT, gTrainerBattleOpponent_A);
|
||||
CopyFrontierTrainerText(FRONTIER_PLAYER_LOST_TEXT, gTrainerBattleOpponent_A);
|
||||
toCpy = gStringVar4;
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||
@ -2676,7 +2676,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
||||
case B_TXT_TRAINER2_LOSE_TEXT:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
{
|
||||
CopyFrontierTrainerText(FRONTIER_LOSE_TEXT, gTrainerBattleOpponent_B);
|
||||
CopyFrontierTrainerText(FRONTIER_PLAYER_WON_TEXT, gTrainerBattleOpponent_B);
|
||||
toCpy = gStringVar4;
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||
@ -2692,7 +2692,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
|
||||
case B_TXT_TRAINER2_WIN_TEXT:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
{
|
||||
CopyFrontierTrainerText(FRONTIER_WIN_TEXT, gTrainerBattleOpponent_B);
|
||||
CopyFrontierTrainerText(FRONTIER_PLAYER_LOST_TEXT, gTrainerBattleOpponent_B);
|
||||
toCpy = gStringVar4;
|
||||
}
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||
|
@ -33,7 +33,6 @@ extern u16 gUnknown_03006298[];
|
||||
extern void sub_81A3ACC(void);
|
||||
extern void CreateFrontierBrainPokemon(void);
|
||||
extern void sub_81A6CD0(void);
|
||||
extern u16 sub_81A39C4(void);
|
||||
extern void SetFrontierBrainTrainerGfxId(void);
|
||||
extern u8 GetFrontierBrainTrainerPicIndex(void);
|
||||
extern u8 GetFrontierBrainTrainerClass(void);
|
||||
@ -364,7 +363,8 @@ static void ChooseNextBattleTowerTrainer(void)
|
||||
{
|
||||
u16 id;
|
||||
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||
u32 r5 = sub_81A39C4() / 7;
|
||||
u16 winStreak = GetCurrentFacilityWinStreak();
|
||||
u32 challengeNum = winStreak / 7;
|
||||
SetFacilityPtrsGetLevel();
|
||||
|
||||
if (battleMode == FRONTIER_MODE_MULTIS || battleMode == FRONTIER_MODE_LINK_MULTIS)
|
||||
@ -385,7 +385,7 @@ static void ChooseNextBattleTowerTrainer(void)
|
||||
s32 i;
|
||||
while (1)
|
||||
{
|
||||
id = sub_8162548(r5, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
id = sub_8162548(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
|
||||
|
||||
// Ensure trainer wasn't previously fought in this challenge.
|
||||
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
|
||||
@ -1516,8 +1516,8 @@ static void sub_8163EE4(void)
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
playerRecord->greeting[i] = gSaveBlock1Ptr->unk2BBC[i];
|
||||
playerRecord->unk1C[i] = gSaveBlock1Ptr->unk2BC8[i];
|
||||
playerRecord->unk28[i] = gSaveBlock1Ptr->unk2BD4[i];
|
||||
playerRecord->speechWon[i] = gSaveBlock1Ptr->unk2BC8[i];
|
||||
playerRecord->speechLost[i] = gSaveBlock1Ptr->unk2BD4[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@ -1795,7 +1795,8 @@ static void sub_8164828(void)
|
||||
s32 i, j, arrId;
|
||||
s32 monPoolId;
|
||||
s32 level = SetFacilityPtrsGetLevel();
|
||||
s32 challengeNum = sub_81A39C4() / 7;
|
||||
u16 winStreak = GetCurrentFacilityWinStreak();
|
||||
s32 challengeNum = winStreak / 7;
|
||||
s32 k = gSpecialVar_LastTalked - 2;
|
||||
s32 trainerId = gSaveBlock2Ptr->frontier.field_CB4[k];
|
||||
|
||||
@ -2425,9 +2426,9 @@ bool32 RubyBattleTowerRecordToEmerald(struct RSBattleTowerRecord *src, struct Em
|
||||
for (i = 0; i < 6; i++)
|
||||
dst->greeting[i] = src->greeting[i];
|
||||
for (i = 0; i < 6; i++)
|
||||
dst->unk1C[i] = gUnknown_085DFA46[i];
|
||||
dst->speechWon[i] = gUnknown_085DFA46[i];
|
||||
for (i = 0; i < 6; i++)
|
||||
dst->unk28[i] = gUnknown_085DFA52[i];
|
||||
dst->speechLost[i] = gUnknown_085DFA52[i];
|
||||
for (i = 0; i < 3; i++)
|
||||
dst->party[i] = src->party[i];
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "tv.h"
|
||||
#include "scanline_effect.h"
|
||||
#include "wild_encounter.h"
|
||||
#include "battle_frontier_2.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/map_types.h"
|
||||
#include "constants/maps.h"
|
||||
@ -136,7 +137,6 @@ extern void sub_8087D74(void);
|
||||
extern void battle_pyramid_map_load_related(u8);
|
||||
extern void sub_80B00E8(u8);
|
||||
extern void sub_80E9238(u8);
|
||||
extern void sub_81A3908(void);
|
||||
extern void sub_81AA2F8(void);
|
||||
extern void sub_8195E10(void);
|
||||
extern void sub_80EDB44(void);
|
||||
|
6
src/tv.c
6
src/tv.c
@ -2500,7 +2500,7 @@ bool8 sub_80EE818(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_80EE8C8(u16 winStreak, u8 facility)
|
||||
void sub_80EE8C8(u16 winStreak, u8 facilityAndMode)
|
||||
{
|
||||
TVShow *show;
|
||||
|
||||
@ -2512,8 +2512,8 @@ void sub_80EE8C8(u16 winStreak, u8 facility)
|
||||
show->frontier.active = FALSE;
|
||||
StringCopy(show->frontier.playerName, gSaveBlock2Ptr->playerName);
|
||||
show->frontier.winStreak = winStreak;
|
||||
show->frontier.facility = facility;
|
||||
switch (facility)
|
||||
show->frontier.facility = facilityAndMode;
|
||||
switch (facilityAndMode)
|
||||
{
|
||||
case 1:
|
||||
case 5:
|
||||
|
Loading…
Reference in New Issue
Block a user