From 87078e355d220acbb28a1b7981c1188cef9b126d Mon Sep 17 00:00:00 2001 From: FosterProgramming Date: Wed, 4 Mar 2026 13:16:37 +0100 Subject: [PATCH] Fix free match call compile fail (#9416) --- include/match_call.h | 5 +++++ src/debug.c | 17 +++++++++-------- src/match_call.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/include/match_call.h b/include/match_call.h index 468a977a13..5f949b408a 100644 --- a/include/match_call.h +++ b/include/match_call.h @@ -21,4 +21,9 @@ void LoadMatchCallWindowGfx(u32 windowId, u32 destOffset, u32 paletteId); void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId); void RedrawMatchCallTextBoxBorder(void); +bool32 GetActiveTrainerRematches(u32 matchCallId); +void SetActiveTrainerRematches(u32 matchCallId, u32 value); +u32 GetTrainerRematchStepCounter(void); +void SetTrainerRematchStepCounter(u32 value); + #endif //GUARD_MATCH_CALL_H diff --git a/src/debug.c b/src/debug.c index 1825cc6752..a2d7acb834 100644 --- a/src/debug.c +++ b/src/debug.c @@ -26,6 +26,7 @@ #include "m4a.h" #include "main.h" #include "main_menu.h" +#include "match_call.h" #include "malloc.h" #include "map_name_popup.h" #include "menu.h" @@ -1082,18 +1083,18 @@ static u8 Debug_GenerateListTrainerMenu(void) } break; case 6: - if (I_VS_SEEKER_CHARGING || !isRealFight || rematchTableId == -1) + if (FREE_MATCH_CALL || I_VS_SEEKER_CHARGING || !isRealFight || rematchTableId == -1) { noDraw = TRUE; break; } - if (gSaveBlock1Ptr->trainerRematches[rematchTableId]) + if (GetActiveTrainerRematches(rematchTableId)) StringCopy(gStringVar1, COMPOUND_STRING("{COLOR GREEN} TRUE")); else StringCopy(gStringVar1, COMPOUND_STRING("{COLOR RED} FALSE")); break; case 8: - if (I_VS_SEEKER_CHARGING == 0) + if (FREE_MATCH_CALL || I_VS_SEEKER_CHARGING == 0) noDraw = TRUE; break; } @@ -2140,12 +2141,12 @@ static void DebugAction_Trainers_SetRematch(u8 taskId) static void DebugAction_Trainers_SetRematchReadiness(u8 taskId) { - if (gSaveBlock1Ptr->trainerRematches[sDebugMenuListData->data[1]] == -1) + if (sDebugMenuListData->data[1] == -1) return; - if (gSaveBlock1Ptr->trainerRematches[sDebugMenuListData->data[1]]) - gSaveBlock1Ptr->trainerRematches[sDebugMenuListData->data[1]] = FALSE; + if (GetActiveTrainerRematches(sDebugMenuListData->data[1])) + SetActiveTrainerRematches(sDebugMenuListData->data[1], FALSE); else - gSaveBlock1Ptr->trainerRematches[sDebugMenuListData->data[1]] = TRUE; + SetActiveTrainerRematches(sDebugMenuListData->data[1], TRUE); } static void DebugAction_Trainers_TryBattle(u8 taskId) @@ -2192,7 +2193,7 @@ static void DebugAction_Trainers_TryBattle(u8 taskId) static void DebugAction_Trainers_RechargeVsSeeker(u8 taskId) { - gSaveBlock1Ptr->trainerRematchStepCounter = VSSEEKER_RECHARGE_STEPS; + SetTrainerRematchStepCounter(VSSEEKER_RECHARGE_STEPS); MapResetTrainerRematches(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum); ScriptContext_SetupScript(EventScript_VsSeekerChargingDone); Debug_DestroyMenu_Full(taskId); diff --git a/src/match_call.c b/src/match_call.c index db27c575ef..714ef1f527 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -2041,3 +2041,35 @@ void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId) { DrawMatchCallTextBoxBorder_Internal(windowId, tileOffset, paletteId); } + +u32 GetTrainerRematchStepCounter(void) +{ +#if FREE_MATCH_CALL == FALSE + return gSaveBlock1Ptr->trainerRematchStepCounter; +#else + return 0; +#endif +} + +void SetTrainerRematchStepCounter(u32 value) +{ +#if FREE_MATCH_CALL == FALSE + gSaveBlock1Ptr->trainerRematchStepCounter = value; +#endif +} + +u32 GetActiveTrainerRematches(u32 matchCallId) +{ +#if FREE_MATCH_CALL == FALSE + return gSaveBlock1Ptr->trainerRematches[matchCallId]; +#else + return 0; +#endif +} + +void SetActiveTrainerRematches(u32 matchCallId, u32 value) +{ +#if FREE_MATCH_CALL == FALSE + gSaveBlock1Ptr->trainerRematches[matchCallId] = value; +#endif +}