pokeemerald/src/match_call.c

2111 lines
79 KiB
C
Raw Normal View History

2018-02-27 14:47:47 +01:00
#include "global.h"
#include "malloc.h"
2019-01-03 02:07:47 +01:00
#include "battle.h"
2018-03-01 04:09:28 +01:00
#include "battle_setup.h"
2019-01-03 02:07:47 +01:00
#include "bg.h"
2019-04-04 23:53:06 +02:00
#include "data.h"
2018-03-01 04:09:28 +01:00
#include "event_data.h"
2019-01-03 02:07:47 +01:00
#include "event_object_movement.h"
#include "field_player_avatar.h"
#include "main.h"
2019-04-14 20:21:06 +02:00
#include "match_call.h"
2019-01-03 02:07:47 +01:00
#include "menu.h"
#include "new_game.h"
#include "overworld.h"
#include "palette.h"
#include "pokedex.h"
#include "pokemon.h"
#include "random.h"
#include "region_map.h"
#include "rtc.h"
#include "script.h"
#include "script_movement.h"
#include "sound.h"
2018-03-03 19:22:38 +01:00
#include "string_util.h"
2019-01-03 02:07:47 +01:00
#include "strings.h"
#include "task.h"
#include "wild_encounter.h"
#include "window.h"
#include "constants/abilities.h"
#include "constants/battle_frontier.h"
#include "constants/event_objects.h"
#include "constants/maps.h"
#include "constants/region_map_sections.h"
#include "constants/songs.h"
#include "constants/trainers.h"
// Each match call message has variables that can be populated randomly or
// dependent on the trainer. The below are IDs for how to populate the vars
// in a given message.
// Each message may have up to 3 vars in it
enum {
STR_TRAINER_NAME,
STR_MAP_NAME,
STR_SPECIES_IN_ROUTE,
STR_SPECIES_IN_PARTY,
STR_FACILITY_NAME,
STR_FRONTIER_STREAK,
STR_NONE = -1,
};
#define STRS_NORMAL_MSG {STR_TRAINER_NAME, STR_NONE, STR_NONE}
#define STRS_WILD_BATTLE {STR_TRAINER_NAME, STR_SPECIES_IN_ROUTE, STR_NONE}
#define STRS_BATTLE_NEGATIVE {STR_TRAINER_NAME, STR_NONE, STR_NONE}
#define STRS_BATTLE_POSITIVE {STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE}
#define STRS_BATTLE_REQUEST {STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE}
#define STRS_FRONTIER {STR_TRAINER_NAME, STR_FACILITY_NAME, STR_FRONTIER_STREAK}
#define NUM_STRVARS_IN_MSG 3
// Topic IDs for sMatchCallGeneralTopics
enum {
GEN_TOPIC_PERSONAL = 1,
GEN_TOPIC_STREAK,
GEN_TOPIC_STREAK_RECORD,
GEN_TOPIC_B_DOME,
GEN_TOPIC_B_PIKE,
GEN_TOPIC_B_PYRAMID,
};
// Topic IDs for sMatchCallBattleTopics
enum {
B_TOPIC_WILD = 1,
B_TOPIC_NEGATIVE,
B_TOPIC_POSITIVE,
};
// Each trainer has a text id for 1 of each of the 3 battle topics
// The msgId is the index into the respective topic's message table
// For all but 2 trainers this index is the same for each topic
#define BATTLE_TEXT_IDS(msgId) {TEXT_ID(B_TOPIC_WILD, (msgId)), TEXT_ID(B_TOPIC_NEGATIVE, (msgId)), TEXT_ID(B_TOPIC_POSITIVE, (msgId))}
// Topic IDs for sMatchCallBattleRequestTopics
enum {
REQ_TOPIC_SAME_ROUTE = 1,
REQ_TOPIC_DIFF_ROUTE,
};
2019-01-03 02:07:47 +01:00
struct MatchCallState
{
u32 minutes;
u16 trainerId;
u8 stepCounter;
2021-04-01 08:35:14 +02:00
bool8 triggeredFromScript;
2018-03-02 14:44:33 +01:00
};
2019-01-03 02:07:47 +01:00
struct MatchCallTrainerTextInfo
{
u16 trainerId;
u16 unused;
u16 battleTopicTextIds[3];
2019-01-03 02:33:33 +01:00
u16 generalTextId;
2019-01-03 02:07:47 +01:00
u8 battleFrontierRecordStreakTextIndex;
u16 sameRouteMatchCallTextId;
u16 differentRouteMatchCallTextId;
2018-03-02 14:44:33 +01:00
};
2019-01-03 02:07:47 +01:00
struct MatchCallText
{
const u8 *text;
s8 stringVarFuncIds[NUM_STRVARS_IN_MSG];
2018-03-02 14:44:33 +01:00
};
2019-01-03 02:07:47 +01:00
struct MultiTrainerMatchCallText
{
u16 trainerId;
const u8 *text;
2018-03-02 14:44:33 +01:00
};
2019-01-03 02:07:47 +01:00
struct BattleFrontierStreakInfo
{
u16 facilityId;
u16 streak;
2018-03-02 14:44:33 +01:00
};
static EWRAM_DATA struct MatchCallState sMatchCallState = {0};
static EWRAM_DATA struct BattleFrontierStreakInfo sBattleFrontierStreakInfo = {0};
2019-01-03 02:07:47 +01:00
static u32 GetCurrentTotalMinutes(struct Time *);
static u32 GetNumRegisteredNPCs(void);
static u32 GetActiveMatchCallTrainerId(u32);
static int GetTrainerMatchCallId(int);
static u16 GetRematchTrainerLocation(int);
static bool32 TrainerIsEligibleForRematch(int);
static void StartMatchCall(void);
static void ExecuteMatchCall(u8);
2021-04-01 08:35:14 +02:00
static void DrawMatchCallTextBoxBorder_Internal(u32, u32, u32);
static void Task_SpinPokenavIcon(u8);
2019-01-03 02:07:47 +01:00
static void InitMatchCallTextPrinter(int, const u8 *);
2021-04-01 08:35:14 +02:00
static bool32 RunMatchCallTextPrinter(int);
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *GetSameRouteMatchCallText(int, u8 *);
static const struct MatchCallText *GetDifferentRouteMatchCallText(int, u8 *);
static const struct MatchCallText *GetBattleMatchCallText(int, u8 *);
static const struct MatchCallText *GetGeneralMatchCallText(int, u8 *);
2021-04-01 08:35:14 +02:00
static bool32 ShouldTrainerRequestBattle(int);
2019-01-03 02:07:47 +01:00
static void BuildMatchCallString(int, const struct MatchCallText *, u8 *);
static u16 GetFrontierStreakInfo(u16, u32 *);
static void PopulateMatchCallStringVars(int, const s8 *);
static void PopulateMatchCallStringVar(int, int, u8 *);
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_LoadGfx(u8);
static bool32 MatchCall_DrawWindow(u8);
static bool32 MatchCall_ReadyIntro(u8);
static bool32 MatchCall_SlideWindowIn(u8);
static bool32 MatchCall_PrintIntro(u8);
static bool32 MatchCall_PrintMessage(u8);
static bool32 MatchCall_SlideWindowOut(u8);
static bool32 MatchCall_EndCall(u8);
2019-01-03 02:07:47 +01:00
static void PopulateTrainerName(int, u8 *);
static void PopulateMapName(int, u8 *);
static void PopulateSpeciesFromTrainerLocation(int, u8 *);
static void PopulateSpeciesFromTrainerParty(int, u8 *);
static void PopulateBattleFrontierFacilityName(int, u8 *);
static void PopulateBattleFrontierStreak(int, u8 *);
#define TEXT_ID(topic, id) (((topic) << 8) | ((id) & 0xFF))
static const struct MatchCallTrainerTextInfo sMatchCallTrainers[] =
{
{
.trainerId = TRAINER_ROSE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 3),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ANDRES_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(12),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 62),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 12,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_DUSTY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(12),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 4),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 12,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_LOLA_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(2),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 5),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 2,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_RICKY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 6),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_LILA_AND_ROY_1,
.unused = 4,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 61),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CRISTIN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(10),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 64),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 10,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 10),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 10),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_BROOKE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 8),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_WILTON_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(6),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 7),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 6,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 6),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 6),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_VALERIE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 9),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CINDY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 10),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_THALIA_1,
.unused = 0,
// Thalia and Sawyer are the only ones who use different msg ids for their battle topics
.battleTopicTextIds = { TEXT_ID(B_TOPIC_WILD, 8), TEXT_ID(B_TOPIC_NEGATIVE, 10), TEXT_ID(B_TOPIC_POSITIVE, 10) },
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 14),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 10,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 10),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JESSICA_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(10),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 11),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 10,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 10),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_WINSTON_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(4),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 12),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 4,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_STEVE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(7),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 13),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 7,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 7),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 7),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_TONY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 15),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_NOB_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(3),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 16),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_KOJI_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(3),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 59),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_FERNANDO_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(6),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 17),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 6,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 6),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 6),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_DALTON_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(4),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 18),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 4,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_BERNIE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(11),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 19),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 11,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 11),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 11),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ETHAN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 20),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JOHN_AND_JAY_1,
.unused = 3,
.battleTopicTextIds = BATTLE_TEXT_IDS(12),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 60),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 12,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JEFFREY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(7),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 21),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 7,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 7),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 7),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CAMERON_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(4),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 22),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JACKI_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 23),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_WALTER_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(12),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 24),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 12,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_KAREN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(2),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 26),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 2,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JERRY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 25),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ANNA_AND_MEG_1,
.unused = 6,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 27),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ISABEL_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(14),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 29),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 14,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 14),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 14),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_MIGUEL_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(11),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 28),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 11,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 11),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 11),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_TIMOTHY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(12),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 30),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 12,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 12),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 12),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_SHELBY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(13),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 31),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 13,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 13),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 13),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CALVIN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 32),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ELLIOT_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(3),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 33),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ISAIAH_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 38),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_MARIA_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 37),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ABIGAIL_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 35),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_DYLAN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 36),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_KATELYN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 40),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_BENJAMIN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 34),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_PABLO_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 39),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_NICOLAS_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(4),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 41),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 4,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 4),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 4),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ROBERT_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(6),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 42),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 6,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 6),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 6),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_LAO_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 43),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CYNDY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 44),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_MADELINE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 45),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JENNY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 46),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_DIANA_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(2),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 47),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 2,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_AMY_AND_LIV_1,
.unused = 2,
.battleTopicTextIds = BATTLE_TEXT_IDS(2),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 48),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ERNEST_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(3),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 49),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CORY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(3),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 63),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_EDWIN_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(7),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 50),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 7,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 7),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 7),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_LYDIA_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 52),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_ISAAC_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 51),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_GABRIELLE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(8),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 2),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 8,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 8),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 8),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_CATHERINE_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 54),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JACKSON_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(5),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 53),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 5,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 5),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 5),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_HALEY_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(2),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 55),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 2,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 2),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 2),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_JAMES_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(1),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 56),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 1,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 1),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 1),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_TRENT_1,
.unused = 0,
.battleTopicTextIds = BATTLE_TEXT_IDS(3),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 57),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_SAWYER_1,
.unused = 0,
// Thalia and Sawyer are the only ones who use different msg ids for their battle topics
.battleTopicTextIds = { TEXT_ID(B_TOPIC_WILD, 15), TEXT_ID(B_TOPIC_NEGATIVE, 3), TEXT_ID(B_TOPIC_POSITIVE, 3) },
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 1),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 3,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 3),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 3),
2019-01-03 02:07:47 +01:00
},
{
.trainerId = TRAINER_KIRA_AND_DAN_1,
.unused = 1,
.battleTopicTextIds = BATTLE_TEXT_IDS(9),
.generalTextId = TEXT_ID(GEN_TOPIC_PERSONAL, 58),
2019-01-03 02:07:47 +01:00
.battleFrontierRecordStreakTextIndex = 9,
.sameRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_SAME_ROUTE, 9),
.differentRouteMatchCallTextId = TEXT_ID(REQ_TOPIC_DIFF_ROUTE, 9),
2019-01-03 02:07:47 +01:00
},
2018-03-03 03:43:18 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallWildBattleTexts[] =
{
{ .text = MatchCall_WildBattleText1, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText2, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText3, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText4, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText5, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText6, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText7, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText8, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText9, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText10, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText11, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText12, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText13, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText14, .stringVarFuncIds = STRS_WILD_BATTLE },
{ .text = MatchCall_WildBattleText15, .stringVarFuncIds = STRS_WILD_BATTLE },
2018-03-02 14:44:33 +01:00
};
static const struct MatchCallText sMatchCallNegativeBattleTexts[] =
{
{ .text = MatchCall_NegativeBattleText1, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText2, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText3, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText4, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText5, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText6, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText7, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText8, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText9, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText10, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText11, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText12, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText13, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
{ .text = MatchCall_NegativeBattleText14, .stringVarFuncIds = STRS_BATTLE_NEGATIVE },
2018-03-04 22:14:56 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallPositiveBattleTexts[] =
{
{ .text = MatchCall_PositiveBattleText1, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText2, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText3, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText4, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText5, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText6, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText7, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText8, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText9, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText10, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText11, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText12, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText13, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
{ .text = MatchCall_PositiveBattleText14, .stringVarFuncIds = STRS_BATTLE_POSITIVE },
2018-03-03 00:12:23 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallSameRouteBattleRequestTexts[] =
{
{ .text = MatchCall_SameRouteBattleRequestText1, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText2, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText3, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText4, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText5, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText6, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText7, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText8, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText9, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText10, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText11, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText12, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText13, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_SameRouteBattleRequestText14, .stringVarFuncIds = STRS_BATTLE_REQUEST },
2018-03-04 22:14:56 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallDifferentRouteBattleRequestTexts[] =
{
{ .text = MatchCall_DifferentRouteBattleRequestText1, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText2, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText3, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText4, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText5, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText6, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText7, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText8, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText9, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText10, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText11, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText12, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText13, .stringVarFuncIds = STRS_BATTLE_REQUEST },
{ .text = MatchCall_DifferentRouteBattleRequestText14, .stringVarFuncIds = STRS_BATTLE_REQUEST },
2018-03-04 22:14:56 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallPersonalizedTexts[] =
{
{ .text = MatchCall_PersonalizedText1, .stringVarFuncIds = { STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE } },
{ .text = MatchCall_PersonalizedText2, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText3, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText4, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText5, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText6, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText7, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText8, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText9, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText10, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText11, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText12, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText13, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_ROUTE, STR_NONE } },
{ .text = MatchCall_PersonalizedText14, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText15, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText16, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText17, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText18, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } },
{ .text = MatchCall_PersonalizedText19, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText20, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText21, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText22, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText23, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText24, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText25, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText26, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText27, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText28, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } },
{ .text = MatchCall_PersonalizedText29, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } },
{ .text = MatchCall_PersonalizedText30, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText31, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText32, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText33, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText34, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText35, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText36, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText37, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText38, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText39, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText40, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText41, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText42, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } },
{ .text = MatchCall_PersonalizedText43, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText44, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } },
{ .text = MatchCall_PersonalizedText45, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText46, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText47, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText48, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText49, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText50, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText51, .stringVarFuncIds = { STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE } },
{ .text = MatchCall_PersonalizedText52, .stringVarFuncIds = { STR_TRAINER_NAME, STR_SPECIES_IN_PARTY, STR_NONE } },
{ .text = MatchCall_PersonalizedText53, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText54, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText55, .stringVarFuncIds = { STR_TRAINER_NAME, STR_MAP_NAME, STR_NONE } },
{ .text = MatchCall_PersonalizedText56, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText57, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText58, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText59, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText60, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText61, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText62, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText63, .stringVarFuncIds = STRS_NORMAL_MSG },
{ .text = MatchCall_PersonalizedText64, .stringVarFuncIds = STRS_NORMAL_MSG },
2018-03-04 22:14:56 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallBattleFrontierStreakTexts[] =
{
{ .text = MatchCall_BattleFrontierStreakText1, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText2, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText3, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText4, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText5, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText6, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText7, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText8, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText9, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText10, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText11, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText12, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText13, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierStreakText14, .stringVarFuncIds = STRS_FRONTIER },
2018-03-04 22:44:50 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallBattleFrontierRecordStreakTexts[] =
{
{ .text = MatchCall_BattleFrontierRecordStreakText1, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText2, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText3, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText4, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText5, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText6, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText7, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText8, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText9, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText10, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText11, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText12, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText13, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleFrontierRecordStreakText14, .stringVarFuncIds = STRS_FRONTIER },
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallBattleDomeTexts[] =
{
{ .text = MatchCall_BattleDomeText1, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText2, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText3, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText4, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText5, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText6, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText7, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText8, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText9, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText10, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText11, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText12, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText13, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattleDomeText14, .stringVarFuncIds = STRS_FRONTIER },
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallBattlePikeTexts[] =
{
{ .text = MatchCall_BattlePikeText1, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText2, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText3, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText4, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText5, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText6, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText7, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText8, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText9, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText10, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText11, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText12, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText13, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePikeText14, .stringVarFuncIds = STRS_FRONTIER },
2018-03-04 22:44:50 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText sMatchCallBattlePyramidTexts[] =
{
{ .text = MatchCall_BattlePyramidText1, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText2, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText3, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText4, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText5, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText6, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText7, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText8, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText9, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText10, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText11, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText12, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText13, .stringVarFuncIds = STRS_FRONTIER },
{ .text = MatchCall_BattlePyramidText14, .stringVarFuncIds = STRS_FRONTIER },
2018-03-04 22:44:50 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *const sMatchCallBattleTopics[] =
{
[B_TOPIC_WILD - 1] = sMatchCallWildBattleTexts,
[B_TOPIC_NEGATIVE - 1] = sMatchCallNegativeBattleTexts,
[B_TOPIC_POSITIVE - 1] = sMatchCallPositiveBattleTexts,
2018-03-04 22:44:50 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *const sMatchCallBattleRequestTopics[] =
{
[REQ_TOPIC_SAME_ROUTE - 1] = sMatchCallSameRouteBattleRequestTexts,
[REQ_TOPIC_DIFF_ROUTE - 1] = sMatchCallDifferentRouteBattleRequestTexts,
2018-03-04 22:44:50 +01:00
};
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *const sMatchCallGeneralTopics[] =
{
[GEN_TOPIC_PERSONAL - 1] = sMatchCallPersonalizedTexts,
[GEN_TOPIC_STREAK - 1] = sMatchCallBattleFrontierStreakTexts,
[GEN_TOPIC_STREAK_RECORD - 1] = sMatchCallBattleFrontierRecordStreakTexts,
[GEN_TOPIC_B_DOME - 1] = sMatchCallBattleDomeTexts,
[GEN_TOPIC_B_PIKE - 1] = sMatchCallBattlePikeTexts,
[GEN_TOPIC_B_PYRAMID - 1] = sMatchCallBattlePyramidTexts,
2018-03-04 22:44:50 +01:00
};
2019-08-15 05:38:42 +02:00
extern const u8 gBirchDexRatingText_AreYouCurious[];
extern const u8 gBirchDexRatingText_SoYouveSeenAndCaught[];
extern const u8 gBirchDexRatingText_OnANationwideBasis[];
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
void InitMatchCallCounters(void)
{
RtcCalcLocalTime();
sMatchCallState.minutes = GetCurrentTotalMinutes(&gLocalTime) + 10;
sMatchCallState.stepCounter = 0;
2019-01-03 02:07:47 +01:00
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static u32 GetCurrentTotalMinutes(struct Time *time)
{
2021-04-01 08:35:14 +02:00
return time->days * 24 * 60 + time->hours * 60 + time->minutes;
2019-01-03 02:07:47 +01:00
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static bool32 UpdateMatchCallMinutesCounter(void)
{
int curMinutes;
RtcCalcLocalTime();
curMinutes = GetCurrentTotalMinutes(&gLocalTime);
if (sMatchCallState.minutes > curMinutes || curMinutes - sMatchCallState.minutes > 9)
2019-01-03 02:07:47 +01:00
{
sMatchCallState.minutes = curMinutes;
2019-01-03 02:07:47 +01:00
return TRUE;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
return FALSE;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static bool32 CheckMatchCallChance(void)
{
int callChance = 1;
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_LIGHTNING_ROD)
callChance = 2;
if (Random() % 10 < callChance * 3)
2019-01-03 02:07:47 +01:00
return TRUE;
else
return FALSE;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static bool32 MapAllowsMatchCall(void)
{
if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) || gMapHeader.regionMapSectionId == MAPSEC_SAFARI_ZONE)
return FALSE;
2019-01-03 02:07:47 +01:00
if (gMapHeader.regionMapSectionId == MAPSEC_SOOTOPOLIS_CITY
&& FlagGet(FLAG_HIDE_SOOTOPOLIS_CITY_RAYQUAZA) == TRUE
&& FlagGet(FLAG_NEVER_SET_0x0DC) == FALSE)
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
if (gMapHeader.regionMapSectionId == MAPSEC_MT_CHIMNEY
2019-01-03 03:28:18 +01:00
&& FlagGet(FLAG_MET_ARCHIE_METEOR_FALLS) == TRUE
&& FlagGet(FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY) == FALSE)
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
return TRUE;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static bool32 UpdateMatchCallStepCounter(void)
{
if (++sMatchCallState.stepCounter >= 10)
2019-01-03 02:07:47 +01:00
{
sMatchCallState.stepCounter = 0;
2019-01-03 02:07:47 +01:00
return TRUE;
}
else
{
return FALSE;
}
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static bool32 SelectMatchCallTrainer(void)
{
u32 matchCallId;
u32 numRegistered = GetNumRegisteredNPCs();
2021-04-01 08:35:14 +02:00
if (numRegistered == 0)
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-04 22:44:50 +01:00
sMatchCallState.trainerId = GetActiveMatchCallTrainerId(Random() % numRegistered);
sMatchCallState.triggeredFromScript = FALSE;
if (sMatchCallState.trainerId == REMATCH_TABLE_ENTRIES)
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-04 22:44:50 +01:00
matchCallId = GetTrainerMatchCallId(sMatchCallState.trainerId);
2019-01-03 02:07:47 +01:00
if (GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId && !TrainerIsEligibleForRematch(matchCallId))
return FALSE;
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
return TRUE;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static u32 GetNumRegisteredNPCs(void)
{
u32 i, count;
2019-12-07 10:08:21 +01:00
for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++)
2019-01-03 02:07:47 +01:00
{
if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i))
count++;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
return count;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId)
{
u32 i;
2019-12-07 10:08:21 +01:00
for (i = 0; i < REMATCH_SPECIAL_TRAINER_START; i++)
2019-01-03 02:07:47 +01:00
{
if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i))
{
if (!activeMatchCallId)
return gRematchTable[i].trainerIds[0];
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
activeMatchCallId--;
}
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
return REMATCH_TABLE_ENTRIES;
}
2018-03-04 22:44:50 +01:00
2021-04-01 08:35:14 +02:00
/*
From the function calls below, a call can only be triggered...
- If the player has match call
- Every 10th step
- Every 10 minutes
- 1/3 of the time (or 2/3 of the time, if the lead party Pokémon has Lightning Rod)
- If in a valid outdoor map (not Safari Zone, not underwater, not Mt Chimney with Team Magma, not Sootopolis with legendaries)
- If an eligible trainer to call the player is selected
*/
2019-01-03 02:07:47 +01:00
bool32 TryStartMatchCall(void)
{
2021-04-01 08:35:14 +02:00
if (FlagGet(FLAG_HAS_MATCH_CALL)
&& UpdateMatchCallStepCounter()
&& UpdateMatchCallMinutesCounter()
&& CheckMatchCallChance()
&& MapAllowsMatchCall()
&& SelectMatchCallTrainer())
2019-01-03 02:07:47 +01:00
{
StartMatchCall();
return TRUE;
}
2018-03-04 22:44:50 +01:00
2019-01-03 02:07:47 +01:00
return FALSE;
}
2018-03-04 22:58:51 +01:00
2020-06-04 00:25:16 +02:00
void StartMatchCallFromScript(const u8 *message)
2019-01-03 02:07:47 +01:00
{
sMatchCallState.triggeredFromScript = TRUE;
2019-01-03 02:07:47 +01:00
StartMatchCall();
}
2018-03-04 22:58:51 +01:00
2019-04-14 20:21:06 +02:00
bool32 IsMatchCallTaskActive(void)
2019-01-03 02:07:47 +01:00
{
return FuncIsActiveTask(ExecuteMatchCall);
}
2018-03-04 22:58:51 +01:00
2019-01-03 02:07:47 +01:00
static void StartMatchCall(void)
{
if (!sMatchCallState.triggeredFromScript)
2019-01-03 02:07:47 +01:00
{
ScriptContext2_Enable();
FreezeObjectEvents();
PlayerFreeze();
2021-10-26 19:27:20 +02:00
StopPlayerAvatar();
2019-01-03 02:07:47 +01:00
}
2018-03-04 22:58:51 +01:00
2020-08-21 00:02:00 +02:00
PlaySE(SE_POKENAV_CALL);
2019-01-03 02:07:47 +01:00
CreateTask(ExecuteMatchCall, 1);
}
2018-03-04 22:58:51 +01:00
2021-04-01 08:35:14 +02:00
static const u16 sMatchCallWindow_Pal[] = INCBIN_U16("graphics/pokenav/match_call_window.gbapal");
static const u8 sMatchCallWindow_Gfx[] = INCBIN_U8("graphics/pokenav/match_call_window.4bpp");
static const u16 sPokenavIcon_Pal[] = INCBIN_U16("graphics/pokenav/icon.gbapal");
static const u32 sPokenavIcon_Gfx[] = INCBIN_U32("graphics/pokenav/icon.4bpp.lz");
2018-03-04 22:58:51 +01:00
2019-01-03 02:07:47 +01:00
static const u8 sText_PokenavCallEllipsis[] = _("………………\p");
2018-03-04 22:58:51 +01:00
2021-04-01 08:35:14 +02:00
#define tState data[0]
#define tWindowId data[2]
#define tIconTaskId data[5]
2019-01-03 02:07:47 +01:00
static bool32 (*const sMatchCallTaskFuncs[])(u8) =
{
2021-04-01 08:35:14 +02:00
MatchCall_LoadGfx,
MatchCall_DrawWindow,
MatchCall_ReadyIntro,
MatchCall_SlideWindowIn,
MatchCall_PrintIntro,
MatchCall_PrintMessage,
MatchCall_SlideWindowOut,
MatchCall_EndCall,
2018-03-04 22:58:51 +01:00
};
2018-03-01 04:09:28 +01:00
2019-01-03 02:07:47 +01:00
static void ExecuteMatchCall(u8 taskId)
2018-02-27 14:47:47 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
if (sMatchCallTaskFuncs[tState](taskId))
2018-02-27 14:47:47 +01:00
{
2021-04-01 08:35:14 +02:00
tState++;
data[1] = 0; // Never read
if ((u16)tState > 7)
2019-01-03 02:07:47 +01:00
DestroyTask(taskId);
2018-02-27 14:47:47 +01:00
}
}
2018-03-01 04:09:28 +01:00
2019-01-03 02:07:47 +01:00
static const struct WindowTemplate sMatchCallTextWindow =
2018-03-01 04:09:28 +01:00
{
2019-01-03 02:07:47 +01:00
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 15,
.width = 28,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x200
};
2018-03-01 04:09:28 +01:00
2021-04-01 08:35:14 +02:00
#define TILE_MC_WINDOW 0x270
#define TILE_POKENAV_ICON 0x279
static bool32 MatchCall_LoadGfx(u8 taskId)
2018-03-01 04:09:28 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
tWindowId = AddWindow(&sMatchCallTextWindow);
if (tWindowId == WINDOW_NONE)
2018-03-01 04:09:28 +01:00
{
2019-01-03 02:07:47 +01:00
DestroyTask(taskId);
return FALSE;
2018-03-01 04:09:28 +01:00
}
2021-04-01 08:35:14 +02:00
if (LoadBgTiles(0, sMatchCallWindow_Gfx, sizeof(sMatchCallWindow_Gfx), TILE_MC_WINDOW) == 0xFFFF)
2019-01-03 02:07:47 +01:00
{
2021-04-01 08:35:14 +02:00
RemoveWindow(tWindowId);
2019-01-03 02:07:47 +01:00
DestroyTask(taskId);
return FALSE;
}
2018-03-01 04:09:28 +01:00
2021-04-01 08:35:14 +02:00
if (!DecompressAndCopyTileDataToVram(0, sPokenavIcon_Gfx, 0, TILE_POKENAV_ICON, 0))
2019-01-03 02:07:47 +01:00
{
2021-04-01 08:35:14 +02:00
RemoveWindow(tWindowId);
2019-01-03 02:07:47 +01:00
DestroyTask(taskId);
2018-03-01 04:09:28 +01:00
return FALSE;
2019-01-03 02:07:47 +01:00
}
2021-04-01 08:35:14 +02:00
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8));
LoadPalette(sMatchCallWindow_Pal, 0xE0, sizeof(sMatchCallWindow_Pal));
LoadPalette(sPokenavIcon_Pal, 0xF0, sizeof(sPokenavIcon_Pal));
2019-01-03 02:07:47 +01:00
ChangeBgY(0, -0x2000, 0);
return TRUE;
2018-03-01 04:09:28 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_DrawWindow(u8 taskId)
2018-03-01 04:09:28 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
2020-05-14 10:37:09 +02:00
if (FreeTempTileDataBuffersIfPossible())
2019-01-03 02:07:47 +01:00
return FALSE;
2021-04-01 08:35:14 +02:00
PutWindowTilemap(tWindowId);
DrawMatchCallTextBoxBorder_Internal(tWindowId, TILE_MC_WINDOW, 14);
WriteSequenceToBgTilemapBuffer(0, (0xF << 12) | TILE_POKENAV_ICON, 1, 15, 4, 4, 17, 1);
tIconTaskId = CreateTask(Task_SpinPokenavIcon, 10);
2021-11-03 20:29:18 +01:00
CopyWindowToVram(tWindowId, COPYWIN_GFX);
2019-01-03 02:07:47 +01:00
CopyBgTilemapBufferToVram(0);
return TRUE;
2018-03-01 04:09:28 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_ReadyIntro(u8 taskId)
2018-03-01 04:09:28 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
2019-01-03 02:07:47 +01:00
if (!IsDma3ManagerBusyWithBgCopy())
{
2021-04-01 08:35:14 +02:00
// Note that "..." is not printed yet, just readied
InitMatchCallTextPrinter(tWindowId, sText_PokenavCallEllipsis);
2018-03-01 04:09:28 +01:00
return TRUE;
2019-01-03 02:07:47 +01:00
}
return FALSE;
2018-03-01 04:09:28 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_SlideWindowIn(u8 taskId)
2018-03-01 04:09:28 +01:00
{
2019-01-03 02:07:47 +01:00
if (ChangeBgY(0, 0x600, 1) >= 0)
{
ChangeBgY(0, 0, 0);
2018-03-01 04:09:28 +01:00
return TRUE;
2019-01-03 02:07:47 +01:00
}
return FALSE;
2018-03-01 04:09:28 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_PrintIntro(u8 taskId)
2018-03-01 04:09:28 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
if (!RunMatchCallTextPrinter(tWindowId))
2019-01-03 02:07:47 +01:00
{
2021-04-01 08:35:14 +02:00
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8));
2021-04-01 08:35:14 +02:00
// Ready the message
if (!sMatchCallState.triggeredFromScript)
SelectMatchCallMessage(sMatchCallState.trainerId, gStringVar4);
2021-04-01 08:35:14 +02:00
InitMatchCallTextPrinter(tWindowId, gStringVar4);
2018-03-01 04:09:28 +01:00
return TRUE;
2019-01-03 02:07:47 +01:00
}
2018-03-01 04:09:28 +01:00
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-01 04:09:28 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_PrintMessage(u8 taskId)
2018-03-01 04:09:28 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
if (!RunMatchCallTextPrinter(tWindowId) && !IsSEPlaying() && JOY_NEW(A_BUTTON | B_BUTTON))
2019-01-03 02:07:47 +01:00
{
2021-04-01 08:35:14 +02:00
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8));
2021-11-03 20:29:18 +01:00
CopyWindowToVram(tWindowId, COPYWIN_GFX);
2020-08-21 00:02:00 +02:00
PlaySE(SE_POKENAV_HANG_UP);
2019-01-03 02:07:47 +01:00
return TRUE;
}
2018-03-01 04:09:28 +01:00
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-01 04:09:28 +01:00
}
2018-03-02 14:44:33 +01:00
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_SlideWindowOut(u8 taskId)
2018-03-02 14:44:33 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
2019-01-03 02:07:47 +01:00
if (ChangeBgY(0, 0x600, 2) <= -0x2000)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 14, 30, 6);
2021-04-01 08:35:14 +02:00
DestroyTask(tIconTaskId);
RemoveWindow(tWindowId);
2019-01-03 02:07:47 +01:00
CopyBgTilemapBufferToVram(0);
return TRUE;
}
2018-03-02 14:44:33 +01:00
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-02 14:44:33 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 MatchCall_EndCall(u8 taskId)
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
u8 playerObjectId;
if (!IsDma3ManagerBusyWithBgCopy() && !IsSEPlaying())
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
ChangeBgY(0, 0, 0);
if (!sMatchCallState.triggeredFromScript)
2019-01-03 02:07:47 +01:00
{
2020-02-07 18:48:47 +01:00
LoadMessageBoxAndBorderGfx();
playerObjectId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]);
ScriptMovement_UnfreezeObjectEvents();
UnfreezeObjectEvents();
2019-01-03 02:07:47 +01:00
ScriptContext2_Disable();
}
return TRUE;
2018-03-02 14:44:33 +01:00
}
2019-01-03 02:07:47 +01:00
return FALSE;
2018-03-02 14:44:33 +01:00
}
2021-04-01 08:35:14 +02:00
static void DrawMatchCallTextBoxBorder_Internal(u32 windowId, u32 tileOffset, u32 paletteId)
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
int bg, x, y, width, height;
int tileNum;
bg = GetWindowAttribute(windowId, WINDOW_BG);
x = GetWindowAttribute(windowId, WINDOW_TILEMAP_LEFT);
y = GetWindowAttribute(windowId, WINDOW_TILEMAP_TOP);
width = GetWindowAttribute(windowId, WINDOW_WIDTH);
height = GetWindowAttribute(windowId, WINDOW_HEIGHT);
tileNum = tileOffset + GetBgAttribute(bg, BG_ATTR_BASETILE);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 0), x - 1, y - 1, 1, 1);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 1), x, y - 1, width, 1);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 2), x + width, y - 1, 1, 1);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 3), x - 1, y, 1, height);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 4), x + width, y, 1, height);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 5), x - 1, y + height, 1, 1);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 6), x, y + height, width, 1);
FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 7), x + width, y + height, 1, 1);
2018-03-02 14:44:33 +01:00
}
2019-01-03 02:07:47 +01:00
static void InitMatchCallTextPrinter(int windowId, const u8 *str)
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
struct TextPrinterTemplate printerTemplate;
printerTemplate.currentChar = str;
printerTemplate.windowId = windowId;
2021-10-30 22:47:37 +02:00
printerTemplate.fontId = FONT_NORMAL;
2019-01-03 02:07:47 +01:00
printerTemplate.x = 32;
printerTemplate.y = 1;
printerTemplate.currentX = 32;
printerTemplate.currentY = 1;
printerTemplate.letterSpacing = 0;
printerTemplate.lineSpacing = 0;
printerTemplate.unk = 0;
2021-04-01 08:35:14 +02:00
printerTemplate.fgColor = TEXT_DYNAMIC_COLOR_1;
printerTemplate.bgColor = TEXT_COLOR_BLUE;
printerTemplate.shadowColor = TEXT_DYNAMIC_COLOR_5;
gTextFlags.useAlternateDownArrow = FALSE;
2019-01-03 02:07:47 +01:00
AddTextPrinter(&printerTemplate, GetPlayerTextSpeedDelay(), NULL);
2018-03-02 14:44:33 +01:00
}
2021-04-01 08:35:14 +02:00
static bool32 RunMatchCallTextPrinter(int windowId)
2018-03-02 14:44:33 +01:00
{
if (JOY_HELD(A_BUTTON))
2021-04-01 08:35:14 +02:00
gTextFlags.canABSpeedUpPrint = TRUE;
2019-01-03 02:07:47 +01:00
else
2021-04-01 08:35:14 +02:00
gTextFlags.canABSpeedUpPrint = FALSE;
2018-03-02 14:44:33 +01:00
2019-01-03 02:07:47 +01:00
RunTextPrinters();
return IsTextPrinterActive(windowId);
2018-03-02 14:44:33 +01:00
}
2021-04-01 08:35:14 +02:00
#define tTimer data[0]
#define tSpinStage data[1]
#define tTileNum data[2]
static void Task_SpinPokenavIcon(u8 taskId)
2018-03-02 14:44:33 +01:00
{
2021-04-01 08:35:14 +02:00
s16 *data = gTasks[taskId].data;
if (++tTimer > 8)
2019-01-03 02:07:47 +01:00
{
2021-04-01 08:35:14 +02:00
tTimer = 0;
if (++tSpinStage > 7)
tSpinStage = 0;
2018-03-02 14:44:33 +01:00
2021-04-01 08:35:14 +02:00
tTileNum = (tSpinStage * 16) + TILE_POKENAV_ICON;
WriteSequenceToBgTilemapBuffer(0, tTileNum | ~0xFFF, 1, 15, 4, 4, 17, 1);
2019-01-03 02:07:47 +01:00
CopyBgTilemapBufferToVram(0);
}
2018-03-02 14:44:33 +01:00
}
2021-04-01 08:35:14 +02:00
#undef tTimer
#undef tSpinStage
#undef tTileNum
2019-01-03 02:07:47 +01:00
static bool32 TrainerIsEligibleForRematch(int matchCallId)
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0;
2018-03-02 14:44:33 +01:00
}
2019-01-03 02:07:47 +01:00
static u16 GetRematchTrainerLocation(int matchCallId)
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
const struct MapHeader *mapHeader = Overworld_GetMapHeaderByGroupAndId(gRematchTable[matchCallId].mapGroup, gRematchTable[matchCallId].mapNum);
return mapHeader->regionMapSectionId;
2018-03-02 14:44:33 +01:00
}
2019-01-03 02:07:47 +01:00
static u32 GetNumRematchTrainersFought(void)
2018-03-02 14:44:33 +01:00
{
2019-01-03 02:07:47 +01:00
u32 i, count;
2019-12-07 10:08:21 +01:00
for (i = 0, count = 0; i < REMATCH_SPECIAL_TRAINER_START; i++)
2019-01-03 02:07:47 +01:00
{
if (HasTrainerBeenFought(gRematchTable[i].trainerIds[0]))
count++;
}
return count;
2018-03-02 14:44:33 +01:00
}
2021-04-01 08:35:14 +02:00
// Look through the rematch table for trainers that have been defeated once before.
// Return the index into the rematch table of the nth defeated trainer,
// or REMATCH_TABLE_ENTRIES if fewer than n rematch trainers have been defeated.
static u32 GetNthRematchTrainerFought(int n)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
u32 i, count;
2018-03-03 00:12:23 +01:00
2019-01-03 02:07:47 +01:00
for (i = 0, count = 0; i < REMATCH_TABLE_ENTRIES; i++)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
if (HasTrainerBeenFought(gRematchTable[i].trainerIds[0]))
{
2021-04-01 08:35:14 +02:00
if (count == n)
2019-01-03 02:07:47 +01:00
return i;
count++;
}
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
return REMATCH_TABLE_ENTRIES;
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
bool32 SelectMatchCallMessage(int trainerId, u8 *str)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
u32 matchCallId;
const struct MatchCallText *matchCallText;
bool32 retVal = FALSE;
matchCallId = GetTrainerMatchCallId(trainerId);
sBattleFrontierStreakInfo.facilityId = 0;
2021-04-01 08:35:14 +02:00
// If the player is on the same route as the trainer
// and they can be rematched, they will always request a battle
2019-01-03 02:07:47 +01:00
if (TrainerIsEligibleForRematch(matchCallId)
&& GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId)
{
matchCallText = GetSameRouteMatchCallText(matchCallId, str);
}
2021-04-01 08:35:14 +02:00
// If the player is not on the same route as the trainer
// and they can be rematched, there is a random chance for
// the trainer to request a battle
else if (ShouldTrainerRequestBattle(matchCallId))
2019-01-03 02:07:47 +01:00
{
matchCallText = GetDifferentRouteMatchCallText(matchCallId, str);
retVal = TRUE;
UpdateRematchIfDefeated(matchCallId);
}
else if (Random() % 3)
{
2021-04-01 08:35:14 +02:00
// Message talking about a battle the NPC had
2019-01-03 02:07:47 +01:00
matchCallText = GetBattleMatchCallText(matchCallId, str);
}
else
{
2021-04-01 08:35:14 +02:00
// Message talking about something else
2019-01-03 02:07:47 +01:00
matchCallText = GetGeneralMatchCallText(matchCallId, str);
}
BuildMatchCallString(matchCallId, matchCallText, str);
return retVal;
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static int GetTrainerMatchCallId(int trainerId)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
int i = 0;
while (1)
{
if (sMatchCallTrainers[i].trainerId == trainerId)
return i;
else
i++;
}
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *GetSameRouteMatchCallText(int matchCallId, u8 *str)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
u16 textId = sMatchCallTrainers[matchCallId].sameRouteMatchCallTextId;
int mask = 0xFF;
u32 topic = (textId >> 8) - 1;
u32 id = (textId & mask) - 1;
return &sMatchCallBattleRequestTopics[topic][id];
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *GetDifferentRouteMatchCallText(int matchCallId, u8 *str)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
u16 textId = sMatchCallTrainers[matchCallId].differentRouteMatchCallTextId;
int mask = 0xFF;
u32 topic = (textId >> 8) - 1;
u32 id = (textId & mask) - 1;
return &sMatchCallBattleRequestTopics[topic][id];
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *GetBattleMatchCallText(int matchCallId, u8 *str)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
int mask;
u32 textId, topic, id;
2019-01-03 02:07:47 +01:00
topic = Random() % 3;
textId = sMatchCallTrainers[matchCallId].battleTopicTextIds[topic];
if (!textId)
SpriteCallbackDummy(NULL); // leftover debugging ???
mask = 0xFF;
topic = (textId >> 8) - 1;
id = (textId & mask) - 1;
return &sMatchCallBattleTopics[topic][id];
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 *str)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
int i;
int count;
u32 topic, id;
u16 rand;
rand = Random();
if (!(rand & 1))
{
for (count = 0, i = 0; i < NUM_FRONTIER_FACILITIES; i++)
{
if (GetFrontierStreakInfo(i, &topic) > 1)
count++;
}
2018-03-03 00:12:23 +01:00
2019-01-03 02:07:47 +01:00
if (count)
{
count = Random() % count;
for (i = 0; i < NUM_FRONTIER_FACILITIES; i++)
{
sBattleFrontierStreakInfo.streak = GetFrontierStreakInfo(i, &topic);
if (sBattleFrontierStreakInfo.streak < 2)
2019-01-03 02:07:47 +01:00
continue;
if (!count)
break;
count--;
}
sBattleFrontierStreakInfo.facilityId = i;
2019-01-03 02:07:47 +01:00
id = sMatchCallTrainers[matchCallId].battleFrontierRecordStreakTextIndex - 1;
return &sMatchCallGeneralTopics[topic][id];
}
}
2019-01-03 02:33:33 +01:00
topic = (sMatchCallTrainers[matchCallId].generalTextId >> 8) - 1;
id = (sMatchCallTrainers[matchCallId].generalTextId & 0xFF) - 1;
2019-01-03 02:07:47 +01:00
return &sMatchCallGeneralTopics[topic][id];
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static void BuildMatchCallString(int matchCallId, const struct MatchCallText *matchCallText, u8 *str)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
PopulateMatchCallStringVars(matchCallId, matchCallText->stringVarFuncIds);
StringExpandPlaceholders(str, matchCallText->text);
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static u8 *const sMatchCallTextStringVars[] = { gStringVar1, gStringVar2, gStringVar3 };
static void PopulateMatchCallStringVars(int matchCallId, const s8 *stringVarFuncIds)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
int i;
for (i = 0; i < NUM_STRVARS_IN_MSG; i++)
2019-01-03 02:07:47 +01:00
{
if (stringVarFuncIds[i] >= 0)
PopulateMatchCallStringVar(matchCallId, stringVarFuncIds[i], sMatchCallTextStringVars[i]);
}
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static void (*const sPopulateMatchCallStringVarFuncs[])(int, u8 *) =
2018-03-03 00:12:23 +01:00
{
[STR_TRAINER_NAME] = PopulateTrainerName,
[STR_MAP_NAME] = PopulateMapName,
[STR_SPECIES_IN_ROUTE] = PopulateSpeciesFromTrainerLocation,
[STR_SPECIES_IN_PARTY] = PopulateSpeciesFromTrainerParty,
[STR_FACILITY_NAME] = PopulateBattleFrontierFacilityName,
[STR_FRONTIER_STREAK] = PopulateBattleFrontierStreak,
2019-01-03 02:07:47 +01:00
};
2018-03-03 00:12:23 +01:00
2019-01-03 02:07:47 +01:00
static void PopulateMatchCallStringVar(int matchCallId, int funcId, u8 *destStr)
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
sPopulateMatchCallStringVarFuncs[funcId](matchCallId, destStr);
2018-03-03 00:12:23 +01:00
}
2019-01-03 02:07:47 +01:00
static const struct MultiTrainerMatchCallText sMultiTrainerMatchCallTexts[] =
2018-03-03 00:12:23 +01:00
{
2019-01-03 02:07:47 +01:00
{ .trainerId = TRAINER_KIRA_AND_DAN_1, .text = gText_Kira },
{ .trainerId = TRAINER_AMY_AND_LIV_1, .text = gText_Amy },
{ .trainerId = TRAINER_JOHN_AND_JAY_1, .text = gText_John },
{ .trainerId = TRAINER_LILA_AND_ROY_1, .text = gText_Roy },
{ .trainerId = TRAINER_GABBY_AND_TY_1, .text = gText_Gabby },
{ .trainerId = TRAINER_ANNA_AND_MEG_1, .text = gText_Anna },
};
2018-03-03 03:43:18 +01:00
2019-01-03 02:07:47 +01:00
static void PopulateTrainerName(int matchCallId, u8 *destStr)
2018-03-03 03:43:18 +01:00
{
u32 i;
2019-01-03 02:07:47 +01:00
u16 trainerId = sMatchCallTrainers[matchCallId].trainerId;
2021-04-01 08:35:14 +02:00
for (i = 0; i < ARRAY_COUNT(sMultiTrainerMatchCallTexts); i++)
2019-01-03 02:07:47 +01:00
{
if (sMultiTrainerMatchCallTexts[i].trainerId == trainerId)
{
StringCopy(destStr, sMultiTrainerMatchCallTexts[i].text);
return;
}
}
2018-03-03 03:43:18 +01:00
2019-01-03 02:07:47 +01:00
StringCopy(destStr, gTrainers[trainerId].trainerName);
2018-03-03 03:43:18 +01:00
}
2019-01-03 02:07:47 +01:00
static void PopulateMapName(int matchCallId, u8 *destStr)
2018-03-03 03:43:18 +01:00
{
2019-01-03 02:07:47 +01:00
GetMapName(destStr, GetRematchTrainerLocation(matchCallId), 0);
2018-03-03 03:43:18 +01:00
}
2019-01-03 02:07:47 +01:00
static u8 GetLandEncounterSlot(void)
2018-03-03 03:43:18 +01:00
{
2019-01-03 02:07:47 +01:00
int rand = Random() % 100;
if (rand < 20)
return 0;
else if (rand >= 20 && rand < 40)
return 1;
else if (rand >= 40 && rand < 50)
return 2;
else if (rand >= 50 && rand < 60)
return 3;
else if (rand >= 60 && rand < 70)
return 4;
else if (rand >= 70 && rand < 80)
return 5;
else if (rand >= 80 && rand < 85)
return 6;
else if (rand >= 85 && rand < 90)
return 7;
else if (rand >= 90 && rand < 94)
return 8;
else if (rand >= 94 && rand < 98)
return 9;
else if (rand >= 98 && rand < 99)
return 10;
2018-03-03 03:43:18 +01:00
else
2019-01-03 02:07:47 +01:00
return 11;
2018-03-03 03:43:18 +01:00
}
2019-01-03 02:07:47 +01:00
static u8 GetWaterEncounterSlot(void)
2018-03-03 03:43:18 +01:00
{
2019-01-03 02:07:47 +01:00
int rand = Random() % 100;
if (rand < 60)
return 0;
else if (rand >= 60 && rand < 90)
return 1;
else if (rand >= 90 && rand < 95)
return 2;
else if (rand >= 95 && rand < 99)
return 3;
else
return 4;
2018-03-03 03:43:18 +01:00
}
2019-01-03 02:07:47 +01:00
static void PopulateSpeciesFromTrainerLocation(int matchCallId, u8 *destStr)
2018-03-03 03:43:18 +01:00
{
2019-01-03 02:07:47 +01:00
u16 species[2];
int numSpecies;
u8 slot;
int i = 0;
2018-03-03 19:22:38 +01:00
2019-01-03 02:07:47 +01:00
if (gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED)) // ??? This check is nonsense.
2018-03-03 19:22:38 +01:00
{
2019-01-03 02:07:47 +01:00
while (gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED))
{
if (gWildMonHeaders[i].mapGroup == gRematchTable[matchCallId].mapGroup
&& gWildMonHeaders[i].mapNum == gRematchTable[matchCallId].mapNum)
break;
2018-03-03 19:22:38 +01:00
i++;
2019-01-03 02:07:47 +01:00
}
if (gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED))
{
numSpecies = 0;
if (gWildMonHeaders[i].landMonsInfo)
{
slot = GetLandEncounterSlot();
species[numSpecies] = gWildMonHeaders[i].landMonsInfo->wildPokemon[slot].species;
numSpecies++;
}
if (gWildMonHeaders[i].waterMonsInfo)
{
slot = GetWaterEncounterSlot();
species[numSpecies] = gWildMonHeaders[i].waterMonsInfo->wildPokemon[slot].species;
numSpecies++;
}
if (numSpecies)
{
StringCopy(destStr, gSpeciesNames[species[Random() % numSpecies]]);
return;
}
}
2018-03-03 19:22:38 +01:00
}
2019-01-03 02:07:47 +01:00
destStr[0] = EOS;
2018-03-03 19:22:38 +01:00
}
2018-03-03 19:41:28 +01:00
2019-01-03 02:07:47 +01:00
static void PopulateSpeciesFromTrainerParty(int matchCallId, u8 *destStr)
2018-03-03 19:41:28 +01:00
{
2019-01-03 02:07:47 +01:00
u16 trainerId;
union TrainerMonPtr party;
u8 monId;
const u8 *speciesName;
2018-03-03 19:41:28 +01:00
2019-01-03 02:07:47 +01:00
trainerId = GetLastBeatenRematchTrainerId(sMatchCallTrainers[matchCallId].trainerId);
party = gTrainers[trainerId].party;
monId = Random() % gTrainers[trainerId].partySize;
switch (gTrainers[trainerId].partyFlags)
{
case 0:
default:
speciesName = gSpeciesNames[party.NoItemDefaultMoves[monId].species];
break;
case F_TRAINER_PARTY_CUSTOM_MOVESET:
speciesName = gSpeciesNames[party.NoItemCustomMoves[monId].species];
break;
case F_TRAINER_PARTY_HELD_ITEM:
speciesName = gSpeciesNames[party.ItemDefaultMoves[monId].species];
break;
case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM:
speciesName = gSpeciesNames[party.ItemCustomMoves[monId].species];
break;
}
StringCopy(destStr, speciesName);
2018-03-03 19:41:28 +01:00
}
2019-01-03 02:07:47 +01:00
static const u8 *const sBattleFrontierFacilityNames[] =
2018-03-03 19:41:28 +01:00
{
2019-01-03 02:07:47 +01:00
gText_BattleTower2,
gText_BattleDome,
gText_BattlePalace,
gText_BattleArena,
gText_BattlePike,
gText_BattleFactory,
gText_BattlePyramid,
};
2018-03-03 19:41:28 +01:00
2019-01-03 02:07:47 +01:00
static void PopulateBattleFrontierFacilityName(int matchCallId, u8 *destStr)
2018-03-03 19:41:28 +01:00
{
StringCopy(destStr, sBattleFrontierFacilityNames[sBattleFrontierStreakInfo.facilityId]);
2018-03-03 19:41:28 +01:00
}
2019-01-03 02:07:47 +01:00
static void PopulateBattleFrontierStreak(int matchCallId, u8 *destStr)
2018-03-03 19:41:28 +01:00
{
2019-01-03 02:07:47 +01:00
int i = 0;
int streak = sBattleFrontierStreakInfo.streak;
2019-01-03 02:07:47 +01:00
while (streak != 0)
{
streak /= 10;
i++;
}
ConvertIntToDecimalStringN(destStr, sBattleFrontierStreakInfo.streak, STR_CONV_MODE_LEFT_ALIGN, i);
2018-03-03 19:41:28 +01:00
}
2020-02-07 18:48:47 +01:00
static const u16 sBadgeFlags[NUM_BADGES] =
2018-03-03 19:41:28 +01:00
{
2019-01-03 02:07:47 +01:00
FLAG_BADGE01_GET,
FLAG_BADGE02_GET,
FLAG_BADGE03_GET,
FLAG_BADGE04_GET,
FLAG_BADGE05_GET,
FLAG_BADGE06_GET,
FLAG_BADGE07_GET,
FLAG_BADGE08_GET,
};
2018-03-03 19:41:28 +01:00
2019-01-03 02:07:47 +01:00
static int GetNumOwnedBadges(void)
2018-03-03 19:41:28 +01:00
{
2019-01-03 02:07:47 +01:00
u32 i;
2020-02-07 18:48:47 +01:00
for (i = 0; i < NUM_BADGES; i++)
2019-01-03 02:07:47 +01:00
{
if (!FlagGet(sBadgeFlags[i]))
break;
}
return i;
2018-03-03 19:41:28 +01:00
}
2018-03-04 21:36:01 +01:00
2021-04-01 08:35:14 +02:00
// Whether or not a trainer calling the player from a different route should request a battle
static bool32 ShouldTrainerRequestBattle(int matchCallId)
2018-03-04 21:36:01 +01:00
{
2019-01-03 02:07:47 +01:00
int dayCount;
int otId;
2021-04-01 08:35:14 +02:00
u16 dewfordRand;
2019-01-03 02:07:47 +01:00
int numRematchTrainersFought;
2021-04-01 08:35:14 +02:00
int max, rand, n;
2019-01-03 02:07:47 +01:00
if (GetNumOwnedBadges() < 5)
return FALSE;
dayCount = RtcGetLocalDayCount();
otId = GetTrainerId(gSaveBlock2Ptr->playerTrainerId) & 0xFFFF;
2021-04-01 08:35:14 +02:00
dewfordRand = gSaveBlock1Ptr->dewfordTrends[0].rand;
2019-01-03 02:07:47 +01:00
numRematchTrainersFought = GetNumRematchTrainersFought();
2021-04-01 08:35:14 +02:00
max = (numRematchTrainersFought * 13) / 10;
rand = ((dayCount ^ dewfordRand) + (dewfordRand ^ GetGameStat(GAME_STAT_TRAINER_BATTLES))) ^ otId;
n = rand % max;
if (n < numRematchTrainersFought)
2019-01-03 02:07:47 +01:00
{
2021-04-01 08:35:14 +02:00
if (GetNthRematchTrainerFought(n) == matchCallId)
2019-01-03 02:07:47 +01:00
return TRUE;
}
return FALSE;
2018-03-04 21:36:01 +01:00
}
2019-01-03 02:07:47 +01:00
static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
2018-03-04 21:36:01 +01:00
{
2019-01-03 02:07:47 +01:00
int i;
int j;
u16 streak = 0;
2018-03-04 21:36:01 +01:00
2019-01-03 02:07:47 +01:00
switch (facilityId)
2018-03-04 21:36:01 +01:00
{
2019-01-03 02:07:47 +01:00
case FRONTIER_FACILITY_DOME:
for (i = 0; i < 2; i++)
2018-03-04 21:36:01 +01:00
{
2021-10-23 16:55:46 +02:00
for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
2018-03-04 21:36:01 +01:00
{
2019-01-03 02:07:47 +01:00
if (streak < gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j];
2018-03-04 21:36:01 +01:00
}
}
*topicTextId = GEN_TOPIC_B_DOME - 1;
2019-01-03 02:07:47 +01:00
break;
2020-12-13 05:28:01 +01:00
#ifdef BUGFIX
case FRONTIER_FACILITY_PIKE:
#else
2019-01-03 02:07:47 +01:00
case FRONTIER_FACILITY_FACTORY:
2020-12-13 05:28:01 +01:00
#endif
2021-10-23 16:55:46 +02:00
for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++)
2019-01-03 02:07:47 +01:00
{
if (streak < gSaveBlock2Ptr->frontier.pikeRecordStreaks[i])
streak = gSaveBlock2Ptr->frontier.pikeRecordStreaks[i];
}
*topicTextId = GEN_TOPIC_B_PIKE - 1;
2019-01-03 02:07:47 +01:00
break;
case FRONTIER_FACILITY_TOWER:
for (i = 0; i < 4; i++)
{
2021-10-23 16:55:46 +02:00
for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
2019-01-03 02:07:47 +01:00
{
if (streak < gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j];
2018-03-04 21:36:01 +01:00
}
}
*topicTextId = GEN_TOPIC_STREAK_RECORD - 1;
2019-01-03 02:07:47 +01:00
break;
case FRONTIER_FACILITY_PALACE:
for (i = 0; i < 2; i++)
{
2021-10-23 16:55:46 +02:00
for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
2019-01-03 02:07:47 +01:00
{
if (streak < gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j];
}
}
*topicTextId = GEN_TOPIC_STREAK_RECORD - 1;
2019-01-03 02:07:47 +01:00
break;
2020-12-13 05:28:01 +01:00
#ifdef BUGFIX
case FRONTIER_FACILITY_FACTORY:
#else
2019-01-03 02:07:47 +01:00
case FRONTIER_FACILITY_PIKE:
2020-12-13 05:28:01 +01:00
#endif
2019-01-03 02:07:47 +01:00
for (i = 0; i < 2; i++)
{
2021-10-23 16:55:46 +02:00
for (j = 0; j < FRONTIER_LVL_MODE_COUNT; j++)
2019-01-03 02:07:47 +01:00
{
if (streak < gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j])
streak = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j];
}
}
*topicTextId = GEN_TOPIC_STREAK_RECORD - 1;
2019-01-03 02:07:47 +01:00
break;
case FRONTIER_FACILITY_ARENA:
2021-10-23 16:55:46 +02:00
for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++)
2019-01-03 02:07:47 +01:00
{
if (streak < gSaveBlock2Ptr->frontier.arenaRecordStreaks[i])
streak = gSaveBlock2Ptr->frontier.arenaRecordStreaks[i];
}
*topicTextId = GEN_TOPIC_STREAK_RECORD - 1;
2019-01-03 02:07:47 +01:00
break;
case FRONTIER_FACILITY_PYRAMID:
2021-10-23 16:55:46 +02:00
for (i = 0; i < FRONTIER_LVL_MODE_COUNT; i++)
2019-01-03 02:07:47 +01:00
{
if (streak < gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i])
streak = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i];
}
*topicTextId = GEN_TOPIC_B_PYRAMID - 1;
2019-01-03 02:07:47 +01:00
break;
2018-03-04 21:36:01 +01:00
}
2019-01-03 02:07:47 +01:00
return streak;
2018-03-04 21:36:01 +01:00
}
2019-01-03 02:07:47 +01:00
static u8 GetPokedexRatingLevel(u16 numSeen)
{
if (numSeen < 10)
return 0;
if (numSeen < 20)
return 1;
if (numSeen < 30)
return 2;
if (numSeen < 40)
return 3;
if (numSeen < 50)
return 4;
if (numSeen < 60)
return 5;
if (numSeen < 70)
return 6;
if (numSeen < 80)
return 7;
if (numSeen < 90)
return 8;
if (numSeen < 100)
return 9;
if (numSeen < 110)
return 10;
if (numSeen < 120)
return 11;
if (numSeen < 130)
return 12;
if (numSeen < 140)
return 13;
if (numSeen < 150)
return 14;
if (numSeen < 160)
return 15;
if (numSeen < 170)
return 16;
if (numSeen < 180)
return 17;
if (numSeen < 190)
return 18;
if (numSeen < 200)
return 19;
2019-01-03 02:07:47 +01:00
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT))
numSeen--;
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT))
numSeen--;
if (numSeen < 200)
return 19;
else
return 20;
2018-03-04 21:36:01 +01:00
}
2018-03-04 21:47:54 +01:00
2019-01-03 02:07:47 +01:00
static const u8 *const sBirchDexRatingTexts[] =
2018-03-04 21:47:54 +01:00
{
2019-01-03 02:07:47 +01:00
gBirchDexRatingText_LessThan10,
gBirchDexRatingText_LessThan20,
gBirchDexRatingText_LessThan30,
gBirchDexRatingText_LessThan40,
gBirchDexRatingText_LessThan50,
gBirchDexRatingText_LessThan60,
gBirchDexRatingText_LessThan70,
gBirchDexRatingText_LessThan80,
gBirchDexRatingText_LessThan90,
gBirchDexRatingText_LessThan100,
gBirchDexRatingText_LessThan110,
gBirchDexRatingText_LessThan120,
gBirchDexRatingText_LessThan130,
gBirchDexRatingText_LessThan140,
gBirchDexRatingText_LessThan150,
gBirchDexRatingText_LessThan160,
gBirchDexRatingText_LessThan170,
gBirchDexRatingText_LessThan180,
gBirchDexRatingText_LessThan190,
gBirchDexRatingText_LessThan200,
gBirchDexRatingText_DexCompleted,
};
2018-03-04 21:47:54 +01:00
2019-12-07 10:08:21 +01:00
void BufferPokedexRatingForMatchCall(u8 *destStr)
2019-01-03 02:07:47 +01:00
{
int numSeen, numCaught;
u8 *str;
u8 dexRatingLevel;
2018-03-04 21:47:54 +01:00
2021-04-01 08:35:14 +02:00
u8 *buffer = Alloc(sizeof(gStringVar4));
2019-01-03 02:07:47 +01:00
if (!buffer)
2018-03-04 21:47:54 +01:00
{
2019-01-03 02:07:47 +01:00
destStr[0] = EOS;
return;
2018-03-04 21:47:54 +01:00
}
2019-01-03 02:07:47 +01:00
numSeen = GetHoennPokedexCount(FLAG_GET_SEEN);
numCaught = GetHoennPokedexCount(FLAG_GET_CAUGHT);
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN(gStringVar1, numSeen, STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, numCaught, STR_CONV_MODE_LEFT_ALIGN, 3);
2019-01-03 02:07:47 +01:00
dexRatingLevel = GetPokedexRatingLevel(numCaught);
2019-08-15 05:38:42 +02:00
str = StringCopy(buffer, gBirchDexRatingText_AreYouCurious);
2021-04-01 08:35:14 +02:00
*(str++) = CHAR_PROMPT_CLEAR;
2019-08-15 05:38:42 +02:00
str = StringCopy(str, gBirchDexRatingText_SoYouveSeenAndCaught);
2021-04-01 08:35:14 +02:00
*(str++) = CHAR_PROMPT_CLEAR;
2019-01-03 02:07:47 +01:00
StringCopy(str, sBirchDexRatingTexts[dexRatingLevel]);
str = StringExpandPlaceholders(destStr, buffer);
if (IsNationalPokedexEnabled())
2018-03-04 21:47:54 +01:00
{
2021-04-01 08:35:14 +02:00
*(str++) = CHAR_PROMPT_CLEAR;
2019-01-03 02:07:47 +01:00
numSeen = GetNationalPokedexCount(FLAG_GET_SEEN);
numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
2019-09-30 21:43:44 +02:00
ConvertIntToDecimalStringN(gStringVar1, numSeen, STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, numCaught, STR_CONV_MODE_LEFT_ALIGN, 3);
2019-08-15 05:38:42 +02:00
StringExpandPlaceholders(str, gBirchDexRatingText_OnANationwideBasis);
2018-03-04 21:47:54 +01:00
}
2019-01-03 02:07:47 +01:00
Free(buffer);
2018-03-04 21:47:54 +01:00
}
2021-04-01 08:35:14 +02:00
void LoadMatchCallWindowGfx(u32 windowId, u32 destOffset, u32 paletteId)
2018-03-04 21:47:54 +01:00
{
2019-01-03 02:07:47 +01:00
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
2021-04-01 08:35:14 +02:00
LoadBgTiles(bg, sMatchCallWindow_Gfx, 0x100, destOffset);
LoadPalette(sMatchCallWindow_Pal, paletteId << 4, sizeof(sMatchCallWindow_Pal));
2018-03-04 21:47:54 +01:00
}
2021-04-01 08:35:14 +02:00
void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId)
2018-03-04 21:47:54 +01:00
{
2021-04-01 08:35:14 +02:00
DrawMatchCallTextBoxBorder_Internal(windowId, tileOffset, paletteId);
}