diff --git a/include/constants/flags.h b/include/constants/flags.h index 8d98e3aa04..5b1b5efd19 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -2,6 +2,7 @@ #define GUARD_CONSTANTS_FLAGS_H #include "constants/opponents.h" +#include "constants/rematches.h" // Temporary Flags // These temporary flags are are cleared every time a map is loaded. They are used @@ -375,86 +376,89 @@ #define FLAG_MET_FRONTIER_BEAUTY_MOVE_TUTOR 0x15A #define FLAG_MET_FRONTIER_SWIMMER_MOVE_TUTOR 0x15B -// Trainer Rematch Flags -#define FLAG_MATCH_CALL_REGISTERED 0x15C -#define FLAG_REMATCH_ROSE 0x15D -#define FLAG_REMATCH_ANDRES 0x15E -#define FLAG_REMATCH_DUSTY 0x15F -#define FLAG_REMATCH_LOLA 0x160 -#define FLAG_REMATCH_RICKY 0x161 -#define FLAG_REMATCH_LILA_AND_ROY 0x162 -#define FLAG_REMATCH_CRISTIN 0x163 -#define FLAG_REMATCH_BROOKE 0x164 -#define FLAG_REMATCH_WILTON 0x165 -#define FLAG_REMATCH_VALERIE 0x166 -#define FLAG_REMATCH_CINDY 0x167 -#define FLAG_REMATCH_THALIA 0x168 -#define FLAG_REMATCH_JESSICA 0x169 -#define FLAG_REMATCH_WINSTON 0x16A -#define FLAG_REMATCH_STEVE 0x16B -#define FLAG_REMATCH_TONY 0x16C -#define FLAG_REMATCH_NOB 0x16D -#define FLAG_REMATCH_KOJI 0x16E -#define FLAG_REMATCH_FERNANDO 0x16F -#define FLAG_REMATCH_DALTON 0x170 -#define FLAG_REMATCH_BERNIE 0x171 -#define FLAG_REMATCH_ETHAN 0x172 -#define FLAG_REMATCH_JOHN_AND_JAY 0x173 -#define FLAG_REMATCH_JEFFREY 0x174 -#define FLAG_REMATCH_CAMERON 0x175 -#define FLAG_REMATCH_JACKI 0x176 -#define FLAG_REMATCH_WALTER 0x177 -#define FLAG_REMATCH_KAREN 0x178 -#define FLAG_REMATCH_JERRY 0x179 -#define FLAG_REMATCH_ANNA_AND_MEG 0x17A -#define FLAG_REMATCH_ISABEL 0x17B -#define FLAG_REMATCH_MIGUEL 0x17C -#define FLAG_REMATCH_TIMOTHY 0x17D -#define FLAG_REMATCH_SHELBY 0x17E -#define FLAG_REMATCH_CALVIN 0x17F -#define FLAG_REMATCH_ELLIOT 0x180 -#define FLAG_REMATCH_ISAIAH 0x181 -#define FLAG_REMATCH_MARIA 0x182 -#define FLAG_REMATCH_ABIGAIL 0x183 -#define FLAG_REMATCH_DYLAN 0x184 -#define FLAG_REMATCH_KATELYN 0x185 -#define FLAG_REMATCH_BENJAMIN 0x186 -#define FLAG_REMATCH_PABLO 0x187 -#define FLAG_REMATCH_NICOLAS 0x188 -#define FLAG_REMATCH_ROBERT 0x189 -#define FLAG_REMATCH_LAO 0x18A -#define FLAG_REMATCH_CYNDY 0x18B -#define FLAG_REMATCH_MADELINE 0x18C -#define FLAG_REMATCH_JENNY 0x18D -#define FLAG_REMATCH_DIANA 0x18E -#define FLAG_REMATCH_AMY_AND_LIV 0x18F -#define FLAG_REMATCH_ERNEST 0x190 -#define FLAG_REMATCH_CORY 0x191 -#define FLAG_REMATCH_EDWIN 0x192 -#define FLAG_REMATCH_LYDIA 0x193 -#define FLAG_REMATCH_ISAAC 0x194 -#define FLAG_REMATCH_GABRIELLE 0x195 -#define FLAG_REMATCH_CATHERINE 0x196 -#define FLAG_REMATCH_JACKSON 0x197 -#define FLAG_REMATCH_HALEY 0x198 -#define FLAG_REMATCH_JAMES 0x199 -#define FLAG_REMATCH_TRENT 0x19A -#define FLAG_REMATCH_SAWYER 0x19B -#define FLAG_REMATCH_KIRA_AND_DAN 0x19C -#define FLAG_REMATCH_WALLY 0x19D -#define FLAG_REMATCH_ROXANNE 0x19E -#define FLAG_REMATCH_BRAWLY 0x19F -#define FLAG_REMATCH_WATTSON 0x1A0 -#define FLAG_REMATCH_FLANNERY 0x1A1 -#define FLAG_REMATCH_NORMAN 0x1A2 -#define FLAG_REMATCH_WINONA 0x1A3 -#define FLAG_REMATCH_TATE_AND_LIZA 0x1A4 -// Note: FLAG_REMATCH_JUAN is handled by FLAG_ENABLE_JUAN_MATCH_CALL instead. -#define FLAG_REMATCH_SIDNEY 0x1A5 -#define FLAG_REMATCH_PHOEBE 0x1A6 -#define FLAG_REMATCH_GLACIA 0x1A7 -#define FLAG_REMATCH_DRAKE 0x1A8 -#define FLAG_REMATCH_WALLACE 0x1A9 +// Flags for whether a rematchable trainer has been registered in the player's Match Call. +// Most are used implicitly by adding their REMATCH_* id to TRAINER_REGISTERED_FLAGS_START. +// Some Match Call entries (like those for gym leaders, Wally, and all non-trainer NPCs like Prof. Birch) +// have their own separate flag that needs to be set to be enabled; see src/pokenav_match_call_data.c +#define TRAINER_REGISTERED_FLAGS_START 0x15C +#define FLAG_REGISTERED_ROSE (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROSE) +#define FLAG_REGISTERED_ANDRES (TRAINER_REGISTERED_FLAGS_START + REMATCH_ANDRES) +#define FLAG_REGISTERED_DUSTY (TRAINER_REGISTERED_FLAGS_START + REMATCH_DUSTY) +#define FLAG_REGISTERED_LOLA (TRAINER_REGISTERED_FLAGS_START + REMATCH_LOLA) +#define FLAG_REGISTERED_RICKY (TRAINER_REGISTERED_FLAGS_START + REMATCH_RICKY) +#define FLAG_REGISTERED_LILA_AND_ROY (TRAINER_REGISTERED_FLAGS_START + REMATCH_LILA_AND_ROY) +#define FLAG_REGISTERED_CRISTIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_CRISTIN) +#define FLAG_REGISTERED_BROOKE (TRAINER_REGISTERED_FLAGS_START + REMATCH_BROOKE) +#define FLAG_REGISTERED_WILTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WILTON) +#define FLAG_REGISTERED_VALERIE (TRAINER_REGISTERED_FLAGS_START + REMATCH_VALERIE) +#define FLAG_REGISTERED_CINDY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CINDY) +#define FLAG_REGISTERED_THALIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_THALIA) +#define FLAG_REGISTERED_JESSICA (TRAINER_REGISTERED_FLAGS_START + REMATCH_JESSICA) +#define FLAG_REGISTERED_WINSTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WINSTON) +#define FLAG_REGISTERED_STEVE (TRAINER_REGISTERED_FLAGS_START + REMATCH_STEVE) +#define FLAG_REGISTERED_TONY (TRAINER_REGISTERED_FLAGS_START + REMATCH_TONY) +#define FLAG_REGISTERED_NOB (TRAINER_REGISTERED_FLAGS_START + REMATCH_NOB) +#define FLAG_REGISTERED_KOJI (TRAINER_REGISTERED_FLAGS_START + REMATCH_KOJI) +#define FLAG_REGISTERED_FERNANDO (TRAINER_REGISTERED_FLAGS_START + REMATCH_FERNANDO) +#define FLAG_REGISTERED_DALTON (TRAINER_REGISTERED_FLAGS_START + REMATCH_DALTON) +#define FLAG_REGISTERED_BERNIE (TRAINER_REGISTERED_FLAGS_START + REMATCH_BERNIE) +#define FLAG_REGISTERED_ETHAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_ETHAN) +#define FLAG_REGISTERED_JOHN_AND_JAY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JOHN_AND_JAY) +#define FLAG_REGISTERED_JEFFREY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JEFFREY) +#define FLAG_REGISTERED_CAMERON (TRAINER_REGISTERED_FLAGS_START + REMATCH_CAMERON) +#define FLAG_REGISTERED_JACKI (TRAINER_REGISTERED_FLAGS_START + REMATCH_JACKI) +#define FLAG_REGISTERED_WALTER (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALTER) +#define FLAG_REGISTERED_KAREN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KAREN) +#define FLAG_REGISTERED_JERRY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JERRY) +#define FLAG_REGISTERED_ANNA_AND_MEG (TRAINER_REGISTERED_FLAGS_START + REMATCH_ANNA_AND_MEG) +#define FLAG_REGISTERED_ISABEL (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISABEL) +#define FLAG_REGISTERED_MIGUEL (TRAINER_REGISTERED_FLAGS_START + REMATCH_MIGUEL) +#define FLAG_REGISTERED_TIMOTHY (TRAINER_REGISTERED_FLAGS_START + REMATCH_TIMOTHY) +#define FLAG_REGISTERED_SHELBY (TRAINER_REGISTERED_FLAGS_START + REMATCH_SHELBY) +#define FLAG_REGISTERED_CALVIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_CALVIN) +#define FLAG_REGISTERED_ELLIOT (TRAINER_REGISTERED_FLAGS_START + REMATCH_ELLIOT) +#define FLAG_REGISTERED_ISAIAH (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISAIAH) +#define FLAG_REGISTERED_MARIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_MARIA) +#define FLAG_REGISTERED_ABIGAIL (TRAINER_REGISTERED_FLAGS_START + REMATCH_ABIGAIL) +#define FLAG_REGISTERED_DYLAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_DYLAN) +#define FLAG_REGISTERED_KATELYN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KATELYN) +#define FLAG_REGISTERED_BENJAMIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_BENJAMIN) +#define FLAG_REGISTERED_PABLO (TRAINER_REGISTERED_FLAGS_START + REMATCH_PABLO) +#define FLAG_REGISTERED_NICOLAS (TRAINER_REGISTERED_FLAGS_START + REMATCH_NICOLAS) +#define FLAG_REGISTERED_ROBERT (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROBERT) +#define FLAG_REGISTERED_LAO (TRAINER_REGISTERED_FLAGS_START + REMATCH_LAO) +#define FLAG_REGISTERED_CYNDY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CYNDY) +#define FLAG_REGISTERED_MADELINE (TRAINER_REGISTERED_FLAGS_START + REMATCH_MADELINE) +#define FLAG_REGISTERED_JENNY (TRAINER_REGISTERED_FLAGS_START + REMATCH_JENNY) +#define FLAG_REGISTERED_DIANA (TRAINER_REGISTERED_FLAGS_START + REMATCH_DIANA) +#define FLAG_REGISTERED_AMY_AND_LIV (TRAINER_REGISTERED_FLAGS_START + REMATCH_AMY_AND_LIV) +#define FLAG_REGISTERED_ERNEST (TRAINER_REGISTERED_FLAGS_START + REMATCH_ERNEST) +#define FLAG_REGISTERED_CORY (TRAINER_REGISTERED_FLAGS_START + REMATCH_CORY) +#define FLAG_REGISTERED_EDWIN (TRAINER_REGISTERED_FLAGS_START + REMATCH_EDWIN) +#define FLAG_REGISTERED_LYDIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_LYDIA) +#define FLAG_REGISTERED_ISAAC (TRAINER_REGISTERED_FLAGS_START + REMATCH_ISAAC) +#define FLAG_REGISTERED_GABRIELLE (TRAINER_REGISTERED_FLAGS_START + REMATCH_GABRIELLE) +#define FLAG_REGISTERED_CATHERINE (TRAINER_REGISTERED_FLAGS_START + REMATCH_CATHERINE) +#define FLAG_REGISTERED_JACKSON (TRAINER_REGISTERED_FLAGS_START + REMATCH_JACKSON) +#define FLAG_REGISTERED_HALEY (TRAINER_REGISTERED_FLAGS_START + REMATCH_HALEY) +#define FLAG_REGISTERED_JAMES (TRAINER_REGISTERED_FLAGS_START + REMATCH_JAMES) +#define FLAG_REGISTERED_TRENT (TRAINER_REGISTERED_FLAGS_START + REMATCH_TRENT) +#define FLAG_REGISTERED_SAWYER (TRAINER_REGISTERED_FLAGS_START + REMATCH_SAWYER) +#define FLAG_REGISTERED_KIRA_AND_DAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_KIRA_AND_DAN) +#define FLAG_REGISTERED_WALLY (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALLY) +#define FLAG_REGISTERED_ROXANNE (TRAINER_REGISTERED_FLAGS_START + REMATCH_ROXANNE) +#define FLAG_REGISTERED_BRAWLY (TRAINER_REGISTERED_FLAGS_START + REMATCH_BRAWLY) +#define FLAG_REGISTERED_WATTSON (TRAINER_REGISTERED_FLAGS_START + REMATCH_WATTSON) +#define FLAG_REGISTERED_FLANNERY (TRAINER_REGISTERED_FLAGS_START + REMATCH_FLANNERY) +#define FLAG_REGISTERED_NORMAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_NORMAN) +#define FLAG_REGISTERED_WINONA (TRAINER_REGISTERED_FLAGS_START + REMATCH_WINONA) +#define FLAG_REGISTERED_TATE_AND_LIZA (TRAINER_REGISTERED_FLAGS_START + REMATCH_TATE_AND_LIZA) +#define FLAG_REGISTERED_JUAN (TRAINER_REGISTERED_FLAGS_START + REMATCH_JUAN) +#define FLAG_REGISTERED_SIDNEY (TRAINER_REGISTERED_FLAGS_START + REMATCH_SIDNEY) +#define FLAG_REGISTERED_PHOEBE (TRAINER_REGISTERED_FLAGS_START + REMATCH_PHOEBE) +#define FLAG_REGISTERED_GLACIA (TRAINER_REGISTERED_FLAGS_START + REMATCH_GLACIA) +#define FLAG_REGISTERED_DRAKE (TRAINER_REGISTERED_FLAGS_START + REMATCH_DRAKE) +#define FLAG_REGISTERED_WALLACE (TRAINER_REGISTERED_FLAGS_START + REMATCH_WALLACE) #define FLAG_UNUSED_0x1AA 0x1AA // Unused Flag #define FLAG_UNUSED_0x1AB 0x1AB // Unused Flag diff --git a/include/constants/rematches.h b/include/constants/rematches.h new file mode 100644 index 0000000000..2ddefcc578 --- /dev/null +++ b/include/constants/rematches.h @@ -0,0 +1,89 @@ +#ifndef GUARD_REMATCHES_H +#define GUARD_REMATCHES_H + +enum { + REMATCH_ROSE, + REMATCH_ANDRES, + REMATCH_DUSTY, + REMATCH_LOLA, + REMATCH_RICKY, + REMATCH_LILA_AND_ROY, + REMATCH_CRISTIN, + REMATCH_BROOKE, + REMATCH_WILTON, + REMATCH_VALERIE, + REMATCH_CINDY, + REMATCH_THALIA, + REMATCH_JESSICA, + REMATCH_WINSTON, + REMATCH_STEVE, + REMATCH_TONY, + REMATCH_NOB, + REMATCH_KOJI, + REMATCH_FERNANDO, + REMATCH_DALTON, + REMATCH_BERNIE, + REMATCH_ETHAN, + REMATCH_JOHN_AND_JAY, + REMATCH_JEFFREY, + REMATCH_CAMERON, + REMATCH_JACKI, + REMATCH_WALTER, + REMATCH_KAREN, + REMATCH_JERRY, + REMATCH_ANNA_AND_MEG, + REMATCH_ISABEL, + REMATCH_MIGUEL, + REMATCH_TIMOTHY, + REMATCH_SHELBY, + REMATCH_CALVIN, + REMATCH_ELLIOT, + REMATCH_ISAIAH, + REMATCH_MARIA, + REMATCH_ABIGAIL, + REMATCH_DYLAN, + REMATCH_KATELYN, + REMATCH_BENJAMIN, + REMATCH_PABLO, + REMATCH_NICOLAS, + REMATCH_ROBERT, + REMATCH_LAO, + REMATCH_CYNDY, + REMATCH_MADELINE, + REMATCH_JENNY, + REMATCH_DIANA, + REMATCH_AMY_AND_LIV, + REMATCH_ERNEST, + REMATCH_CORY, + REMATCH_EDWIN, + REMATCH_LYDIA, + REMATCH_ISAAC, + REMATCH_GABRIELLE, + REMATCH_CATHERINE, + REMATCH_JACKSON, + REMATCH_HALEY, + REMATCH_JAMES, + REMATCH_TRENT, + REMATCH_SAWYER, + REMATCH_KIRA_AND_DAN, + REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers + REMATCH_ROXANNE, + REMATCH_BRAWLY, + REMATCH_WATTSON, + REMATCH_FLANNERY, + REMATCH_NORMAN, + REMATCH_WINONA, + REMATCH_TATE_AND_LIZA, + REMATCH_JUAN, + REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES. + REMATCH_PHOEBE, + REMATCH_GLACIA, + REMATCH_DRAKE, + REMATCH_WALLACE, + REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum +}; + +#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR +#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY + +#endif // GUARD_REMATCHES_H diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index b31fb5e228..622d2db1bc 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -1,90 +1,7 @@ #ifndef GUARD_TRAINER_REMATCH_H #define GUARD_TRAINER_REMATCH_H -enum { - REMATCH_ROSE, - REMATCH_ANDRES, - REMATCH_DUSTY, - REMATCH_LOLA, - REMATCH_RICKY, - REMATCH_LILA_AND_ROY, - REMATCH_CRISTIN, - REMATCH_BROOKE, - REMATCH_WILTON, - REMATCH_VALERIE, - REMATCH_CINDY, - REMATCH_THALIA, - REMATCH_JESSICA, - REMATCH_WINSTON, - REMATCH_STEVE, - REMATCH_TONY, - REMATCH_NOB, - REMATCH_KOJI, - REMATCH_FERNANDO, - REMATCH_DALTON, - REMATCH_BERNIE, - REMATCH_ETHAN, - REMATCH_JOHN_AND_JAY, - REMATCH_JEFFREY, - REMATCH_CAMERON, - REMATCH_JACKI, - REMATCH_WALTER, - REMATCH_KAREN, - REMATCH_JERRY, - REMATCH_ANNA_AND_MEG, - REMATCH_ISABEL, - REMATCH_MIGUEL, - REMATCH_TIMOTHY, - REMATCH_SHELBY, - REMATCH_CALVIN, - REMATCH_ELLIOT, - REMATCH_ISAIAH, - REMATCH_MARIA, - REMATCH_ABIGAIL, - REMATCH_DYLAN, - REMATCH_KATELYN, - REMATCH_BENJAMIN, - REMATCH_PABLO, - REMATCH_NICOLAS, - REMATCH_ROBERT, - REMATCH_LAO, - REMATCH_CYNDY, - REMATCH_MADELINE, - REMATCH_JENNY, - REMATCH_DIANA, - REMATCH_AMY_AND_LIV, - REMATCH_ERNEST, - REMATCH_CORY, - REMATCH_EDWIN, - REMATCH_LYDIA, - REMATCH_ISAAC, - REMATCH_GABRIELLE, - REMATCH_CATHERINE, - REMATCH_JACKSON, - REMATCH_HALEY, - REMATCH_JAMES, - REMATCH_TRENT, - REMATCH_SAWYER, - REMATCH_KIRA_AND_DAN, - REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers - REMATCH_ROXANNE, - REMATCH_BRAWLY, - REMATCH_WATTSON, - REMATCH_FLANNERY, - REMATCH_NORMAN, - REMATCH_WINONA, - REMATCH_TATE_AND_LIZA, - REMATCH_JUAN, - REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES. - REMATCH_PHOEBE, - REMATCH_GLACIA, - REMATCH_DRAKE, - REMATCH_WALLACE, - REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum -}; - -#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR -#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY +#include "constants/rematches.h" void UpdateGymLeaderRematch(void); diff --git a/map_data_rules.mk b/map_data_rules.mk index 626cd47240..d3f47a352e 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -9,9 +9,9 @@ MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS)) MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS)) $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS) - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) - $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(PREPROC) -ie $< charmap.txt | $(AS) $(ASFLAGS) -o $@ $(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json diff --git a/src/battle_setup.c b/src/battle_setup.c index e87ce6dd27..435ba4b8a3 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -1615,7 +1615,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u // Trainer already wants a rematch. Don't bother updating it. ret = TRUE; } - else if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i) + else if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i) && (Random() % 100) <= 30) // 31% chance of getting a rematch. { SetRematchIdForTrainer(table, i); @@ -1744,7 +1744,7 @@ static u32 GetTrainerMatchCallFlag(u32 trainerId) for (i = 0; i < REMATCH_TABLE_ENTRIES; i++) { if (gRematchTable[i].trainerIds[0] == trainerId) - return FLAG_MATCH_CALL_REGISTERED + i; + return TRAINER_REGISTERED_FLAGS_START + i; } return 0xFFFF; diff --git a/src/field_specials.c b/src/field_specials.c index 7d20d3571d..1bbbbf4e17 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3620,7 +3620,7 @@ bool32 IsTrainerRegistered(void) int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); if (index >= 0) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + index) == TRUE) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + index) == TRUE) return TRUE; } return FALSE; diff --git a/src/match_call.c b/src/match_call.c index a9d18b3477..2c1ad924a5 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -131,7 +131,7 @@ static EWRAM_DATA struct MatchCallState sMatchCallState = {0}; static EWRAM_DATA struct BattleFrontierStreakInfo sBattleFrontierStreakInfo = {0}; static u32 GetCurrentTotalMinutes(struct Time *); -static u32 GetNumRegisteredNPCs(void); +static u32 GetNumRegisteredTrainers(void); static u32 GetActiveMatchCallTrainerId(u32); static int GetTrainerMatchCallId(int); static u16 GetRematchTrainerLocation(int); @@ -1098,7 +1098,7 @@ static bool32 UpdateMatchCallStepCounter(void) static bool32 SelectMatchCallTrainer(void) { u32 matchCallId; - u32 numRegistered = GetNumRegisteredNPCs(); + u32 numRegistered = GetNumRegisteredTrainers(); if (numRegistered == 0) return FALSE; @@ -1114,12 +1114,13 @@ static bool32 SelectMatchCallTrainer(void) return TRUE; } -static u32 GetNumRegisteredNPCs(void) +// Ignores registrable non-trainer NPCs, and special trainers like Wally and the gym leaders. +static u32 GetNumRegisteredTrainers(void) { u32 i, count; for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)) count++; } @@ -1131,7 +1132,7 @@ static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId) u32 i; for (i = 0; i < REMATCH_SPECIAL_TRAINER_START; i++) { - if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i)) + if (FlagGet(TRAINER_REGISTERED_FLAGS_START + i)) { if (!activeMatchCallId) return gRematchTable[i].trainerIds[0]; diff --git a/src/pokenav_match_call_data.c b/src/pokenav_match_call_data.c index f6d71009bb..1c3cf9aeeb 100644 --- a/src/pokenav_match_call_data.c +++ b/src/pokenav_match_call_data.c @@ -506,7 +506,7 @@ static const struct MatchCallStructTrainer sSidneyMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_SIDNEY, + .flag = FLAG_REGISTERED_SIDNEY, .rematchTableIdx = REMATCH_SIDNEY, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -522,7 +522,7 @@ static const struct MatchCallStructTrainer sPhoebeMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_PHOEBE, + .flag = FLAG_REGISTERED_PHOEBE, .rematchTableIdx = REMATCH_PHOEBE, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -538,7 +538,7 @@ static const struct MatchCallStructTrainer sGlaciaMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_GLACIA, + .flag = FLAG_REGISTERED_GLACIA, .rematchTableIdx = REMATCH_GLACIA, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -554,7 +554,7 @@ static const struct MatchCallStructTrainer sDrakeMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_DRAKE, + .flag = FLAG_REGISTERED_DRAKE, .rematchTableIdx = REMATCH_DRAKE, .desc = gText_EliteFourMatchCallDesc, .name = NULL, @@ -570,7 +570,7 @@ static const struct MatchCallStructTrainer sWallaceMatchCallHeader = { .type = MC_TYPE_LEADER, .mapSec = MAPSEC_EVER_GRANDE_CITY, - .flag = FLAG_REMATCH_WALLACE, + .flag = FLAG_REGISTERED_WALLACE, .rematchTableIdx = REMATCH_WALLACE, .desc = gText_ChampionMatchCallDesc, .name = NULL, @@ -1136,7 +1136,7 @@ bool32 MatchCall_HasRematchId(u32 idx) void SetMatchCallRegisteredFlag(void) { - int r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); - if (r0 >= 0) - FlagSet(FLAG_MATCH_CALL_REGISTERED + r0); + int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); + if (index >= 0) + FlagSet(TRAINER_REGISTERED_FLAGS_START + index); } diff --git a/src/pokenav_match_call_list.c b/src/pokenav_match_call_list.c index 8d1a73f557..fb89e33e0b 100755 --- a/src/pokenav_match_call_list.c +++ b/src/pokenav_match_call_list.c @@ -261,7 +261,7 @@ static u32 LoopedTask_BuildMatchCallList(s32 taskState) bool32 IsRematchEntryRegistered(int rematchIndex) { if (rematchIndex < REMATCH_TABLE_ENTRIES) - return FlagGet(FLAG_MATCH_CALL_REGISTERED + rematchIndex); + return FlagGet(TRAINER_REGISTERED_FLAGS_START + rematchIndex); return FALSE; }