Document Frontier Util

This commit is contained in:
GriffinR
2019-11-24 16:58:40 -05:00
committed by huderlem
parent 08a8dc46e3
commit 63ee15fc28
75 changed files with 1813 additions and 2153 deletions
+21 -20
View File
@@ -30,6 +30,7 @@
#include "constants/battle_pyramid.h"
#include "constants/event_objects.h"
#include "constants/event_object_movement_constants.h"
#include "constants/frontier_util.h"
#include "constants/items.h"
#include "constants/layouts.h"
#include "constants/maps.h"
@@ -514,7 +515,7 @@ static const u8 sTrainerTextGroups[50][2] =
{FACILITY_CLASS_SAILOR, 2},
{FACILITY_CLASS_COLLECTOR, 2},
{FACILITY_CLASS_PKMN_BREEDER_M, 2},
{FACILITY_CLASS_POKEMON_BREEDER_F, 3},
{FACILITY_CLASS_PKMN_BREEDER_F, 3},
{FACILITY_CLASS_PKMN_RANGER_M, 2},
{FACILITY_CLASS_PKMN_RANGER_F, 3},
{FACILITY_CLASS_LASS, 3},
@@ -842,13 +843,13 @@ static void InitPyramidChallenge(void)
bool32 isCurrent;
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
gSaveBlock2Ptr->frontier.challengeOutcome = 0;
gSaveBlock2Ptr->frontier.challengeStatus = 0;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
gSaveBlock2Ptr->frontier.field_CA9_a = 0;
gSaveBlock2Ptr->frontier.challengePaused = FALSE;
if (lvlMode != FRONTIER_LVL_50)
isCurrent = gSaveBlock2Ptr->frontier.field_CDC & 0x2000;
isCurrent = gSaveBlock2Ptr->frontier.winStreakActiveFlags & STREAK_PYRAMID_OPEN;
else
isCurrent = gSaveBlock2Ptr->frontier.field_CDC & 0x1000;
isCurrent = gSaveBlock2Ptr->frontier.winStreakActiveFlags & STREAK_PYRAMID_50;
if (!isCurrent)
{
@@ -875,9 +876,9 @@ static void GetBattlePyramidData(void)
break;
case 2:
if (lvlMode != FRONTIER_LVL_50)
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x2000;
gSpecialVar_Result = gSaveBlock2Ptr->frontier.winStreakActiveFlags & STREAK_PYRAMID_OPEN;
else
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x1000;
gSpecialVar_Result = gSaveBlock2Ptr->frontier.winStreakActiveFlags & STREAK_PYRAMID_50;
break;
case 3:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50];
@@ -886,10 +887,10 @@ static void GetBattlePyramidData(void)
gSpecialVar_Result = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN];
break;
case 5:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x1000;
gSpecialVar_Result = gSaveBlock2Ptr->frontier.winStreakActiveFlags & STREAK_PYRAMID_50;
break;
case 6:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x2000;
gSpecialVar_Result = gSaveBlock2Ptr->frontier.winStreakActiveFlags & STREAK_PYRAMID_OPEN;
break;
}
}
@@ -910,16 +911,16 @@ static void SetBattlePyramidData(void)
if (lvlMode != FRONTIER_LVL_50)
{
if (gSpecialVar_0x8006)
gSaveBlock2Ptr->frontier.field_CDC |= 0x2000;
gSaveBlock2Ptr->frontier.winStreakActiveFlags |= STREAK_PYRAMID_OPEN;
else
gSaveBlock2Ptr->frontier.field_CDC &= ~(0x2000);
gSaveBlock2Ptr->frontier.winStreakActiveFlags &= ~(STREAK_PYRAMID_OPEN);
}
else
{
if (gSpecialVar_0x8006)
gSaveBlock2Ptr->frontier.field_CDC |= 0x1000;
gSaveBlock2Ptr->frontier.winStreakActiveFlags |= STREAK_PYRAMID_50;
else
gSaveBlock2Ptr->frontier.field_CDC &= ~(0x1000);
gSaveBlock2Ptr->frontier.winStreakActiveFlags &= ~(STREAK_PYRAMID_50);
}
break;
case 7:
@@ -930,9 +931,9 @@ static void SetBattlePyramidData(void)
static void sub_81A9134(void)
{
gSaveBlock2Ptr->frontier.challengeOutcome = gSpecialVar_0x8005;
gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005;
VarSet(VAR_TEMP_0, 0);
gSaveBlock2Ptr->frontier.field_CA9_a = 1;
gSaveBlock2Ptr->frontier.challengePaused = TRUE;
save_serialize_map();
TrySavingData(SAVE_LINK);
}
@@ -1169,7 +1170,7 @@ static void ClearPyramidPartyHeldItems(void)
for (i = 0; i < PARTY_SIZE; i++)
{
for (j = 0; j < 4; j++)
for (j = 0; j < MAX_FRONTIER_PARTY_SIZE; j++)
{
if (gSaveBlock2Ptr->frontier.selectedPartyMons[j] != 0 && gSaveBlock2Ptr->frontier.selectedPartyMons[j] - 1 == i)
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
@@ -1200,10 +1201,10 @@ static void RestorePyramidPlayerParty(void)
{
int i, j, k, l;
for (i = 0; i < 3; i++)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
int partyIndex = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
for (j = 0; j < 3; j++)
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
{
if (GetMonData(&gSaveBlock1Ptr->playerParty[partyIndex], MON_DATA_SPECIES, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL))
{
@@ -1224,7 +1225,7 @@ static void RestorePyramidPlayerParty(void)
}
}
for (i = 0; i < 3; i++)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
gSaveBlock2Ptr->frontier.selectedPartyMons[i] = gSelectedOrderFromParty[i];
}
@@ -1434,7 +1435,7 @@ void sub_81A9E90(void)
if (InBattlePyramid())
{
RestorePyramidPlayerParty();
gSaveBlock2Ptr->frontier.challengeOutcome = 2;
gSaveBlock2Ptr->frontier.challengeStatus = CHALLENGE_STATUS_PAUSED;
VarSet(VAR_TEMP_E, 0);
LoadPlayerParty();
}