2018-02-27 14:47:47 +01:00
// Includes
# include "global.h"
2018-03-01 04:09:28 +01:00
# include "battle_setup.h"
# include "event_data.h"
2018-03-03 19:22:38 +01:00
# include "string_util.h"
2018-03-04 21:36:01 +01:00
# include "battle.h"
2018-03-06 14:52:29 +01:00
# include "battle_frontier_1.h"
2018-03-03 19:22:38 +01:00
# include "gym_leader_rematch.h"
2018-03-01 04:09:28 +01:00
2018-03-04 21:36:01 +01:00
extern const u8 gTrainerClassNames [ ] [ 13 ] ;
2018-02-27 14:47:47 +01:00
// Static type declarations
2018-03-08 00:03:13 +01:00
typedef struct MatchCallTextDataStruct {
2018-03-01 04:47:50 +01:00
const u8 * text ;
2018-03-03 19:22:38 +01:00
u16 flag ;
u16 flag2 ;
2018-03-08 00:03:13 +01:00
} match_call_text_data_t ;
2018-03-01 04:47:50 +01:00
2018-03-02 14:44:33 +01:00
struct MatchCallStructCommon {
u8 type ;
u8 v1 ;
2018-03-01 04:47:50 +01:00
u16 flag ;
2018-03-02 14:44:33 +01:00
} ;
struct MatchCallStruct0 {
u8 type ;
u8 v1 ;
u16 flag ;
2018-03-04 23:30:59 +01:00
const u8 * desc ;
const u8 * name ;
2018-03-08 00:03:13 +01:00
const match_call_text_data_t * textData ;
2018-03-02 14:44:33 +01:00
} ;
struct MatchCallStruct1 {
u8 type ;
u8 v1 ;
u16 flag ;
2018-03-04 23:30:59 +01:00
u16 rematchTableIdx ;
const u8 * desc ;
const u8 * name ;
2018-03-08 00:03:13 +01:00
const match_call_text_data_t * textData ;
2018-03-02 14:44:33 +01:00
} ;
struct MatchCallSubstruct2 {
2018-03-08 00:03:13 +01:00
u16 flag ;
2018-03-02 14:44:33 +01:00
u8 v2 ;
} ;
struct MatchCallStruct2 {
u8 type ;
u8 v1 ;
u16 flag ;
2018-03-04 23:30:59 +01:00
u16 rematchTableIdx ;
const u8 * desc ;
2018-03-08 00:03:13 +01:00
const match_call_text_data_t * textData ;
2018-03-02 14:44:33 +01:00
const struct MatchCallSubstruct2 * v10 ;
} ;
struct MatchCallStruct3 {
u8 type ;
u8 v1 ;
u16 flag ;
2018-03-04 23:30:59 +01:00
const u8 * desc ;
const u8 * name ;
2018-03-02 14:44:33 +01:00
} ;
struct MatchCallStruct4 {
u8 type ;
2018-03-06 14:52:29 +01:00
u8 gender ;
2018-03-02 14:44:33 +01:00
u16 flag ;
2018-03-04 23:30:59 +01:00
const u8 * desc ;
const u8 * name ;
2018-03-08 00:03:13 +01:00
const match_call_text_data_t * textData ;
2018-03-03 03:43:18 +01:00
} ;
struct MatchCallStruct5 {
u8 type ;
u8 v1 ;
u16 flag ;
2018-03-03 19:41:28 +01:00
u16 v4 ;
2018-03-04 23:30:59 +01:00
const u8 * desc ;
const u8 * name ;
2018-03-08 00:03:13 +01:00
const match_call_text_data_t * textData ;
2018-03-02 14:44:33 +01:00
} ;
2018-03-04 22:14:56 +01:00
# define MATCHCALLDEF(name, type_, ...) \
2018-03-04 23:30:59 +01:00
static const struct MatchCallStruct # # type_ name = { \
2018-03-04 22:14:56 +01:00
. type = type_ , \
__VA_ARGS__ \
} ;
2018-03-02 14:44:33 +01:00
typedef union {
2018-03-04 22:44:50 +01:00
const struct MatchCallStructCommon * common ;
const struct MatchCallStruct0 * type0 ;
const struct MatchCallStruct1 * type1 ;
const struct MatchCallStruct2 * type2 ;
const struct MatchCallStruct3 * type3 ;
const struct MatchCallStruct4 * type4 ;
const struct MatchCallStruct5 * type5 ;
2018-03-01 04:09:28 +01:00
} match_call_t ;
2018-03-03 00:12:23 +01:00
struct UnkStruct_08625388 {
u16 idx ;
u16 v2 ;
u16 v4 ;
2018-03-04 21:36:01 +01:00
const u8 * v8 [ 4 ] ;
2018-03-03 00:12:23 +01:00
} ;
2018-02-27 14:47:47 +01:00
// Static RAM declarations
// Static ROM declarations
2018-03-08 00:03:13 +01:00
static bool32 sMatchCallGetFlag_Type0 ( match_call_t ) ;
static bool32 sMatchCallGetFlag_Type1 ( match_call_t ) ;
static bool32 sMatchCallGetFlag_Type2 ( match_call_t ) ;
static bool32 sMatchCallGetFlag_Type3 ( match_call_t ) ;
static bool32 sMatchCallGetFlag_Type4 ( match_call_t ) ;
static u8 sub_81D1714 ( match_call_t ) ;
static u8 sub_81D1718 ( match_call_t ) ;
static u8 sub_81D171C ( match_call_t ) ;
static u8 sub_81D1750 ( match_call_t ) ;
static u8 sub_81D1754 ( match_call_t ) ;
static bool32 MatchCall_IsRematchable_Type0 ( match_call_t ) ;
static bool32 MatchCall_IsRematchable_Type1 ( match_call_t ) ;
static bool32 MatchCall_IsRematchable_Type2 ( match_call_t ) ;
static bool32 MatchCall_IsRematchable_Type3 ( match_call_t ) ;
static bool32 MatchCall_IsRematchable_Type4 ( match_call_t ) ;
static bool32 sub_81D1840 ( match_call_t ) ;
static bool32 sub_81D1844 ( match_call_t ) ;
static bool32 sub_81D1848 ( match_call_t ) ;
static bool32 sub_81D184C ( match_call_t ) ;
static bool32 sub_81D1850 ( match_call_t ) ;
2018-03-04 22:58:51 +01:00
2018-03-06 14:52:29 +01:00
static u32 MatchCall_GetRematchTableIdx_Type0 ( match_call_t ) ;
static u32 MatchCall_GetRematchTableIdx_Type1 ( match_call_t ) ;
static u32 MatchCall_GetRematchTableIdx_Type2 ( match_call_t ) ;
static u32 MatchCall_GetRematchTableIdx_Type3 ( match_call_t ) ;
static u32 MatchCall_GetRematchTableIdx_Type4 ( match_call_t ) ;
2018-03-04 22:58:51 +01:00
2018-03-06 14:52:29 +01:00
static void MatchCall_GetMessage_Type0 ( match_call_t , u8 * ) ;
static void MatchCall_GetMessage_Type1 ( match_call_t , u8 * ) ;
static void MatchCall_GetMessage_Type2 ( match_call_t , u8 * ) ;
static void MatchCall_GetMessage_Type3 ( match_call_t , u8 * ) ;
static void MatchCall_GetMessage_Type4 ( match_call_t , u8 * ) ;
2018-03-04 22:58:51 +01:00
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDesc_Type0 ( match_call_t , const u8 * * , const u8 * * ) ;
static void MatchCall_GetNameAndDesc_Type1 ( match_call_t , const u8 * * , const u8 * * ) ;
static void MatchCall_GetNameAndDesc_Type2 ( match_call_t , const u8 * * , const u8 * * ) ;
static void MatchCall_GetNameAndDesc_Type3 ( match_call_t , const u8 * * , const u8 * * ) ;
static void MatchCall_GetNameAndDesc_Type4 ( match_call_t , const u8 * * , const u8 * * ) ;
2018-03-04 22:58:51 +01:00
2018-03-08 00:03:13 +01:00
static void sub_81D1920 ( const match_call_text_data_t * , u8 * ) ;
static void sub_81D199C ( const match_call_text_data_t * , u16 , u8 * ) ;
static void MatchCall_GetNameAndDescByRematchIdx ( u32 , const u8 * * , const u8 * * ) ;
2018-03-03 03:43:18 +01:00
2018-03-04 22:14:56 +01:00
extern const u8 gText_MrStone_Pokenav_2B60C0 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B61E6 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B6302 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B63A0 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B64A2 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B6526 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B65BB [ ] ;
extern const u8 gText_MrStone_Pokenav_2B6664 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B66B1 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B6703 [ ] ;
extern const u8 gText_MrStone_Pokenav_2B67ED [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gMrStoneMatchCallDesc [ ] ;
extern const u8 gMrStoneMatchCallName [ ] ;
2018-03-04 22:14:56 +01:00
extern const u8 gText_Norman_Pokenav_2B5719 [ ] ;
extern const u8 gText_Norman_Pokenav_2B5795 [ ] ;
extern const u8 gText_Norman_Pokenav_2B584D [ ] ;
extern const u8 gText_Norman_Pokenav_2B58E3 [ ] ;
extern const u8 gText_Norman_Pokenav_2B5979 [ ] ;
extern const u8 gText_Norman_Pokenav_2B5A07 [ ] ;
extern const u8 gText_Norman_Pokenav_2B5A69 [ ] ;
extern const u8 gText_Norman_Pokenav_2B5ACF [ ] ;
extern const u8 gText_Norman_Pokenav_2B5B5E [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gNormanMatchCallDesc [ ] ;
extern const u8 gNormanMatchCallName [ ] ;
2018-03-04 22:14:56 +01:00
2018-03-06 14:52:29 +01:00
extern const u8 gProfBirchMatchCallDesc [ ] ;
extern const u8 gProfBirchMatchCallName [ ] ;
2018-03-04 22:14:56 +01:00
extern const u8 gText_Mom_Pokenav_2B227B [ ] ;
extern const u8 gText_Mom_Pokenav_2B2310 [ ] ;
extern const u8 gText_Mom_Pokenav_2B23F3 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gMomMatchCallDesc [ ] ;
extern const u8 gMomMatchCallName [ ] ;
2018-03-04 22:14:56 +01:00
2018-03-04 22:44:50 +01:00
extern const u8 gText_Steven_Pokenav_2B5B95 [ ] ;
extern const u8 gText_Steven_Pokenav_2B5C53 [ ] ;
extern const u8 gText_Steven_Pokenav_2B5CC9 [ ] ;
extern const u8 gText_Steven_Pokenav_2B5DB4 [ ] ;
extern const u8 gText_Steven_Pokenav_2B5E26 [ ] ;
extern const u8 gText_Steven_Pokenav_2B5EA2 [ ] ;
extern const u8 gText_Steven_Pokenav_2B5ED9 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gStevenMatchCallDesc [ ] ;
extern const u8 gStevenMatchCallName [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_May_Pokenav_2B3AB3 [ ] ;
extern const u8 gText_May_Pokenav_2B3B3F [ ] ;
extern const u8 gText_May_Pokenav_2B3C13 [ ] ;
extern const u8 gText_May_Pokenav_2B3CF3 [ ] ;
extern const u8 gText_May_Pokenav_2B3D4B [ ] ;
extern const u8 gText_May_Pokenav_2B3DD1 [ ] ;
extern const u8 gText_May_Pokenav_2B3E69 [ ] ;
extern const u8 gText_May_Pokenav_2B3ECD [ ] ;
extern const u8 gText_May_Pokenav_2B3F2B [ ] ;
extern const u8 gText_May_Pokenav_2B3FFB [ ] ;
extern const u8 gText_May_Pokenav_2B402B [ ] ;
extern const u8 gText_May_Pokenav_2B414B [ ] ;
extern const u8 gText_May_Pokenav_2B4228 [ ] ;
extern const u8 gText_May_Pokenav_2B42E0 [ ] ;
extern const u8 gText_May_Pokenav_2B4350 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gMayBrendanMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gExpandedPlaceholder_May [ ] ;
extern const u8 gText_Brendan_Pokenav_2B43EF [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4486 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4560 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B463F [ ] ;
extern const u8 gText_Brendan_Pokenav_2B46B7 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4761 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B47F4 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4882 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4909 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B49C4 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4A44 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4B28 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4C15 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4CD8 [ ] ;
extern const u8 gText_Brendan_Pokenav_2B4D46 [ ] ;
extern const u8 gExpandedPlaceholder_Brendan [ ] ;
extern const u8 gText_Wally_Pokenav_2B4DE2 [ ] ;
extern const u8 gText_Wally_Pokenav_2B4E57 [ ] ;
extern const u8 gText_Wally_Pokenav_2B4EA5 [ ] ;
extern const u8 gText_Wally_Pokenav_2B4F41 [ ] ;
extern const u8 gText_Wally_Pokenav_2B4FF3 [ ] ;
extern const u8 gText_Wally_Pokenav_2B50B1 [ ] ;
extern const u8 gText_Wally_Pokenav_2B5100 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gWallyMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Scott_Pokenav_2B5184 [ ] ;
extern const u8 gText_Scott_Pokenav_2B5275 [ ] ;
extern const u8 gText_Scott_Pokenav_2B5323 [ ] ;
extern const u8 gText_Scott_Pokenav_2B53DB [ ] ;
extern const u8 gText_Scott_Pokenav_2B54A5 [ ] ;
extern const u8 gText_Scott_Pokenav_2B5541 [ ] ;
extern const u8 gText_Scott_Pokenav_2B56CA [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gScottMatchCallDesc [ ] ;
extern const u8 gScottMatchCallName [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Roxanne_Pokenav_2B2456 [ ] ;
extern const u8 gText_Roxanne_Pokenav_2B250E [ ] ;
extern const u8 gText_Roxanne_Pokenav_2B25C1 [ ] ;
extern const u8 gText_Roxanne_Pokenav_2B2607 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gRoxanneMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Brawly_Pokenav_2B2659 [ ] ;
extern const u8 gText_Brawly_Pokenav_2B275D [ ] ;
extern const u8 gText_Brawly_Pokenav_2B286F [ ] ;
extern const u8 gText_Brawly_Pokenav_2B28D1 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gBrawlyMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Wattson_Pokenav_2B2912 [ ] ;
extern const u8 gText_Wattson_Pokenav_2B29CA [ ] ;
extern const u8 gText_Wattson_Pokenav_2B2AB6 [ ] ;
extern const u8 gText_Wattson_Pokenav_2B2B01 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gWattsonMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Flannery_Pokenav_2B2B4D [ ] ;
extern const u8 gText_Flannery_Pokenav_2B2C0E [ ] ;
extern const u8 gText_Flannery_Pokenav_2B2CF1 [ ] ;
extern const u8 gText_Flannery_Pokenav_2B2D54 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gFlanneryMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Winona_Pokenav_2B2DA4 [ ] ;
extern const u8 gText_Winona_Pokenav_2B2E2B [ ] ;
extern const u8 gText_Winona_Pokenav_2B2EC2 [ ] ;
extern const u8 gText_Winona_Pokenav_2B2F16 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gWinonaMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_TateLiza_Pokenav_2B2F97 [ ] ;
extern const u8 gText_TateLiza_Pokenav_2B306E [ ] ;
extern const u8 gText_TateLiza_Pokenav_2B3158 [ ] ;
extern const u8 gText_TateLiza_Pokenav_2B31CD [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gTateLizaMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Juan_Pokenav_2B3249 [ ] ;
extern const u8 gText_Juan_Pokenav_2B32EC [ ] ;
extern const u8 gText_Juan_Pokenav_2B33AA [ ] ;
extern const u8 gText_Juan_Pokenav_2B341E [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gJuanMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Sidney_Pokenav_2B34CC [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gEliteFourMatchCallDesc [ ] ;
2018-03-04 22:44:50 +01:00
extern const u8 gText_Phoebe_Pokenav_2B3561 [ ] ;
extern const u8 gText_Glacia_Pokenav_2B35E4 [ ] ;
extern const u8 gText_Drake_Pokenav_2B368B [ ] ;
extern const u8 gText_Wallace_Pokenav_2B3790 [ ] ;
2018-03-06 14:52:29 +01:00
extern const u8 gChampionMatchCallDesc [ ] ;
extern const u8 gMatchCallStevenStrategyText [ ] ;
extern const u8 gMatchCall_StevenTrainersPokemonText [ ] ;
extern const u8 gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle [ ] ;
extern const u8 gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle [ ] ;
extern const u8 gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle [ ] ;
extern const u8 gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle [ ] ;
extern const u8 gMatchCall_BrendanStrategyText [ ] ;
extern const u8 gMatchCall_BrendanTrainersPokemonText [ ] ;
extern const u8 gMatchCall_BrendanSelfIntroductionText_Line1 [ ] ;
extern const u8 gMatchCall_BrendanSelfIntroductionText_Line2 [ ] ;
extern const u8 gMatchCall_MayStrategyText [ ] ;
extern const u8 gMatchCall_MayTrainersPokemonText [ ] ;
extern const u8 gMatchCall_MaySelfIntroductionText_Line1 [ ] ;
extern const u8 gMatchCall_MaySelfIntroductionText_Line2 [ ] ;
2018-02-27 14:47:47 +01:00
// .rodata
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sMrStoneTextScripts [ ] = {
2018-03-04 22:14:56 +01:00
{ gText_MrStone_Pokenav_2B60C0 , 0xFFFF , FLAG_0x158 } ,
{ gText_MrStone_Pokenav_2B61E6 , FLAG_0x158 , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B6302 , FLAG_0x0BD , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B63A0 , FLAG_0x110 , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B64A2 , FLAG_0x06A , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B6526 , FLAG_0x4F4 , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B65BB , FLAG_0x097 , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B6664 , FLAG_0x06F , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B66B1 , FLAG_0x070 , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B6703 , FLAG_0x4F7 , 0xFFFF } ,
{ gText_MrStone_Pokenav_2B67ED , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sMrStoneMatchCallHeader , 0 , 10 , 0xffff , gMrStoneMatchCallDesc , gMrStoneMatchCallName , sMrStoneTextScripts ) ;
2018-03-04 22:14:56 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sNormanTextScripts [ ] = {
2018-03-04 22:14:56 +01:00
{ gText_Norman_Pokenav_2B5719 , FLAG_0x132 , 0xFFFF } ,
{ gText_Norman_Pokenav_2B5795 , FLAG_0x4F1 , 0xFFFF } ,
{ gText_Norman_Pokenav_2B584D , FLAG_0x4F3 , 0xFFFF } ,
{ gText_Norman_Pokenav_2B58E3 , FLAG_0x4F4 , 0xFFFF } ,
{ gText_Norman_Pokenav_2B5979 , FLAG_0x0D4 , 0xFFFF } ,
{ gText_Norman_Pokenav_2B5A07 , 0xFFFE , 0xFFFF } ,
{ gText_Norman_Pokenav_2B5A69 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ gText_Norman_Pokenav_2B5ACF , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ gText_Norman_Pokenav_2B5B5E , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sNormanMatchCallHeader , 5 , 7 , FLAG_0x132 , 0x45 , gNormanMatchCallDesc , gNormanMatchCallName , sNormanTextScripts ) ;
2018-03-04 22:14:56 +01:00
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sProfBirchMatchCallHeader , 3 , 0 , FLAG_0x119 , gProfBirchMatchCallDesc , gProfBirchMatchCallName )
2018-03-04 22:14:56 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sMomTextScripts [ ] = {
2018-03-04 22:14:56 +01:00
{ gText_Mom_Pokenav_2B227B , 0xffff , 0xffff } ,
{ gText_Mom_Pokenav_2B2310 , FLAG_0x4F4 , 0xffff } ,
{ gText_Mom_Pokenav_2B23F3 , FLAG_SYS_GAME_CLEAR , 0xffff } ,
{ NULL , 0xffff , 0xffff }
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sMomMatchCallHeader , 0 , 0 , FLAG_0x0D8 , gMomMatchCallDesc , gMomMatchCallName , sMomTextScripts ) ;
2018-03-04 22:14:56 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sStevenTextScripts [ ] = {
2018-03-04 22:44:50 +01:00
{ gText_Steven_Pokenav_2B5B95 , 0xffff , 0xffff } ,
{ gText_Steven_Pokenav_2B5C53 , FLAG_0x0C7 , 0xffff } ,
{ gText_Steven_Pokenav_2B5CC9 , FLAG_0x0D4 , 0xffff } ,
{ gText_Steven_Pokenav_2B5DB4 , FLAG_0x070 , 0xffff } ,
{ gText_Steven_Pokenav_2B5E26 , FLAG_0x4F6 , 0xffff } ,
{ gText_Steven_Pokenav_2B5EA2 , FLAG_0x081 , 0xffff } ,
{ gText_Steven_Pokenav_2B5ED9 , FLAG_SYS_GAME_CLEAR , 0xffff } ,
{ NULL , 0xffff , 0xffff } ,
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sStevenMatchCallHeader , 0 , 0xd5 , FLAG_0x131 , gStevenMatchCallDesc , gStevenMatchCallName , sStevenTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sMayTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_May_Pokenav_2B3AB3 , 0xFFFF , 0xFFFF } ,
{ gText_May_Pokenav_2B3B3F , FLAG_0x4F1 , 0xFFFF } ,
{ gText_May_Pokenav_2B3C13 , FLAG_0x095 , 0xFFFF } ,
{ gText_May_Pokenav_2B3CF3 , FLAG_0x324 , 0xFFFF } ,
{ gText_May_Pokenav_2B3D4B , FLAG_0x06A , 0xFFFF } ,
{ gText_May_Pokenav_2B3DD1 , FLAG_0x4F3 , 0xFFFF } ,
{ gText_May_Pokenav_2B3E69 , FLAG_0x4F4 , 0xFFFF } ,
{ gText_May_Pokenav_2B3ECD , FLAG_0x097 , 0xFFFF } ,
{ gText_May_Pokenav_2B3F2B , FLAG_0x0D4 , 0xFFFF } ,
{ gText_May_Pokenav_2B3FFB , FLAG_0x06F , 0xFFFF } ,
{ gText_May_Pokenav_2B402B , FLAG_0x061 , 0xFFFF } ,
{ gText_May_Pokenav_2B414B , FLAG_0x070 , 0xFFFF } ,
{ gText_May_Pokenav_2B4228 , FLAG_0x081 , 0xFFFF } ,
{ gText_May_Pokenav_2B42E0 , FLAG_0x4F7 , 0xFFFF } ,
{ gText_May_Pokenav_2B4350 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sMayMatchCallHeader , 4 , MALE , FLAG_0x0FD , gMayBrendanMatchCallDesc , gExpandedPlaceholder_May , sMayTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sBrendanTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Brendan_Pokenav_2B43EF , 0xFFFF , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4486 , FLAG_0x4F1 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4560 , FLAG_0x095 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B463F , FLAG_0x324 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B46B7 , FLAG_0x06A , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4761 , FLAG_0x4F3 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B47F4 , FLAG_0x4F4 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4882 , FLAG_0x097 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4909 , FLAG_0x0D4 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B49C4 , FLAG_0x06F , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4A44 , FLAG_0x061 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4B28 , FLAG_0x070 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4C15 , FLAG_0x081 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4CD8 , FLAG_0x4F7 , 0xFFFF } ,
{ gText_Brendan_Pokenav_2B4D46 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sBrendanMatchCallHeader , 4 , FEMALE , FLAG_0x0FD , gMayBrendanMatchCallDesc , gExpandedPlaceholder_Brendan , sBrendanTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sWallyTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Wally_Pokenav_2B4DE2 , 0xFFFF , 0xFFFF } ,
{ gText_Wally_Pokenav_2B4E57 , FLAG_0x0C7 , 0xFFFF } ,
{ gText_Wally_Pokenav_2B4EA5 , FLAG_0x4F3 , 0xFFFF } ,
{ gText_Wally_Pokenav_2B4F41 , FLAG_0x097 , 0xFFFF } ,
{ gText_Wally_Pokenav_2B4FF3 , FLAG_0x06F , 0xFFFF } ,
{ gText_Wally_Pokenav_2B50B1 , FLAG_0x081 , 0xFFFF } ,
{ gText_Wally_Pokenav_2B5100 , FLAG_0x07E , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
const struct MatchCallSubstruct2 sWallyAdditionalData [ ] = {
2018-03-04 23:30:59 +01:00
{ FLAG_0x324 , 0x05 } ,
{ FLAG_0x06F , 0xD5 } ,
{ FLAG_0x35A , 0x46 } ,
{ 0xFFFF , 0xD5 }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sWallyMatchCallHeader , 2 , 0 , FLAG_0x0D6 , REMATCH_WALLY_3 , gWallyMatchCallDesc , sWallyTextScripts , sWallyAdditionalData ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sScottTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Scott_Pokenav_2B5184 , 0xFFFF , 0xFFFF } ,
{ gText_Scott_Pokenav_2B5275 , FLAG_0x08B , 0xFFFF } ,
{ gText_Scott_Pokenav_2B5323 , FLAG_0x097 , 0xFFFF } ,
{ gText_Scott_Pokenav_2B53DB , FLAG_0x0D4 , 0xFFFF } ,
{ gText_Scott_Pokenav_2B54A5 , FLAG_0x070 , 0xFFFF } ,
{ gText_Scott_Pokenav_2B5541 , FLAG_0x4F7 , 0xFFFF } ,
{ gText_Scott_Pokenav_2B56CA , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sScottMatchCallHeader , 0 , 0xD5 , FLAG_0x0D7 , gScottMatchCallDesc , gScottMatchCallName , sScottTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sRoxanneTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Roxanne_Pokenav_2B2456 , 0xFFFE , 0xFFFF } ,
{ gText_Roxanne_Pokenav_2B250E , 0xFFFF , 0xFFFF } ,
{ gText_Roxanne_Pokenav_2B25C1 , 0xFFFF , 0xFFFF } ,
{ gText_Roxanne_Pokenav_2B2607 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sRoxanneMatchCallHeader , 5 , 10 , FLAG_0x1D3 , 0x41 , gRoxanneMatchCallDesc , NULL , sRoxanneTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sBrawlyTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Brawly_Pokenav_2B2659 , 0xFFFE , 0xFFFF } ,
{ gText_Brawly_Pokenav_2B275D , 0xFFFF , 0xFFFF } ,
{ gText_Brawly_Pokenav_2B286F , 0xFFFF , 0xFFFF } ,
{ gText_Brawly_Pokenav_2B28D1 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sBrawlyMatchCallHeader , 5 , 2 , FLAG_0x1D4 , 0x42 , gBrawlyMatchCallDesc , NULL , sBrawlyTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sWattsonTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Wattson_Pokenav_2B2912 , 0xFFFE , 0xFFFF } ,
{ gText_Wattson_Pokenav_2B29CA , 0xFFFF , 0xFFFF } ,
{ gText_Wattson_Pokenav_2B2AB6 , 0xFFFF , 0xFFFF } ,
{ gText_Wattson_Pokenav_2B2B01 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sWattsonMatchCallHeader , 5 , 9 , FLAG_0x1D5 , 0x43 , gWattsonMatchCallDesc , NULL , sWattsonTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sFlanneryTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Flannery_Pokenav_2B2B4D , 0xFFFE , 0xFFFF } ,
{ gText_Flannery_Pokenav_2B2C0E , 0xFFFF , 0xFFFF } ,
{ gText_Flannery_Pokenav_2B2CF1 , 0xFFFF , 0xFFFF } ,
{ gText_Flannery_Pokenav_2B2D54 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sFlanneryMatchCallHeader , 5 , 3 , FLAG_0x1D6 , 0x44 , gFlanneryMatchCallDesc , NULL , sFlanneryTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sWinonaTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Winona_Pokenav_2B2DA4 , 0xFFFE , 0xFFFF } ,
{ gText_Winona_Pokenav_2B2E2B , 0xFFFF , 0xFFFF } ,
{ gText_Winona_Pokenav_2B2EC2 , 0xFFFF , 0xFFFF } ,
{ gText_Winona_Pokenav_2B2F16 , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sWinonaMatchCallHeader , 5 , 11 , FLAG_0x1D7 , 0x46 , gWinonaMatchCallDesc , NULL , sWinonaTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sTateLizaTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_TateLiza_Pokenav_2B2F97 , 0xFFFE , 0xFFFF } ,
{ gText_TateLiza_Pokenav_2B306E , 0xFFFF , 0xFFFF } ,
{ gText_TateLiza_Pokenav_2B3158 , 0xFFFF , 0xFFFF } ,
{ gText_TateLiza_Pokenav_2B31CD , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sTateLizaMatchCallHeader , 5 , 13 , FLAG_0x1D8 , 0x47 , gTateLizaMatchCallDesc , NULL , sTateLizaTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sJuanTextScripts [ ] = {
2018-03-04 23:08:10 +01:00
{ gText_Juan_Pokenav_2B3249 , 0xFFFE , 0xFFFF } ,
{ gText_Juan_Pokenav_2B32EC , 0xFFFF , 0xFFFF } ,
{ gText_Juan_Pokenav_2B33AA , 0xFFFF , 0xFFFF } ,
{ gText_Juan_Pokenav_2B341E , FLAG_SYS_GAME_CLEAR , 0xFFFF } ,
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sJuanMatchCallHeader , 5 , 14 , FLAG_0x1D9 , 0x48 , gJuanMatchCallDesc , NULL , sJuanTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sSidneyTextScripts [ ] = {
2018-03-04 22:44:50 +01:00
{ gText_Sidney_Pokenav_2B34CC , 0xFFFF , 0xFFFF } ,
2018-03-04 23:08:10 +01:00
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sSidneyMatchCallHeader , 5 , 15 , FLAG_0x1A5 , 0x49 , gEliteFourMatchCallDesc , NULL , sSidneyTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sPhoebeTextScripts [ ] = {
2018-03-04 22:44:50 +01:00
{ gText_Phoebe_Pokenav_2B3561 , 0xFFFF , 0xFFFF } ,
2018-03-04 23:08:10 +01:00
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sPhoebeMatchCallHeader , 5 , 15 , FLAG_0x1A6 , 0x4A , gEliteFourMatchCallDesc , NULL , sPhoebeTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sGlaciaTextScripts [ ] = {
2018-03-04 22:44:50 +01:00
{ gText_Glacia_Pokenav_2B35E4 , 0xFFFF , 0xFFFF } ,
2018-03-04 23:08:10 +01:00
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sGlaciaMatchCallHeader , 5 , 15 , FLAG_0x1A7 , 0x4B , gEliteFourMatchCallDesc , NULL , sGlaciaTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sDrakeTextScripts [ ] = {
2018-03-04 22:44:50 +01:00
{ gText_Drake_Pokenav_2B368B , 0xFFFF , 0xFFFF } ,
2018-03-04 23:08:10 +01:00
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sDrakeMatchCallHeader , 5 , 15 , FLAG_0x1A8 , 0x4C , gEliteFourMatchCallDesc , NULL , sDrakeTextScripts ) ;
2018-03-04 22:44:50 +01:00
2018-03-08 00:03:13 +01:00
static const match_call_text_data_t sWallaceTextScripts [ ] = {
2018-03-04 22:44:50 +01:00
{ gText_Wallace_Pokenav_2B3790 , 0xFFFF , 0xFFFF } ,
2018-03-04 23:08:10 +01:00
{ NULL , 0xFFFF , 0xFFFF }
2018-03-04 22:44:50 +01:00
} ;
2018-03-06 14:52:29 +01:00
MATCHCALLDEF ( sWallaceMatchCallHeader , 5 , 15 , FLAG_0x1A9 , 0x4D , gChampionMatchCallDesc , NULL , sWallaceTextScripts ) ;
2018-03-08 00:03:13 +01:00
static const match_call_t sMatchCallHeaders [ ] = {
2018-03-06 14:52:29 +01:00
{ . type0 = & sMrStoneMatchCallHeader } ,
{ . type3 = & sProfBirchMatchCallHeader } ,
{ . type4 = & sBrendanMatchCallHeader } ,
{ . type4 = & sMayMatchCallHeader } ,
{ . type2 = & sWallyMatchCallHeader } ,
{ . type5 = & sNormanMatchCallHeader } ,
{ . type0 = & sMomMatchCallHeader } ,
{ . type0 = & sStevenMatchCallHeader } ,
{ . type0 = & sScottMatchCallHeader } ,
{ . type5 = & sRoxanneMatchCallHeader } ,
{ . type5 = & sBrawlyMatchCallHeader } ,
{ . type5 = & sWattsonMatchCallHeader } ,
{ . type5 = & sFlanneryMatchCallHeader } ,
{ . type5 = & sWinonaMatchCallHeader } ,
{ . type5 = & sTateLizaMatchCallHeader } ,
{ . type5 = & sJuanMatchCallHeader } ,
{ . type5 = & sSidneyMatchCallHeader } ,
{ . type5 = & sPhoebeMatchCallHeader } ,
{ . type5 = & sGlaciaMatchCallHeader } ,
{ . type5 = & sDrakeMatchCallHeader } ,
{ . type5 = & sWallaceMatchCallHeader }
2018-03-04 22:44:50 +01:00
} ;
2018-03-08 00:03:13 +01:00
static bool32 ( * const sMatchCallGetFlagFuncs [ ] ) ( match_call_t ) = {
sMatchCallGetFlag_Type0 ,
sMatchCallGetFlag_Type1 ,
sMatchCallGetFlag_Type2 ,
sMatchCallGetFlag_Type3 ,
sMatchCallGetFlag_Type4
2018-03-04 22:58:51 +01:00
} ;
2018-03-08 00:03:13 +01:00
static u8 ( * const gUnknown_08625310 [ ] ) ( match_call_t ) = {
2018-03-04 22:58:51 +01:00
sub_81D1714 ,
sub_81D1718 ,
sub_81D171C ,
sub_81D1750 ,
sub_81D1754
} ;
2018-03-08 00:03:13 +01:00
static bool32 ( * const sMatchCall_IsRematchableFunctions [ ] ) ( match_call_t ) = {
MatchCall_IsRematchable_Type0 ,
MatchCall_IsRematchable_Type1 ,
MatchCall_IsRematchable_Type2 ,
MatchCall_IsRematchable_Type3 ,
MatchCall_IsRematchable_Type4
2018-03-04 22:58:51 +01:00
} ;
2018-03-08 00:03:13 +01:00
static bool32 ( * const gUnknown_08625338 [ ] ) ( match_call_t ) = {
2018-03-04 22:58:51 +01:00
sub_81D1840 ,
sub_81D1844 ,
sub_81D1848 ,
sub_81D184C ,
sub_81D1850
} ;
2018-03-06 14:52:29 +01:00
static u32 ( * const sMatchCall_GetRematchTableIdxFunctions [ ] ) ( match_call_t ) = {
MatchCall_GetRematchTableIdx_Type0 ,
MatchCall_GetRematchTableIdx_Type1 ,
MatchCall_GetRematchTableIdx_Type2 ,
MatchCall_GetRematchTableIdx_Type3 ,
MatchCall_GetRematchTableIdx_Type4
2018-03-04 22:58:51 +01:00
} ;
2018-03-06 14:52:29 +01:00
static void ( * const sMatchCall_GetMessageFunctions [ ] ) ( match_call_t , u8 * ) = {
MatchCall_GetMessage_Type0 ,
MatchCall_GetMessage_Type1 ,
MatchCall_GetMessage_Type2 ,
MatchCall_GetMessage_Type3 ,
MatchCall_GetMessage_Type4
2018-03-04 22:58:51 +01:00
} ;
2018-03-08 00:03:13 +01:00
static void ( * const sMatchCall_GetNameAndDescFunctions [ ] ) ( match_call_t , const u8 * * , const u8 * * ) = {
MatchCall_GetNameAndDesc_Type0 ,
MatchCall_GetNameAndDesc_Type1 ,
MatchCall_GetNameAndDesc_Type2 ,
MatchCall_GetNameAndDesc_Type3 ,
MatchCall_GetNameAndDesc_Type4
2018-03-04 22:58:51 +01:00
} ;
2018-03-06 14:52:29 +01:00
static const struct UnkStruct_08625388 sMatchCallCheckPageOverrides [ ] = {
{ 7 , 0x4B , 0xffff , { gMatchCallStevenStrategyText , gMatchCall_StevenTrainersPokemonText , gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle , gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle } } , // STEVEN
{ 7 , 0x4B , FLAG_0x4F6 , { gMatchCallStevenStrategyText , gMatchCall_StevenTrainersPokemonText , gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle , gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle } } , // STEVEN
{ 2 , 0x3c , 0xffff , { gMatchCall_BrendanStrategyText , gMatchCall_BrendanTrainersPokemonText , gMatchCall_BrendanSelfIntroductionText_Line1 , gMatchCall_BrendanSelfIntroductionText_Line2 } } , // Brendan
{ 3 , 0x3f , 0xffff , { gMatchCall_MayStrategyText , gMatchCall_MayTrainersPokemonText , gMatchCall_MaySelfIntroductionText_Line1 , gMatchCall_MaySelfIntroductionText_Line2 } } // May
2018-03-04 22:58:51 +01:00
} ;
2018-03-01 04:09:28 +01:00
2018-02-27 14:47:47 +01:00
// .text
2018-03-08 00:03:13 +01:00
static u32 MatchCallGetFunctionIndex ( match_call_t matchCall )
2018-02-27 14:47:47 +01:00
{
2018-03-02 14:44:33 +01:00
switch ( matchCall . common - > type )
2018-02-27 14:47:47 +01:00
{
case 0 :
default :
return 0 ;
case 1 :
case 5 :
return 1 ;
case 2 :
return 2 ;
case 4 :
return 3 ;
case 3 :
return 4 ;
}
}
2018-03-01 04:09:28 +01:00
2018-03-08 00:03:13 +01:00
u32 GetTrainerIdxByRematchIdx ( u32 rematchIdx )
2018-03-01 04:09:28 +01:00
{
return gRematchTable [ rematchIdx ] . trainerIds [ 0 ] ;
}
2018-03-08 00:03:13 +01:00
s32 GetRematchIdxByTrainerIdx ( s32 trainerIdx )
2018-03-01 04:09:28 +01:00
{
s32 rematchIdx ;
2018-03-08 00:03:13 +01:00
for ( rematchIdx = 0 ; rematchIdx < REMATCH_TABLE_ENTRIES ; rematchIdx + + )
2018-03-01 04:09:28 +01:00
{
if ( gRematchTable [ rematchIdx ] . trainerIds [ 0 ] = = trainerIdx )
return rematchIdx ;
}
return - 1 ;
}
2018-03-06 14:52:29 +01:00
bool32 MatchCallFlagGetByIndex ( u32 idx )
2018-03-01 04:09:28 +01:00
{
2018-03-02 14:44:33 +01:00
match_call_t matchCall ;
2018-03-03 00:12:23 +01:00
u32 i ;
2018-03-01 04:09:28 +01:00
if ( idx > 20 )
return FALSE ;
2018-03-08 00:03:13 +01:00
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
return sMatchCallGetFlagFuncs [ i ] ( matchCall ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 sMatchCallGetFlag_Type0 ( match_call_t matchCall )
2018-03-01 04:09:28 +01:00
{
2018-03-02 14:44:33 +01:00
if ( matchCall . type0 - > flag = = 0xffff )
2018-03-01 04:09:28 +01:00
return TRUE ;
2018-03-02 14:44:33 +01:00
return FlagGet ( matchCall . type0 - > flag ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 sMatchCallGetFlag_Type1 ( match_call_t matchCall )
2018-03-01 04:09:28 +01:00
{
2018-03-02 14:44:33 +01:00
if ( matchCall . type1 - > flag = = 0xffff )
2018-03-01 04:09:28 +01:00
return TRUE ;
2018-03-02 14:44:33 +01:00
return FlagGet ( matchCall . type1 - > flag ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 sMatchCallGetFlag_Type2 ( match_call_t matchCall )
2018-03-01 04:09:28 +01:00
{
2018-03-02 14:44:33 +01:00
if ( matchCall . type2 - > flag = = 0xffff )
2018-03-01 04:09:28 +01:00
return TRUE ;
2018-03-02 14:44:33 +01:00
return FlagGet ( matchCall . type2 - > flag ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 sMatchCallGetFlag_Type3 ( match_call_t matchCall )
2018-03-01 04:09:28 +01:00
{
2018-03-06 14:52:29 +01:00
if ( matchCall . type4 - > gender ! = gSaveBlock2Ptr - > playerGender )
2018-03-01 04:09:28 +01:00
return FALSE ;
2018-03-02 14:44:33 +01:00
if ( matchCall . type4 - > flag = = 0xffff )
2018-03-01 04:09:28 +01:00
return TRUE ;
2018-03-02 14:44:33 +01:00
return FlagGet ( matchCall . type4 - > flag ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 sMatchCallGetFlag_Type4 ( match_call_t matchCall )
2018-03-01 04:09:28 +01:00
{
2018-03-02 14:44:33 +01:00
return FlagGet ( matchCall . type3 - > flag ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-01 04:47:50 +01:00
u8 sub_81D16DC ( u32 idx )
2018-03-01 04:09:28 +01:00
{
2018-03-02 14:44:33 +01:00
match_call_t matchCall ;
2018-03-03 00:12:23 +01:00
u32 i ;
2018-03-01 04:09:28 +01:00
if ( idx > 20 )
2018-03-08 00:03:13 +01:00
return 0 ;
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
2018-03-03 00:12:23 +01:00
return gUnknown_08625310 [ i ] ( matchCall ) ;
2018-03-01 04:09:28 +01:00
}
2018-03-02 14:44:33 +01:00
2018-03-08 00:03:13 +01:00
static u8 sub_81D1714 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return matchCall . type0 - > v1 ;
}
2018-03-08 00:03:13 +01:00
static u8 sub_81D1718 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return matchCall . type1 - > v1 ;
}
2018-03-08 00:03:13 +01:00
static u8 sub_81D171C ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
s32 i ;
2018-03-08 00:03:13 +01:00
for ( i = 0 ; matchCall . type2 - > v10 [ i ] . flag ! = 0xffff ; i + + )
2018-03-02 14:44:33 +01:00
{
2018-03-08 00:03:13 +01:00
if ( ! FlagGet ( matchCall . type2 - > v10 [ i ] . flag ) )
2018-03-02 14:44:33 +01:00
break ;
}
return matchCall . type2 - > v10 [ i ] . v2 ;
}
2018-03-08 00:03:13 +01:00
static u8 sub_81D1750 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return 0xd5 ;
}
2018-03-08 00:03:13 +01:00
static u8 sub_81D1754 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return 0xd5 ;
}
2018-03-08 00:03:13 +01:00
bool32 MatchCall_IsRematchable ( u32 idx )
2018-03-02 14:44:33 +01:00
{
match_call_t matchCall ;
2018-03-03 00:12:23 +01:00
u32 i ;
2018-03-02 14:44:33 +01:00
if ( idx > 20 )
return 0 ;
2018-03-08 00:03:13 +01:00
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
return sMatchCall_IsRematchableFunctions [ i ] ( matchCall ) ;
2018-03-02 14:44:33 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 MatchCall_IsRematchable_Type0 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return FALSE ;
}
2018-03-08 00:03:13 +01:00
static bool32 MatchCall_IsRematchable_Type1 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
2018-03-04 23:30:59 +01:00
if ( matchCall . type1 - > rematchTableIdx > = REMATCH_ELITE_FOUR_ENTRIES )
2018-03-02 14:44:33 +01:00
return FALSE ;
2018-03-04 23:30:59 +01:00
return gSaveBlock1Ptr - > trainerRematches [ matchCall . type1 - > rematchTableIdx ] ? TRUE : FALSE ;
2018-03-02 14:44:33 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 MatchCall_IsRematchable_Type2 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
2018-03-04 23:30:59 +01:00
return gSaveBlock1Ptr - > trainerRematches [ matchCall . type2 - > rematchTableIdx ] ? TRUE : FALSE ;
2018-03-02 14:44:33 +01:00
}
2018-03-08 00:03:13 +01:00
static bool32 MatchCall_IsRematchable_Type3 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return FALSE ;
}
2018-03-08 00:03:13 +01:00
static bool32 MatchCall_IsRematchable_Type4 ( match_call_t matchCall )
2018-03-02 14:44:33 +01:00
{
return FALSE ;
}
2018-03-03 00:12:23 +01:00
bool32 sub_81D17E8 ( u32 idx )
{
match_call_t matchCall ;
u32 i ;
if ( idx > 20 )
return FALSE ;
2018-03-08 00:03:13 +01:00
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
2018-03-03 00:12:23 +01:00
if ( gUnknown_08625338 [ i ] ( matchCall ) )
return TRUE ;
for ( i = 0 ; i < 4 ; i + + )
{
2018-03-06 14:52:29 +01:00
if ( sMatchCallCheckPageOverrides [ i ] . idx = = idx )
2018-03-03 00:12:23 +01:00
return TRUE ;
}
return FALSE ;
}
2018-03-08 00:03:13 +01:00
static bool32 sub_81D1840 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
return FALSE ;
}
2018-03-08 00:03:13 +01:00
static bool32 sub_81D1844 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
return TRUE ;
}
2018-03-08 00:03:13 +01:00
static bool32 sub_81D1848 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
return TRUE ;
}
2018-03-08 00:03:13 +01:00
static bool32 sub_81D184C ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
return FALSE ;
}
2018-03-08 00:03:13 +01:00
static bool32 sub_81D1850 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
return FALSE ;
}
2018-03-06 14:52:29 +01:00
u32 MatchCall_GetRematchTableIdx ( u32 idx )
2018-03-03 00:12:23 +01:00
{
match_call_t matchCall ;
u32 i ;
if ( idx > 20 )
2018-03-03 19:22:38 +01:00
return REMATCH_TABLE_ENTRIES ;
2018-03-08 00:03:13 +01:00
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
2018-03-06 14:52:29 +01:00
return sMatchCall_GetRematchTableIdxFunctions [ i ] ( matchCall ) ;
2018-03-03 00:12:23 +01:00
}
2018-03-07 03:51:25 +01:00
static u32 MatchCall_GetRematchTableIdx_Type0 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
2018-03-03 19:22:38 +01:00
return REMATCH_TABLE_ENTRIES ;
2018-03-03 00:12:23 +01:00
}
2018-03-07 03:51:25 +01:00
static u32 MatchCall_GetRematchTableIdx_Type1 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
2018-03-04 23:30:59 +01:00
return matchCall . type1 - > rematchTableIdx ;
2018-03-03 00:12:23 +01:00
}
2018-03-07 03:51:25 +01:00
static u32 MatchCall_GetRematchTableIdx_Type2 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
2018-03-04 23:30:59 +01:00
return matchCall . type2 - > rematchTableIdx ;
2018-03-03 00:12:23 +01:00
}
2018-03-07 03:51:25 +01:00
static u32 MatchCall_GetRematchTableIdx_Type3 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
2018-03-03 19:22:38 +01:00
return REMATCH_TABLE_ENTRIES ;
2018-03-03 00:12:23 +01:00
}
2018-03-06 14:52:29 +01:00
static u32 MatchCall_GetRematchTableIdx_Type4 ( match_call_t matchCall )
2018-03-03 00:12:23 +01:00
{
2018-03-03 19:22:38 +01:00
return REMATCH_TABLE_ENTRIES ;
2018-03-03 00:12:23 +01:00
}
2018-03-03 03:43:18 +01:00
2018-03-04 23:30:59 +01:00
void MatchCall_GetMessage ( u32 idx , u8 * dest )
2018-03-03 03:43:18 +01:00
{
match_call_t matchCall ;
u32 i ;
if ( idx > 20 )
return ;
2018-03-08 00:03:13 +01:00
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
2018-03-06 14:52:29 +01:00
sMatchCall_GetMessageFunctions [ i ] ( matchCall , dest ) ;
2018-03-03 03:43:18 +01:00
}
2018-03-06 14:52:29 +01:00
static void MatchCall_GetMessage_Type0 ( match_call_t matchCall , u8 * dest )
2018-03-03 03:43:18 +01:00
{
2018-03-04 23:30:59 +01:00
sub_81D1920 ( matchCall . type0 - > textData , dest ) ;
2018-03-03 03:43:18 +01:00
}
2018-03-06 14:52:29 +01:00
static void MatchCall_GetMessage_Type1 ( match_call_t matchCall , u8 * dest )
2018-03-03 03:43:18 +01:00
{
if ( matchCall . common - > type ! = 5 )
2018-03-04 23:30:59 +01:00
sub_81D1920 ( matchCall . type5 - > textData , dest ) ;
2018-03-03 03:43:18 +01:00
else
2018-03-04 23:30:59 +01:00
sub_81D199C ( matchCall . type1 - > textData , matchCall . type1 - > rematchTableIdx , dest ) ;
2018-03-03 03:43:18 +01:00
}
2018-03-06 14:52:29 +01:00
static void MatchCall_GetMessage_Type2 ( match_call_t matchCall , u8 * dest )
2018-03-03 03:43:18 +01:00
{
2018-03-04 23:30:59 +01:00
sub_81D1920 ( matchCall . type2 - > textData , dest ) ;
2018-03-03 03:43:18 +01:00
}
2018-03-06 14:52:29 +01:00
static void MatchCall_GetMessage_Type3 ( match_call_t matchCall , u8 * dest )
2018-03-03 03:43:18 +01:00
{
2018-03-04 23:30:59 +01:00
sub_81D1920 ( matchCall . type4 - > textData , dest ) ;
2018-03-03 03:43:18 +01:00
}
2018-03-06 14:52:29 +01:00
static void MatchCall_GetMessage_Type4 ( match_call_t matchCall , u8 * dest )
2018-03-03 03:43:18 +01:00
{
sub_8197080 ( dest ) ;
}
2018-03-03 19:22:38 +01:00
2018-03-08 00:03:13 +01:00
void sub_81D1920 ( const match_call_text_data_t * sub0 , u8 * dest )
2018-03-03 19:22:38 +01:00
{
u32 i ;
for ( i = 0 ; sub0 [ i ] . text ! = NULL ; i + + )
;
if ( i )
i - - ;
while ( i )
{
if ( sub0 [ i ] . flag ! = 0xffff & & FlagGet ( sub0 [ i ] . flag ) = = TRUE )
break ;
i - - ;
}
if ( sub0 [ i ] . flag2 ! = 0xffff )
FlagSet ( sub0 [ i ] . flag2 ) ;
StringExpandPlaceholders ( dest , sub0 [ i ] . text ) ;
}
# ifdef NONMATCHING
// There's some weird upmerge going on that I cannot replicate at this time.
2018-03-08 00:03:13 +01:00
static void sub_81D199C ( const match_call_text_data_t * sub0 , u16 idx , u8 * dest )
2018-03-03 19:22:38 +01:00
{
u32 i ;
for ( i = 0 ; sub0 [ i ] . text ! = NULL ; i + + )
{
if ( sub0 [ i ] . flag = = 0xfffe )
break ;
if ( sub0 [ i ] . flag = = 0xffff & & ! FlagGet ( sub0 [ i ] . flag ) )
break ;
}
if ( sub0 [ i ] . flag ! = 0xfffe )
{
if ( i )
i - - ;
if ( sub0 [ i ] . flag2 ! = 0xffff )
FlagSet ( sub0 [ i ] . flag2 ) ;
StringExpandPlaceholders ( dest , sub0 [ i ] . text ) ;
}
else
{
if ( ! FlagGet ( FLAG_SYS_GAME_CLEAR ) )
;
else if ( gSaveBlock1Ptr - > trainerRematches [ idx ] )
i + = 2 ;
else if ( CountBattledRematchTeams ( idx ) > = 2 )
i + = 3 ;
else
i + + ;
StringExpandPlaceholders ( dest , sub0 [ i ] . text ) ;
}
}
# else
2018-03-08 00:03:13 +01:00
static ASM_DIRECT void sub_81D199C ( const match_call_text_data_t * sub0 , u16 idx , u8 * dest )
2018-03-03 19:22:38 +01:00
{
asm_unified ( " \t push {r4-r7,lr} \n "
" \t mov r7, r10 \n "
" \t mov r6, r9 \n "
" \t mov r5, r8 \n "
" \t push {r5-r7} \n "
" \t adds r6, r0, 0 \n "
" \t mov r10, r2 \n "
" \t lsls r1, 16 \n "
" \t lsrs r7, r1, 16 \n "
" \t movs r5, 0 \n "
" \t ldr r0, [r6] \n "
" \t cmp r0, 0 \n "
" \t beq _081D19E6 \n "
" \t ldrh r0, [r6, 0x4] \n "
" \t ldr r1, =0x0000fffe \n "
" \t cmp r0, r1 \n "
" \t beq _081D1A24 \n "
" \t ldr r0, =0x0000ffff \n "
" \t mov r9, r0 \n "
" \t mov r8, r1 \n "
" \t adds r4, r6, 0 \n "
" _081D19C6: \n "
" \t ldrh r0, [r4, 0x4] \n "
" \t cmp r0, r9 \n "
" \t beq _081D19D6 \n "
" \t bl FlagGet \n "
" \t lsls r0, 24 \n "
" \t cmp r0, 0 \n "
" \t beq _081D19E6 \n "
" _081D19D6: \n "
" \t adds r4, 0x8 \n "
" \t adds r5, 0x1 \n "
" \t ldr r0, [r4] \n "
" \t cmp r0, 0 \n "
" \t beq _081D19E6 \n "
" \t ldrh r0, [r4, 0x4] \n "
" \t cmp r0, r8 \n "
" \t bne _081D19C6 \n "
" _081D19E6: \n "
" \t lsls r0, r5, 3 \n "
" \t adds r0, r6 \n "
" \t ldrh r1, [r0, 0x4] \n "
" \t ldr r0, =0x0000fffe \n "
" \t cmp r1, r0 \n "
" \t beq _081D1A24 \n "
" \t cmp r5, 0 \n "
" \t beq _081D19F8 \n "
" \t subs r5, 0x1 \n "
" _081D19F8: \n "
" \t lsls r0, r5, 3 \n "
" \t adds r4, r0, r6 \n "
" \t ldrh r1, [r4, 0x6] \n "
" \t ldr r0, =0x0000ffff \n "
" \t cmp r1, r0 \n "
" \t beq _081D1A0A \n "
" \t adds r0, r1, 0 \n "
" \t bl FlagSet \n "
" _081D1A0A: \n "
" \t ldr r1, [r4] \n "
" \t mov r0, r10 \n "
" \t bl StringExpandPlaceholders \n "
" \t b _081D1A5C \n "
" \t .pool \n "
" _081D1A1C: \n "
" \t adds r5, 0x2 \n "
" \t b _081D1A50 \n "
" _081D1A20: \n "
" \t adds r5, 0x3 \n "
" \t b _081D1A50 \n "
" _081D1A24: \n "
" \t ldr r0, =0x00000864 \n "
" \t bl FlagGet \n "
" \t lsls r0, 24 \n "
" \t cmp r0, 0 \n "
" \t beq _081D1A50 \n "
" \t ldr r0, =gSaveBlock1Ptr \n "
" \t ldr r0, [r0] \n "
" \t ldr r1, =0x000009ca \n "
" \t adds r0, r1 \n "
" \t adds r0, r7 \n "
" \t ldrb r0, [r0] \n "
" \t cmp r0, 0 \n "
" \t bne _081D1A1C \n "
" \t adds r0, r7, 0 \n "
" \t bl CountBattledRematchTeams \n "
" \t lsls r0, 16 \n "
" \t lsrs r0, 16 \n "
" \t cmp r0, 0x1 \n "
" \t bhi _081D1A20 \n "
" \t adds r5, 0x1 \n "
" _081D1A50: \n "
" \t lsls r0, r5, 3 \n "
" \t adds r0, r6 \n "
" \t ldr r1, [r0] \n "
" \t mov r0, r10 \n "
" \t bl StringExpandPlaceholders \n "
" _081D1A5C: \n "
" \t pop {r3-r5} \n "
" \t mov r8, r3 \n "
" \t mov r9, r4 \n "
" \t mov r10, r5 \n "
" \t pop {r4-r7} \n "
" \t pop {r0} \n "
" \t bx r0 \n "
" \t .pool " ) ;
}
# endif
2018-03-03 19:41:28 +01:00
2018-03-04 23:30:59 +01:00
void sub_81D1A78 ( u32 idx , const u8 * * desc , const u8 * * name )
2018-03-03 19:41:28 +01:00
{
match_call_t matchCall ;
u32 i ;
if ( idx > 20 )
return ;
2018-03-08 00:03:13 +01:00
matchCall = sMatchCallHeaders [ idx ] ;
i = MatchCallGetFunctionIndex ( matchCall ) ;
sMatchCall_GetNameAndDescFunctions [ i ] ( matchCall , desc , name ) ;
2018-03-03 19:41:28 +01:00
}
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDesc_Type0 ( match_call_t matchCall , const u8 * * desc , const u8 * * name )
2018-03-03 19:41:28 +01:00
{
2018-03-04 23:30:59 +01:00
* desc = matchCall . type0 - > desc ;
* name = matchCall . type0 - > name ;
2018-03-03 19:41:28 +01:00
}
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDesc_Type1 ( match_call_t matchCall , const u8 * * desc , const u8 * * name )
2018-03-03 19:41:28 +01:00
{
match_call_t _matchCall = matchCall ;
2018-03-04 23:30:59 +01:00
if ( _matchCall . type1 - > name = = NULL )
2018-03-08 00:03:13 +01:00
MatchCall_GetNameAndDescByRematchIdx ( _matchCall . type1 - > rematchTableIdx , desc , name ) ;
2018-03-03 19:41:28 +01:00
else
2018-03-04 23:30:59 +01:00
* name = _matchCall . type1 - > name ;
* desc = _matchCall . type1 - > desc ;
2018-03-03 19:41:28 +01:00
}
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDesc_Type2 ( match_call_t matchCall , const u8 * * desc , const u8 * * name )
2018-03-03 19:41:28 +01:00
{
2018-03-08 00:03:13 +01:00
MatchCall_GetNameAndDescByRematchIdx ( matchCall . type2 - > rematchTableIdx , desc , name ) ;
2018-03-04 23:30:59 +01:00
* desc = matchCall . type2 - > desc ;
2018-03-03 19:41:28 +01:00
}
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDesc_Type3 ( match_call_t matchCall , const u8 * * desc , const u8 * * name )
2018-03-03 19:41:28 +01:00
{
2018-03-04 23:30:59 +01:00
* desc = matchCall . type4 - > desc ;
* name = matchCall . type4 - > name ;
2018-03-03 19:41:28 +01:00
}
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDesc_Type4 ( match_call_t matchCall , const u8 * * desc , const u8 * * name )
2018-03-03 19:41:28 +01:00
{
2018-03-04 23:30:59 +01:00
* desc = matchCall . type3 - > desc ;
* name = matchCall . type3 - > name ;
2018-03-03 19:41:28 +01:00
}
2018-03-04 21:36:01 +01:00
2018-03-08 00:03:13 +01:00
static void MatchCall_GetNameAndDescByRematchIdx ( u32 idx , const u8 * * desc , const u8 * * name )
2018-03-04 21:36:01 +01:00
{
2018-03-08 00:03:13 +01:00
const struct Trainer * trainer = gTrainers + GetTrainerIdxByRematchIdx ( idx ) ;
2018-03-04 23:30:59 +01:00
* desc = gTrainerClassNames [ trainer - > trainerClass ] ;
* name = trainer - > trainerName ;
2018-03-04 21:36:01 +01:00
}
# ifdef NONMATCHING
const u8 * sub_81D1B40 ( u32 idx , u32 offset )
{
u32 i ;
for ( i = 0 ; i < 4 ; i + + )
{
2018-03-06 14:52:29 +01:00
if ( sMatchCallCheckPageOverrides [ i ] . idx = = idx )
2018-03-04 21:36:01 +01:00
{
2018-03-06 14:52:29 +01:00
for ( ; i + 1 < 4 & & sMatchCallCheckPageOverrides [ i + 1 ] . idx = = idx ; i + + )
2018-03-04 21:36:01 +01:00
{
2018-03-06 14:52:29 +01:00
if ( ! FlagGet ( sMatchCallCheckPageOverrides [ i + 1 ] . v4 ) )
2018-03-04 21:36:01 +01:00
break ;
}
2018-03-06 14:52:29 +01:00
return sMatchCallCheckPageOverrides [ i ] . v8 [ offset ] ;
2018-03-04 21:36:01 +01:00
}
}
return NULL ;
}
# else
ASM_DIRECT const u8 * sub_81D1B40 ( u32 idx , u32 offset )
{
asm_unified ( " \t push {r4-r7,lr} \n "
" \t mov r7, r9 \n "
" \t mov r6, r8 \n "
" \t push {r6,r7} \n "
" \t adds r6, r0, 0 \n "
" \t movs r5, 0 \n "
2018-03-06 14:52:29 +01:00
" \t ldr r2, =sMatchCallCheckPageOverrides \n "
2018-03-04 21:36:01 +01:00
" \t movs r0, 0x8 \n "
" \t adds r0, r2 \n "
" \t mov r9, r0 \n "
" _081D1B54: \n "
" \t lsls r0, r5, 1 \n "
" \t adds r0, r5 \n "
" \t lsls r0, 3 \n "
" \t adds r0, r2 \n "
" \t ldrh r0, [r0] \n "
" \t cmp r0, r6 \n "
" \t bne _081D1BBC \n "
" \t adds r4, r5, 0x1 \n "
" \t lsls r1, 2 \n "
" \t mov r8, r1 \n "
" \t cmp r4, 0x3 \n "
" \t bhi _081D1BA8 \n "
" \t lsls r0, r4, 1 \n "
" \t adds r0, r4 \n "
" \t lsls r0, 3 \n "
" \t adds r0, r2 \n "
" \t ldrh r0, [r0] \n "
" \t cmp r0, r6 \n "
" \t bne _081D1BA8 \n "
2018-03-06 14:52:29 +01:00
" \t ldr r7, =sMatchCallCheckPageOverrides \n "
2018-03-04 21:36:01 +01:00
" _081D1B7C: \n "
" \t lsls r0, r4, 1 \n "
" \t adds r0, r4 \n "
" \t lsls r0, 3 \n "
" \t adds r1, r7, 0x4 \n "
" \t adds r0, r1 \n "
" \t ldrh r0, [r0] \n "
" \t bl FlagGet \n "
" \t lsls r0, 24 \n "
" \t cmp r0, 0 \n "
" \t beq _081D1BA8 \n "
" \t adds r5, r4, 0 \n "
" \t adds r4, r5, 0x1 \n "
" \t cmp r4, 0x3 \n "
" \t bhi _081D1BA8 \n "
" \t lsls r0, r4, 1 \n "
" \t adds r0, r4 \n "
" \t lsls r0, 3 \n "
" \t adds r0, r7 \n "
" \t ldrh r0, [r0] \n "
" \t cmp r0, r6 \n "
" \t beq _081D1B7C \n "
" _081D1BA8: \n "
" \t lsls r0, r5, 1 \n "
" \t adds r0, r5 \n "
" \t lsls r0, 3 \n "
" \t add r0, r8 \n "
" \t add r0, r9 \n "
" \t ldr r0, [r0] \n "
" \t b _081D1BC4 \n "
" \t .pool \n "
" _081D1BBC: \n "
" \t adds r5, 0x1 \n "
" \t cmp r5, 0x3 \n "
" \t bls _081D1B54 \n "
" \t movs r0, 0 \n "
" _081D1BC4: \n "
" \t pop {r3,r4} \n "
" \t mov r8, r3 \n "
" \t mov r9, r4 \n "
" \t pop {r4-r7} \n "
" \t pop {r1} \n "
" \t bx r1 " ) ;
}
# endif
2018-03-04 21:47:54 +01:00
s32 sub_81D1BD0 ( u32 idx )
{
u32 i ;
for ( i = 0 ; i < 4 ; i + + )
{
2018-03-06 14:52:29 +01:00
if ( sMatchCallCheckPageOverrides [ i ] . idx = = idx )
return sMatchCallCheckPageOverrides [ i ] . v2 ;
2018-03-04 21:47:54 +01:00
}
return - 1 ;
}
bool32 sub_81D1BF8 ( u32 idx )
{
s32 i ;
for ( i = 0 ; i < 21 ; i + + )
{
2018-03-06 14:52:29 +01:00
u32 r0 = MatchCall_GetRematchTableIdx ( i ) ;
2018-03-04 21:47:54 +01:00
if ( r0 ! = REMATCH_TABLE_ENTRIES & & r0 = = idx )
return TRUE ;
}
return FALSE ;
}
void SetMatchCallRegisteredFlag ( void )
{
2018-03-08 00:03:13 +01:00
s32 r0 = GetRematchIdxByTrainerIdx ( gSpecialVar_0x8004 ) ;
2018-03-04 21:47:54 +01:00
if ( r0 > = 0 )
FlagSet ( FLAG_MATCH_CALL_REGISTERED + r0 ) ;
}