diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-02-28 22:09:28 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-02-28 22:09:28 -0500 |
commit | 9abc121fa278e7b71ffbfbfa6f151874a5d3f4d9 (patch) | |
tree | 2f54ffc483191596adb50c5eb7728423cda40818 /src | |
parent | 7f7b182ca4430b488e6f6b502a53697154df6b86 (diff) |
through sub_81D16DC
Diffstat (limited to 'src')
-rw-r--r-- | src/match_call.c | 97 |
1 files changed, 95 insertions, 2 deletions
diff --git a/src/match_call.c b/src/match_call.c index d435ea8a6..8267d08be 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -1,20 +1,37 @@ // Includes #include "global.h" +#include "battle_setup.h" +#include "event_data.h" + +#define NELEMS(a) (s32)( sizeof (a) / sizeof (*(a)) ) // Static type declarations +typedef struct { + u8 v0; + u8 v1; + u16 v2; + void *v4; + void *v8; + void *vC; +} match_call_t; + // Static RAM declarations // Static ROM declarations // .rodata +extern const void *const gUnknown_086252A8[]; +extern bool32 (*const gUnknown_086252FC[])(const match_call_t *); +extern bool8 (*const gUnknown_08625310[])(const match_call_t *); + // .text -u32 sub_81D1574(u8 *a) +s32 sub_81D1574(const match_call_t *matchCall) { - switch (*a) + switch (matchCall->v0) { case 0: default: @@ -30,3 +47,79 @@ u32 sub_81D1574(u8 *a) return 4; } } + +s32 sub_81D15BC(s32 rematchIdx) +{ + return gRematchTable[rematchIdx].trainerIds[0]; +} + +s32 sub_81D15CC(s32 trainerIdx) +{ + s32 rematchIdx; + + for (rematchIdx = 0; rematchIdx < NELEMS(gRematchTable); rematchIdx++) + { + if (gRematchTable[rematchIdx].trainerIds[0] == trainerIdx) + return rematchIdx; + } + return -1; +} + +bool32 sub_81D15F4(u32 idx) +{ + const match_call_t *matchCall; + s32 v0; + + if (idx > 20) + return FALSE; + matchCall = gUnknown_086252A8[idx]; + v0 = sub_81D1574(matchCall); + return gUnknown_086252FC[v0](matchCall); +} + +bool32 sub_81D1628(const match_call_t *matchCall) +{ + if (matchCall->v2 == 0xffff) + return TRUE; + return FlagGet(matchCall->v2); +} + +bool32 sub_81D164C(const match_call_t *matchCall) +{ + if (matchCall->v2 == 0xffff) + return TRUE; + return FlagGet(matchCall->v2); +} + +bool32 sub_81D1670(const match_call_t *matchCall) +{ + if (matchCall->v2 == 0xffff) + return TRUE; + return FlagGet(matchCall->v2); +} + +bool32 sub_81D1694(const match_call_t *matchCall) +{ + if (matchCall->v1 != gSaveBlock2Ptr->playerGender) + return FALSE; + if (matchCall->v2 == 0xffff) + return TRUE; + return FlagGet(matchCall->v2); +} + +bool32 sub_81D16CC(const match_call_t *matchCall) +{ + return FlagGet(matchCall->v2); +} + +bool8 sub_81D16DC(u32 idx) +{ + const match_call_t *matchCall; + s32 v0; + + if (idx > 20) + return FALSE; + matchCall = gUnknown_086252A8[idx]; + v0 = sub_81D1574(matchCall); + return gUnknown_08625310[v0](matchCall); +} |