Fix FREE_MATCH_CALL
This commit is contained in:
parent
deb3e6a11d
commit
24ed9e77ff
7 changed files with 52 additions and 15 deletions
|
@ -5,7 +5,7 @@
|
|||
#define FREE_EXTRA_SEEN_FLAGS FALSE // Free up unused Pokédex seen flags (52 bytes).
|
||||
#define FREE_TRAINER_HILL FALSE //frees up trainer hill data. 28 bytes. WARNING THIS HAS BEEN SHOWN TO BREAK MULTI BATTLES
|
||||
#define FREE_MYSTERY_EVENT_BUFFERS FALSE //frees up mystery event and ramScript. roughly 1880 bytes Needed by FREE_BATTLE_TOWER_E_READER
|
||||
#define FREE_MATCH_CALL FALSE //frees up match call data. 104 bytes
|
||||
#define FREE_MATCH_CALL FALSE // Frees up match call and rematch data. (104 bytes).
|
||||
#define FREE_UNION_ROOM_CHAT FALSE //frees up field unk3C88. 210 bytes
|
||||
#define FREE_ENIGMA_BERRY FALSE //frees up enigma berry. 52 bytes
|
||||
#define FREE_LINK_BATTLE_RECORDS FALSE //frees link battle record data. 88 bytes
|
||||
|
|
|
@ -88,7 +88,9 @@ static void SaveChangesToPlayerParty(void);
|
|||
static void HandleBattleVariantEndParty(void);
|
||||
static void CB2_EndTrainerBattle(void);
|
||||
static bool32 IsPlayerDefeated(u32 battleOutcome);
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static u16 GetRematchTrainerId(u16 trainerId);
|
||||
#endif //FREE_MATCH_CALL
|
||||
static void RegisterTrainerInMatchCall(void);
|
||||
static void HandleRematchVarsOnBattleEnd(void);
|
||||
static const u8 *GetIntroSpeechOfApproachingTrainer(void);
|
||||
|
@ -1667,7 +1669,7 @@ s32 TrainerIdToRematchTableId(const struct RematchTrainer *table, u16 trainerId)
|
|||
|
||||
// Returns TRUE if the given trainer (by their entry in the rematch table) is not allowed to have rematches.
|
||||
// This applies to the Elite Four and Victory Road Wally (if he's not been defeated yet)
|
||||
static bool32 IsRematchForbidden(s32 rematchTableId)
|
||||
static inline bool32 IsRematchForbidden(s32 rematchTableId)
|
||||
{
|
||||
if (rematchTableId >= REMATCH_ELITE_FOUR_ENTRIES)
|
||||
return TRUE;
|
||||
|
@ -1679,9 +1681,9 @@ static bool32 IsRematchForbidden(s32 rematchTableId)
|
|||
|
||||
static void SetRematchIdForTrainer(const struct RematchTrainer *table, u32 tableId)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
s32 i;
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
for (i = 1; i < REMATCHES_COUNT; i++)
|
||||
{
|
||||
u16 trainerId = table[tableId].trainerIds[i];
|
||||
|
@ -1696,7 +1698,7 @@ static void SetRematchIdForTrainer(const struct RematchTrainer *table, u32 table
|
|||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
static bool32 DoesCurrentMapMatchRematchTrainerMap(s32 i, const struct RematchTrainer *table, u16 mapGroup, u16 mapNum)
|
||||
static inline bool32 DoesCurrentMapMatchRematchTrainerMap(s32 i, const struct RematchTrainer *table, u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
return table[i].mapGroup == mapGroup && table[i].mapNum == mapNum;
|
||||
}
|
||||
|
@ -1706,6 +1708,7 @@ bool32 TrainerIsMatchCallRegistered(s32 i)
|
|||
return FlagGet(FLAG_MATCH_CALL_REGISTERED + i);
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
s32 i;
|
||||
|
@ -1713,7 +1716,6 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u
|
|||
if (CheckBagHasItem(ITEM_VS_SEEKER, 1) && I_VS_SEEKER_CHARGING != 0)
|
||||
return FALSE;
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
for (i = 0; i <= REMATCH_SPECIAL_TRAINER_START; i++)
|
||||
{
|
||||
if (DoesCurrentMapMatchRematchTrainerMap(i,table,mapGroup,mapNum) && !IsRematchForbidden(i))
|
||||
|
@ -1731,10 +1733,10 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
void UpdateRematchIfDefeated(s32 rematchTableId)
|
||||
{
|
||||
|
@ -1744,9 +1746,9 @@ void UpdateRematchIfDefeated(s32 rematchTableId)
|
|||
|
||||
static bool32 DoesSomeoneWantRematchIn_(const struct RematchTrainer *table, u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
s32 i;
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
|
||||
{
|
||||
if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && gSaveBlock1Ptr->trainerRematches[i] != 0)
|
||||
|
@ -1889,6 +1891,7 @@ static bool8 WasSecondRematchWon(const struct RematchTrainer *table, u16 firstBa
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static bool32 HasAtLeastFiveBadges(void)
|
||||
{
|
||||
s32 i, count;
|
||||
|
@ -1904,6 +1907,7 @@ static bool32 HasAtLeastFiveBadges(void)
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
#define STEP_COUNTER_MAX 255
|
||||
|
||||
|
@ -1922,25 +1926,21 @@ void IncrementRematchStepCounter(void)
|
|||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static bool32 IsRematchStepCounterMaxed(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
if (HasAtLeastFiveBadges() && gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
void TryUpdateRandomTrainerRematches(u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
if (IsRematchStepCounterMaxed() && UpdateRandomTrainerRematches(gRematchTable, mapGroup, mapNum) == TRUE)
|
||||
gSaveBlock1Ptr->trainerRematchStepCounter = 0;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
bool32 DoesSomeoneWantRematchIn(u16 mapGroup, u16 mapNum)
|
||||
{
|
||||
|
@ -1952,6 +1952,7 @@ bool32 IsRematchTrainerIn(u16 mapGroup, u16 mapNum)
|
|||
return IsRematchTrainerIn_(gRematchTable, mapGroup, mapNum);
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static u16 GetRematchTrainerId(u16 trainerId)
|
||||
{
|
||||
if (FlagGet(I_VS_SEEKER_CHARGING) && (I_VS_SEEKER_CHARGING != 0))
|
||||
|
@ -1959,6 +1960,7 @@ static u16 GetRematchTrainerId(u16 trainerId)
|
|||
else
|
||||
return GetRematchTrainerIdFromTable(gRematchTable, trainerId);
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
u16 GetLastBeatenRematchTrainerId(u16 trainerId)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#include "gym_leader_rematch.h"
|
||||
|
||||
static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 maxRematch);
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static s32 GetRematchIndex(u32 trainerIdx);
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
static const u16 GymLeaderRematches_AfterNewMauville[] = {
|
||||
REMATCH_ROXANNE,
|
||||
|
@ -42,11 +44,12 @@ void UpdateGymLeaderRematch(void)
|
|||
|
||||
static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 maxRematch)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
s32 whichLeader = 0;
|
||||
s32 lowestRematchIndex = 5;
|
||||
u32 i;
|
||||
s32 rematchIndex;
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
|
||||
|
@ -93,6 +96,7 @@ static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 ma
|
|||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static s32 GetRematchIndex(u32 trainerIdx)
|
||||
{
|
||||
s32 i;
|
||||
|
@ -105,3 +109,4 @@ static s32 GetRematchIndex(u32 trainerIdx)
|
|||
}
|
||||
return 5;
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
|
|
@ -1462,6 +1462,8 @@ static bool32 TrainerIsEligibleForRematch(int matchCallId)
|
|||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
|
|
|
@ -820,7 +820,9 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
|
|||
ClearTempFieldEventData();
|
||||
ResetCyclingRoadChallengeData();
|
||||
RestartWildEncounterImmunitySteps();
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
TryUpdateRandomTrainerRematches(mapGroup, mapNum);
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
if (I_VS_SEEKER_CHARGING != 0)
|
||||
MapResetTrainerRematches(mapGroup, mapNum);
|
||||
|
@ -874,7 +876,9 @@ static void LoadMapFromWarp(bool32 a1)
|
|||
ClearTempFieldEventData();
|
||||
ResetCyclingRoadChallengeData();
|
||||
RestartWildEncounterImmunitySteps();
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
TryUpdateRandomTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
if (I_VS_SEEKER_CHARGING != 0)
|
||||
MapResetTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
|
||||
|
|
|
@ -365,9 +365,9 @@ static const struct ScanlineEffectParams sPokenavMainMenuScanlineEffectParams =
|
|||
|
||||
static bool32 AreAnyTrainerRematchesNearby(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
s32 i;
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
|
||||
{
|
||||
if (GetMatchTableMapSectionId(i) == gMapHeader.regionMapSectionId
|
||||
|
|
|
@ -88,13 +88,17 @@ static void GatherNearbyTrainerInfo(void);
|
|||
static void Task_VsSeeker_ShowResponseToPlayer(u8 taskId);
|
||||
static bool8 CanUseVsSeeker(void);
|
||||
static u8 GetVsSeekerResponseInArea(void);
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static u8 GetResponseMovementTypeFromTrainerGraphicsId(u8 graphicsId);
|
||||
#endif //FREE_MATCH_CALL
|
||||
static u16 GetTrainerFlagFromScript(const u8 * script);
|
||||
static void ClearAllTrainerRematchStates(void);
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static bool8 IsTrainerVisibleOnScreen(struct VsSeekerTrainerInfo * trainerInfo);
|
||||
static u32 GetRematchableTrainerLocalId(void);
|
||||
static void StartTrainerObjectMovementScript(struct VsSeekerTrainerInfo * trainerInfo, const u8 * script);
|
||||
static u8 GetCurVsSeekerResponse(s32 vsSeekerIdx, u16 trainerIdx);
|
||||
#endif //FREE_MATCH_CALL
|
||||
static void StartAllRespondantIdleMovements(void);
|
||||
static bool8 ObjectEventIdIsSane(u8 objectEventId);
|
||||
static u8 GetRandomFaceDirectionMovementType();
|
||||
|
@ -221,6 +225,7 @@ void VsSeekerResetObjectMovementAfterChargeComplete(void)
|
|||
|
||||
bool8 UpdateVsSeekerStepCounter(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
u8 x = 0;
|
||||
|
||||
if (!I_VS_SEEKER_CHARGING) return FALSE;
|
||||
|
@ -246,6 +251,7 @@ bool8 UpdateVsSeekerStepCounter(void)
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -284,12 +290,16 @@ static void ResetMovementOfRematchableTrainers(void)
|
|||
|
||||
static void VsSeekerResetInBagStepCounter(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
gSaveBlock1Ptr->trainerRematchStepCounter &= 0xFF00;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
static void VsSeekerResetChargingStepCounter(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
gSaveBlock1Ptr->trainerRematchStepCounter &= 0x00FF;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
void Task_InitVsSeekerAndCheckForTrainersOnScreen(u8 taskId)
|
||||
|
@ -403,6 +413,7 @@ static void Task_VsSeeker_ShowResponseToPlayer(u8 taskId)
|
|||
|
||||
static u8 CanUseVsSeeker(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
u8 vsSeekerChargeSteps = gSaveBlock1Ptr->trainerRematchStepCounter;
|
||||
|
||||
if ((vsSeekerChargeSteps == VSSEEKER_RECHARGE_STEPS) && (GetRematchableTrainerLocalId() == 0xFF))
|
||||
|
@ -413,10 +424,14 @@ static u8 CanUseVsSeeker(void)
|
|||
|
||||
ConvertIntToDecimalStringN(gStringVar1, (VSSEEKER_RECHARGE_STEPS - vsSeekerChargeSteps), STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
return VSSEEKER_NOT_CHARGED;
|
||||
#else
|
||||
return VSSEEKER_NO_ONE_IN_RANGE;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
static u8 GetVsSeekerResponseInArea(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
u16 trainerIdx = 0;
|
||||
u8 response = 0, rematchTrainerIdx;
|
||||
s32 vsSeekerIdx = 0, randomValue = 0;
|
||||
|
@ -486,6 +501,7 @@ static u8 GetVsSeekerResponseInArea(void)
|
|||
|
||||
if (sVsSeeker->trainerHasNotYetBeenFought)
|
||||
return VSSEEKER_RESPONSE_UNFOUGHT_TRAINERS;
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
return VSSEEKER_RESPONSE_NO_RESPONSE;
|
||||
}
|
||||
|
@ -589,6 +605,7 @@ static u8 GetRandomFaceDirectionMovementType()
|
|||
}
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static bool32 IsRegularLandTrainer(u8 graphicsId)
|
||||
{
|
||||
u32 i;
|
||||
|
@ -677,6 +694,7 @@ static u8 GetResponseMovementTypeFromTrainerGraphicsId(u8 graphicsId)
|
|||
|
||||
return MOVEMENT_TYPE_FACE_DOWN;
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
static u16 GetTrainerFlagFromScript(const u8 *script)
|
||||
/*
|
||||
|
@ -701,6 +719,7 @@ static u16 GetTrainerFlagFromScript(const u8 *script)
|
|||
|
||||
static void ClearAllTrainerRematchStates(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
u32 i;
|
||||
|
||||
if (!CheckBagHasItem(ITEM_VS_SEEKER, 1))
|
||||
|
@ -708,8 +727,10 @@ static void ClearAllTrainerRematchStates(void)
|
|||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->trainerRematches); i++)
|
||||
gSaveBlock1Ptr->trainerRematches[i] = 0;
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
static bool8 IsTrainerVisibleOnScreen(struct VsSeekerTrainerInfo * trainerInfo)
|
||||
{
|
||||
s16 x;
|
||||
|
@ -769,9 +790,11 @@ static u8 GetCurVsSeekerResponse(s32 vsSeekerIdx, u16 trainerIdx)
|
|||
}
|
||||
return VSSEEKER_SINGLE_RESP_RAND;
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
|
||||
static void StartAllRespondantIdleMovements(void)
|
||||
{
|
||||
#if FREE_MATCH_CALL == FALSE
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
|
@ -790,4 +813,5 @@ static void StartAllRespondantIdleMovements(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif //FREE_MATCH_CALL
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue