mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Finish decompiling pokenav_unk_4.c
This commit is contained in:
parent
c7954e1212
commit
f9f5f34b0c
1777
asm/pokenav_unk_4.s
1777
asm/pokenav_unk_4.s
File diff suppressed because it is too large
Load Diff
@ -17,5 +17,7 @@ bool32 IsMatchCallTaskActive(void);
|
||||
void StartMatchCallFromScript(u8 *message);
|
||||
void sub_8197080(u8 *destStr);
|
||||
bool32 SelectMatchCallMessage(int, u8 *);
|
||||
void sub_8197184(u32 windowId, u32 destOffset, u32 paletteId);
|
||||
void sub_81971C4(u32 windowId, u32 tileOffset, u32 paletteId);
|
||||
|
||||
#endif //GUARD_MATCH_CALL_H
|
||||
|
@ -57,6 +57,21 @@ u32 GetPokenavMode(void);
|
||||
bool32 CanViewRibbonsMenu(void);
|
||||
|
||||
// pokenav_match_call_ui.c
|
||||
struct MatchCallListTemplate
|
||||
{
|
||||
u32 unk0;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 unkE;
|
||||
void (*unk10)(u32, u8 *a1);
|
||||
void (*unk14)(u16 a0, u32 a1, u32 a2);
|
||||
};
|
||||
u32 GetSelectedMatchCall(void);
|
||||
bool32 sub_81C8224(void);
|
||||
int MatchCall_MoveCursorUp(void);
|
||||
@ -64,6 +79,15 @@ int MatchCall_MoveCursorDown(void);
|
||||
int MatchCall_PageDown(void);
|
||||
int MatchCall_PageUp(void);
|
||||
bool32 sub_81C8630(void);
|
||||
void ToggleMatchCallVerticalArrows(bool32 shouldHide);
|
||||
void sub_81C8838(void);
|
||||
void sub_81C877C(void);
|
||||
bool32 sub_81C8820(void);
|
||||
void sub_81C87AC(s16 a0);
|
||||
u32 GetMatchCallListTopIndex(void);
|
||||
void sub_81C87F0(void);
|
||||
bool32 sub_81C81D4(const struct BgTemplate *arg0, struct MatchCallListTemplate *arg1, s32 arg2);
|
||||
void sub_81C8234(void);
|
||||
|
||||
// pokenav_match_call_data.c
|
||||
bool32 sub_81D17E8(u32 idx);
|
||||
@ -88,6 +112,15 @@ void sub_81C7AC0(int a0);
|
||||
bool32 sub_81C8010(void);
|
||||
void InitBgTemplates(const struct BgTemplate *templates, int count);
|
||||
bool32 IsPaletteFadeActive(void);
|
||||
void sub_81C7BA4(u32 helpBarIndex);
|
||||
bool32 IsDma3ManagerBusyWithBgCopy_(void);
|
||||
void sub_81C78A0(void);
|
||||
bool32 MainMenuLoopedTaskIsBusy(void);
|
||||
void sub_81C7FDC(void);
|
||||
void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5);
|
||||
void sub_81C7B40(void);
|
||||
struct Sprite *PauseSpinningPokenavSprite(void);
|
||||
void ResumeSpinningPokenavSprite(void);
|
||||
|
||||
// pokenav_unk_1.c
|
||||
bool32 sub_81C9298(void);
|
||||
@ -124,14 +157,17 @@ int sub_81CAF04(int index);
|
||||
const u8 *sub_81CAFD8(int index, int textType);
|
||||
u16 sub_81CB01C(void);
|
||||
u16 sub_81CB02C(int arg0);
|
||||
void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str);
|
||||
void sub_81CB050(u32 arg0, u8 *str);
|
||||
int sub_81CB0C8(int rematchIndex);
|
||||
int sub_81CB0E4(int index);
|
||||
bool32 sub_81CAE08(int);
|
||||
int sub_81CB128(int index);
|
||||
|
||||
// pokenav_unk_4.c
|
||||
u32 sub_81CB260(void);
|
||||
void sub_81CB29C(int index);
|
||||
u32 sub_81CB2CC(void);
|
||||
void sub_81CB2E0(void);
|
||||
void sub_81CBD48(u16 windowId, u32 a1);
|
||||
|
||||
#endif //GUARD_POKENAV_H
|
||||
|
@ -2710,5 +2710,9 @@ extern const u8 gText_Exit2[];
|
||||
|
||||
// Pokenav Match Call
|
||||
extern const u8 gText_CallCantBeMadeHere[];
|
||||
extern const u8 gText_NumberRegistered[];
|
||||
extern const u8 gText_NumberOfBattles[];
|
||||
extern const u8 gText_Unknown[];
|
||||
extern const u8 gText_TrainerCloseBy[];
|
||||
|
||||
#endif // GUARD_STRINGS_H
|
||||
|
@ -307,7 +307,6 @@ SECTIONS {
|
||||
asm/pokenav_unk_2.o(.text);
|
||||
src/pokenav_unk_3.o(.text);
|
||||
src/pokenav_unk_4.o(.text);
|
||||
asm/pokenav_unk_4.o(.text);
|
||||
asm/pokenav_unk_5.o(.text);
|
||||
asm/pokenav_unk_6.o(.text);
|
||||
asm/pokenav_unk_7.o(.text);
|
||||
|
@ -2002,7 +2002,7 @@ void sub_8197080(u8 *destStr)
|
||||
Free(buffer);
|
||||
}
|
||||
|
||||
void sub_8197184(u8 windowId, u32 destOffset, u32 paletteId)
|
||||
void sub_8197184(u32 windowId, u32 destOffset, u32 paletteId)
|
||||
{
|
||||
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
|
||||
LoadBgTiles(bg, sUnknown_0860EA6C, 0x100, destOffset);
|
||||
|
@ -31,7 +31,7 @@ struct UnknownPokenavCallbackStruct
|
||||
bool32 (*unk0)(void);
|
||||
u32 (*unk4)(void);
|
||||
u32 (*unk8)(void);
|
||||
u32 (*unkC)(void);
|
||||
void (*unkC)(int);
|
||||
u32 (*unk10)(void);
|
||||
void (*unk14)(void);
|
||||
void (*unk18)(void);
|
||||
@ -39,44 +39,43 @@ struct UnknownPokenavCallbackStruct
|
||||
|
||||
extern u32 sub_81C9924(void);
|
||||
extern u32 sub_81C99C0(void);
|
||||
extern u32 sub_81C9990(void);
|
||||
extern void sub_81C9990(int);
|
||||
extern u32 sub_81C9940(void);
|
||||
extern u32 sub_81CC4D4(void);
|
||||
extern u32 sub_81CC554(void);
|
||||
extern u32 sub_81CC5F4(void);
|
||||
extern u32 sub_81CC62C(void);
|
||||
extern void sub_81CC62C(int);
|
||||
extern u32 sub_81CC65C(void);
|
||||
extern void sub_81CC524(void);
|
||||
extern void sub_81CC670(void);
|
||||
extern u32 sub_81CCFD8(void);
|
||||
extern u32 sub_81CD070(void);
|
||||
extern u32 sub_81CDDD4(void);
|
||||
extern u32 sub_81CDE2C(void);
|
||||
extern void sub_81CDE2C(int);
|
||||
extern u32 sub_81CDE64(void);
|
||||
extern void sub_81CD1C0(void);
|
||||
extern void sub_81CECA0(void);
|
||||
extern u32 sub_81CEF3C(void);
|
||||
extern u32 sub_81CEFDC(void);
|
||||
extern u32 sub_81CF330(void);
|
||||
extern u32 sub_81CF3A0(void);
|
||||
extern void sub_81CF3A0(int);
|
||||
extern u32 sub_81CF3D0(void);
|
||||
extern void sub_81CEFF0(void);
|
||||
extern void sub_81CF3F8(void);
|
||||
extern u32 sub_81CD024(void);
|
||||
extern u32 sub_81CEF98(void);
|
||||
extern u32 sub_81CF368(void);
|
||||
extern u32 sub_81CB29C(void);
|
||||
extern u32 sub_81CF9BC(void);
|
||||
extern u32 sub_81CFA34(void);
|
||||
extern u32 sub_81CFDD0(void);
|
||||
extern u32 sub_81CFE40(void);
|
||||
extern void sub_81CFE40(int);
|
||||
extern u32 sub_81CFE70(void);
|
||||
extern void sub_81CFA48(void);
|
||||
extern void sub_81CFE98(void);
|
||||
extern u32 sub_81D0450(void);
|
||||
extern u32 sub_81D04A0(void);
|
||||
extern u32 sub_81D0978(void);
|
||||
extern u32 sub_81D09B0(void);
|
||||
extern void sub_81D09B0(int);
|
||||
extern u32 sub_81D09E0(void);
|
||||
extern void sub_81D04B8(void);
|
||||
extern void sub_81D09F4(void);
|
||||
|
@ -502,7 +502,7 @@ void sub_81C7990(u32 a0, u16 a1)
|
||||
}
|
||||
|
||||
NAKED
|
||||
void sub_81C79BC(u16 *a0, u16 *a1, u32 a2, u32 a3, u32 a4, u32 a5)
|
||||
void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
|
@ -64,23 +64,6 @@ struct UnknownSubStruct_81C81D4
|
||||
u32 unk8A0;
|
||||
};
|
||||
|
||||
struct MatchCallListTemplate
|
||||
{
|
||||
u32 unk0;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
u8 unkC;
|
||||
u8 unkD;
|
||||
u8 unkE;
|
||||
void (*unk10)(u32, u8 *a1);
|
||||
void (*unk14)(u16 a0, u32 a1, u32 a2);
|
||||
};
|
||||
|
||||
extern void sub_81CBD48(u16 windowId, u32 a1);
|
||||
extern void sub_81DB620(u32 windowId, u32 a1, u32 a2, u32 a3, u32 a4);
|
||||
|
||||
void sub_81C82E4(struct UnknownSubStruct_81C81D4 *a0);
|
||||
@ -648,7 +631,7 @@ void sub_81C877C(void)
|
||||
structPtr->unk8A0 = CreateLoopedTask(LoopedTask_sub_81C8870, 6);
|
||||
}
|
||||
|
||||
void sub_81C87AC(u16 a0)
|
||||
void sub_81C87AC(s16 a0)
|
||||
{
|
||||
u16 temp;
|
||||
struct UnknownSubStruct_81C81D4 *structPtr;
|
||||
|
@ -382,13 +382,14 @@ u16 sub_81CB02C(int arg0)
|
||||
return state->unk4[arg0];
|
||||
}
|
||||
|
||||
void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str)
|
||||
void sub_81CB050(u32 arg0, u8 *str)
|
||||
{
|
||||
struct Pokenav3Struct_Unk1C *var0 = (struct Pokenav3Struct_Unk1C *)arg0;
|
||||
const u8 *trainerName;
|
||||
const u8 *className;
|
||||
if (!arg0->unk0)
|
||||
if (!var0->unk0)
|
||||
{
|
||||
int index = GetTrainerIdxByRematchIdx(arg0->unk2);
|
||||
int index = GetTrainerIdxByRematchIdx(var0->unk2);
|
||||
const struct Trainer *trainer = &gTrainers[index];
|
||||
int class = trainer->trainerClass;
|
||||
className = gTrainerClassNames[class];
|
||||
@ -396,7 +397,7 @@ void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_81D1A78(arg0->unk2, &className, &trainerName);
|
||||
sub_81D1A78(var0->unk2, &className, &trainerName);
|
||||
}
|
||||
|
||||
if (className && trainerName)
|
||||
|
@ -1,41 +1,98 @@
|
||||
#include "global.h"
|
||||
#include "bg.h"
|
||||
#include "data.h"
|
||||
#include "decompress.h"
|
||||
#include "dma3.h"
|
||||
#include "international_string_util.h"
|
||||
#include "main.h"
|
||||
#include "match_call.h"
|
||||
#include "menu.h"
|
||||
#include "overworld.h"
|
||||
#include "palette.h"
|
||||
#include "pokenav.h"
|
||||
#include "region_map.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "task.h"
|
||||
#include "text.h"
|
||||
#include "text_window.h"
|
||||
#include "trig.h"
|
||||
#include "window.h"
|
||||
#include "constants/game_stat.h"
|
||||
#include "constants/region_map_sections.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
struct Pokenav4Struct
|
||||
{
|
||||
u32 (*unk0)(void);
|
||||
u32 unk4;
|
||||
u8 filler8[0x8];
|
||||
u8 unk10;
|
||||
u8 filler11[0x1];
|
||||
u8 unk12;
|
||||
u8 filler13[0x1];
|
||||
u8 unk14;
|
||||
u8 filler15[0x4];
|
||||
u8 filler8[0x6];
|
||||
u8 unkE;
|
||||
u8 unkF;
|
||||
u16 unk10;
|
||||
u16 unk12;
|
||||
u16 unk14;
|
||||
s16 unk16;
|
||||
u8 unused18;
|
||||
u8 unk19;
|
||||
u8 filler1A[0xA];
|
||||
u16 unk1A;
|
||||
struct Sprite *unk1C;
|
||||
struct Sprite *unk20;
|
||||
u8 unk24[0x800];
|
||||
u8 unk824[0x800];
|
||||
u8 unk1024[0x800];
|
||||
u8 unk1824[0x824];
|
||||
u8 *unk1824;
|
||||
u8 unk1828[0x800];
|
||||
u8 unk2028[0x20];
|
||||
};
|
||||
|
||||
static bool32 sub_81CB310(void);
|
||||
static u32 sub_81CB324(int);
|
||||
void sub_81CBC1C(void);
|
||||
void sub_81CC2B4(void);
|
||||
void sub_81CC034(struct Pokenav4Struct *);
|
||||
void sub_81CBBB8(void);
|
||||
void sub_81CBD78(struct Pokenav4Struct *);
|
||||
void sub_81CBDC0(struct Pokenav4Struct *);
|
||||
void sub_81CBEF8(struct Pokenav4Struct *, int);
|
||||
void sub_81CC214(void);
|
||||
void sub_81CBC38(int);
|
||||
static void sub_81CBBB8(void);
|
||||
static void sub_81CBC1C(void);
|
||||
static void sub_81CC2B4(void);
|
||||
static void sub_81CC034(struct Pokenav4Struct *);
|
||||
static void sub_81CBD78(struct Pokenav4Struct *);
|
||||
static void sub_81CBDC0(struct Pokenav4Struct *);
|
||||
static void sub_81CBEF8(struct Pokenav4Struct *, int);
|
||||
static void sub_81CC214(void);
|
||||
static void sub_81CBC38(int);
|
||||
static void sub_81CBF60(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CBFC4(struct Pokenav4Struct *);
|
||||
static void sub_81CC344(struct Pokenav4Struct *, int);
|
||||
static bool32 sub_81CC004(struct Pokenav4Struct *);
|
||||
static void sub_81CBFF0(struct Pokenav4Struct *);
|
||||
static void sub_81CC058(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CC0D0(struct Pokenav4Struct *);
|
||||
static void sub_81CC0E0(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CC104(struct Pokenav4Struct *);
|
||||
static void sub_81CC158(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CC194(struct Pokenav4Struct *);
|
||||
static void sub_81CC09C(struct Pokenav4Struct *);
|
||||
static void sub_81CC11C(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CC140(struct Pokenav4Struct *);
|
||||
static void sub_81CC1DC(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CC204(struct Pokenav4Struct *);
|
||||
static void sub_81CC014(struct Pokenav4Struct *);
|
||||
static void sub_81CC39C(struct Pokenav4Struct *);
|
||||
static bool32 sub_81CC42C(struct Pokenav4Struct *);
|
||||
static void sub_81CC420(struct Pokenav4Struct *);
|
||||
static void sub_81CBC64(u8 taskId);
|
||||
static void sub_81CBCEC(u16 windowId, u32, u32);
|
||||
static void sub_81CBDF4(u16 windowId);
|
||||
static void sub_81CBE0C(u16 windowId);
|
||||
static void sub_81CBE38(u16 windowId);
|
||||
static void sub_81CBE50(u16 windowId);
|
||||
static void sub_81CBE88(u16 windowId, const u8 *str, int top);
|
||||
static void sub_81CBEB4(u16 windowId, const u8 *str, int top);
|
||||
static void sub_81CC2F0(struct Pokenav4Struct *, int);
|
||||
static void sub_81CC330(struct Pokenav4Struct *);
|
||||
static struct Sprite *sub_81CC370(void);
|
||||
static void sub_81CC440(struct Sprite *sprite);
|
||||
static void sub_81CC4A4(struct Sprite *sprite);
|
||||
|
||||
extern const LoopedTask gUnknown_08622798[];
|
||||
extern const struct BgTemplate gUnknown_0862278C[3];
|
||||
@ -46,6 +103,16 @@ extern const u16 gUnknown_08622700[];
|
||||
extern const u16 gUnknown_08622720[];
|
||||
extern const u8 gUnknown_086225D4[];
|
||||
extern const u16 gUnknown_086226E0[];
|
||||
extern const struct BgTemplate gUnknown_08622794;
|
||||
extern const struct WindowTemplate gUnknown_086227D8;
|
||||
extern const struct WindowTemplate gUnknown_086227E0;
|
||||
extern const u8 *const gUnknown_086227E8[];
|
||||
extern const struct WindowTemplate gUnknown_08622808;
|
||||
extern const u8 gUnknown_086227F4[];
|
||||
extern const struct CompressedSpriteSheet gUnknown_08622810[1];
|
||||
extern const struct SpritePalette gUnknown_08622818[];
|
||||
extern const struct SpriteTemplate gUnknown_08622830;
|
||||
extern const struct SpriteTemplate gUnknown_08622850;
|
||||
|
||||
bool32 sub_81CB260(void)
|
||||
{
|
||||
@ -309,3 +376,744 @@ u32 sub_81CB678(int taskState)
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB6F0(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CBF60(state);
|
||||
sub_81C7BA4(7);
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81CBFC4(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB734(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state;
|
||||
u16 var0;
|
||||
|
||||
PlaySE(SE_SELECT);
|
||||
state = GetSubstructPtr(6);
|
||||
var0 = sub_81CB01C();
|
||||
sub_81CC344(state, var0);
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB75C(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CBFF0(state);
|
||||
sub_81C7BA4(6);
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81CC004(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB7A0(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
ToggleMatchCallVerticalArrows(TRUE);
|
||||
sub_81CC058(state);
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81CC0D0(state))
|
||||
return 2;
|
||||
|
||||
sub_81CC0E0(state);
|
||||
PlaySE(SE_TOREEYE);
|
||||
state->unkE = 0;
|
||||
return 0;
|
||||
case 2:
|
||||
if (sub_81CC104(state))
|
||||
return 2;
|
||||
|
||||
sub_81CC158(state);
|
||||
return 0;
|
||||
case 3:
|
||||
if (sub_81CC194(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB824(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CC09C(state);
|
||||
ToggleMatchCallVerticalArrows(TRUE);
|
||||
state->unkE = 1;
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81CC0D0(state))
|
||||
return 2;
|
||||
|
||||
sub_81CC11C(state);
|
||||
return 0;
|
||||
case 2:
|
||||
if (sub_81CC140(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB888(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
u32 result = 0;
|
||||
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
if (!state->unkE)
|
||||
PlaySE(SE_TOREOFF);
|
||||
|
||||
PlaySE(SE_SELECT);
|
||||
break;
|
||||
case 1:
|
||||
sub_81CC1DC(state);
|
||||
break;
|
||||
case 2:
|
||||
if (sub_81CC204(state))
|
||||
result = 2;
|
||||
break;
|
||||
case 3:
|
||||
sub_81CBFF0(state);
|
||||
break;
|
||||
case 4:
|
||||
if (sub_81CC004(state))
|
||||
result = 2;
|
||||
|
||||
sub_81C7BA4(6);
|
||||
break;
|
||||
case 5:
|
||||
if (IsDma3ManagerBusyWithBgCopy_())
|
||||
{
|
||||
result = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state->unkF)
|
||||
{
|
||||
sub_81C8838();
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleMatchCallVerticalArrows(FALSE);
|
||||
result = 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
{
|
||||
result = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleMatchCallVerticalArrows(FALSE);
|
||||
result = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 sub_81CB93C(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81C877C();
|
||||
sub_81CC014(state);
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81C8820() || sub_81CC004(state))
|
||||
return 2;
|
||||
|
||||
sub_81C7BA4(8);
|
||||
return 0;
|
||||
case 2:
|
||||
sub_81C87AC(0);
|
||||
sub_81CC39C(state);
|
||||
return 0;
|
||||
case 3:
|
||||
if (sub_81C8820() || sub_81CC42C(state) || IsDma3ManagerBusyWithBgCopy_())
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CB9C8(int taskState)
|
||||
{
|
||||
int index;
|
||||
int var0;
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
index = GetMatchCallListTopIndex();
|
||||
var0 = sub_81CB0E4(index);
|
||||
if (var0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
state->unk16 = var0;
|
||||
sub_81CC420(state);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sub_81CC42C(state))
|
||||
return 2;
|
||||
|
||||
sub_81CBEF8(state, state->unk16);
|
||||
return 0;
|
||||
case 2:
|
||||
sub_81C87AC(state->unk16);
|
||||
return 0;
|
||||
case 3:
|
||||
sub_81CC39C(state);
|
||||
return 0;
|
||||
case 4:
|
||||
if (sub_81C8820() || sub_81CC42C(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CBA68(int taskState)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CC420(state);
|
||||
sub_81C87F0();
|
||||
return 0;
|
||||
case 1:
|
||||
if (sub_81C8820() || sub_81CC42C(state))
|
||||
return 2;
|
||||
|
||||
sub_81C7BA4(6);
|
||||
sub_81CBDC0(state);
|
||||
return 0;
|
||||
case 2:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CBAD4(int taskState)
|
||||
{
|
||||
int index;
|
||||
int var0;
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
index = GetMatchCallListTopIndex();
|
||||
var0 = sub_81CB128(index);
|
||||
if (var0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
state->unk16 = var0;
|
||||
sub_81CC420(state);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (sub_81CC42C(state))
|
||||
return 2;
|
||||
|
||||
sub_81CBEF8(state, state->unk16);
|
||||
return 0;
|
||||
case 2:
|
||||
sub_81C87AC(state->unk16);
|
||||
return 0;
|
||||
case 3:
|
||||
sub_81CC39C(state);
|
||||
return 0;
|
||||
case 4:
|
||||
if (sub_81C8820() || sub_81CC42C(state))
|
||||
return 2;
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CBB74(int taskState)
|
||||
{
|
||||
switch (taskState)
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81CBC38(0);
|
||||
sub_81C7AC0(0);
|
||||
sub_81C78A0();
|
||||
return 0;
|
||||
case 1:
|
||||
if (IsPaletteFadeActive() || MainMenuLoopedTaskIsBusy())
|
||||
return 2;
|
||||
|
||||
sub_81C7FDC();
|
||||
break;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
static void sub_81CBBB8(void)
|
||||
{
|
||||
struct MatchCallListTemplate template;
|
||||
template.unk0 = (u32)sub_81CAE94();
|
||||
template.unk4 = sub_81CAE38();
|
||||
template.unk8 = 4;
|
||||
template.unk6 = 0;
|
||||
template.unk9 = 13;
|
||||
template.unkA = 16;
|
||||
template.unkB = 1;
|
||||
template.unkC = 8;
|
||||
template.unkD = 3;
|
||||
template.unkE = 7;
|
||||
template.unk10 = sub_81CB050;
|
||||
template.unk14 = sub_81CBCEC;
|
||||
sub_81C81D4(&gUnknown_08622794, &template, 2);
|
||||
CreateTask(sub_81CBC64, 7);
|
||||
}
|
||||
|
||||
static void sub_81CBC1C(void)
|
||||
{
|
||||
sub_81C8234();
|
||||
DestroyTask(FindTaskIdByFunc(sub_81CBC64));
|
||||
}
|
||||
|
||||
static void sub_81CBC38(int arg0)
|
||||
{
|
||||
u8 taskId = FindTaskIdByFunc(sub_81CBC64);
|
||||
if (taskId != 0xFF)
|
||||
gTasks[taskId].data[15] = arg0;
|
||||
}
|
||||
|
||||
static void sub_81CBC64(u8 taskId)
|
||||
{
|
||||
s16 *taskData = gTasks[taskId].data;
|
||||
if (taskData[15])
|
||||
{
|
||||
taskData[0] += 4;
|
||||
taskData[0] &= 0x7F;
|
||||
taskData[1] = gSineTable[taskData[0]] >> 4;
|
||||
sub_81C79BC(gUnknown_08622720, gUnknown_08622720 + 0x10, 0x10, 0x10, taskData[1], gPlttBufferUnfaded + 0x50);
|
||||
if (!gPaletteFade.active)
|
||||
CpuCopy32(gPlttBufferUnfaded + 0x50, gPlttBufferFaded + 0x50, 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CBCEC(u16 windowId, u32 arg1, u32 arg2)
|
||||
{
|
||||
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
|
||||
u16 *tilemap = GetBgTilemapBuffer(bg);
|
||||
tilemap += arg2 * 0x40 + 0x1D;
|
||||
if (sub_81CAEBC(arg1))
|
||||
{
|
||||
tilemap[0] = 0x5000;
|
||||
tilemap[0x20] = 0x5001;
|
||||
}
|
||||
else
|
||||
{
|
||||
tilemap[0] = 0x5002;
|
||||
tilemap[0x20] = 0x5002;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81CBD48(u16 windowId, u32 arg0)
|
||||
{
|
||||
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
|
||||
u16 *tilemap = GetBgTilemapBuffer(bg);
|
||||
tilemap += arg0 * 0x40 + 0x1D;
|
||||
tilemap[0] = 0x5002;
|
||||
tilemap[0x20] = 0x5002;
|
||||
}
|
||||
|
||||
static void sub_81CBD78(struct Pokenav4Struct *state)
|
||||
{
|
||||
state->unk10 = AddWindow(&gUnknown_086227D8);
|
||||
state->unk12 = AddWindow(&gUnknown_086227E0);
|
||||
FillWindowPixelBuffer(state->unk10, PIXEL_FILL(1));
|
||||
PutWindowTilemap(state->unk10);
|
||||
FillWindowPixelBuffer(state->unk12, PIXEL_FILL(1));
|
||||
PutWindowTilemap(state->unk12);
|
||||
CopyWindowToVram(state->unk10, 1);
|
||||
}
|
||||
|
||||
static void sub_81CBDC0(struct Pokenav4Struct *state)
|
||||
{
|
||||
FillWindowPixelBuffer(state->unk12, PIXEL_FILL(1));
|
||||
sub_81CBDF4(state->unk12);
|
||||
sub_81CBE0C(state->unk12);
|
||||
sub_81CBE38(state->unk12);
|
||||
sub_81CBE50(state->unk12);
|
||||
CopyWindowToVram(state->unk12, 2);
|
||||
}
|
||||
|
||||
static void sub_81CBDF4(u16 windowId)
|
||||
{
|
||||
sub_81CBE88(windowId, gText_NumberRegistered, 0);
|
||||
}
|
||||
|
||||
static void sub_81CBE0C(u16 windowId)
|
||||
{
|
||||
u8 str[3];
|
||||
ConvertIntToDecimalStringN(str, sub_81CAE38(), STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
sub_81CBEB4(windowId, str, 1);
|
||||
}
|
||||
|
||||
static void sub_81CBE38(u16 windowId)
|
||||
{
|
||||
sub_81CBE88(windowId, gText_NumberOfBattles, 2);
|
||||
}
|
||||
|
||||
static void sub_81CBE50(u16 windowId)
|
||||
{
|
||||
u8 str[5];
|
||||
int numTrainerBattles = GetGameStat(GAME_STAT_TRAINER_BATTLES);
|
||||
if (numTrainerBattles > 99999)
|
||||
numTrainerBattles = 99999;
|
||||
|
||||
ConvertIntToDecimalStringN(str, numTrainerBattles, STR_CONV_MODE_LEFT_ALIGN, 5);
|
||||
sub_81CBEB4(windowId, str, 3);
|
||||
}
|
||||
|
||||
static void sub_81CBE88(u16 windowId, const u8 *str, int top)
|
||||
{
|
||||
int y = top * 16 + 1;
|
||||
AddTextPrinterParameterized(windowId, 7, str, 2, y, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
|
||||
static void sub_81CBEB4(u16 windowId, const u8 *str, int top)
|
||||
{
|
||||
int x = GetStringRightAlignXOffset(7, str, 86);
|
||||
int y = top * 16 + 1;
|
||||
AddTextPrinterParameterized(windowId, 7, str, x, y, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
|
||||
static void sub_81CBEF8(struct Pokenav4Struct *state, int arg1)
|
||||
{
|
||||
u8 mapName[32];
|
||||
int x;
|
||||
int index = GetSelectedMatchCall() + arg1;
|
||||
int regionMapSection = sub_81CAEA4(index);
|
||||
if (regionMapSection != MAPSEC_NONE)
|
||||
GetMapName(mapName, regionMapSection, 0);
|
||||
else
|
||||
StringCopy(mapName, gText_Unknown);
|
||||
|
||||
x = GetStringCenterAlignXOffset(7, mapName, 88);
|
||||
FillWindowPixelBuffer(state->unk10, PIXEL_FILL(1));
|
||||
AddTextPrinterParameterized(state->unk10, 7, mapName, x, 1, 0, NULL);
|
||||
}
|
||||
|
||||
static void sub_81CBF60(struct Pokenav4Struct *state)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
FillWindowPixelBuffer(state->unk12, PIXEL_FILL(1));
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
int messageId = sub_81CB02C(i);
|
||||
if (messageId == 3)
|
||||
break;
|
||||
|
||||
AddTextPrinterParameterized(state->unk12, 7, gUnknown_086227E8[messageId], 16, i * 16 + 1, TEXT_SPEED_FF, NULL);
|
||||
}
|
||||
|
||||
CopyWindowToVram(state->unk12, 2);
|
||||
}
|
||||
|
||||
static bool32 sub_81CBFC4(struct Pokenav4Struct *state)
|
||||
{
|
||||
if (!IsDma3ManagerBusyWithBgCopy())
|
||||
{
|
||||
sub_81CC2F0(state, sub_81CB01C());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void sub_81CBFF0(struct Pokenav4Struct *state)
|
||||
{
|
||||
sub_81CC330(state);
|
||||
sub_81CBDC0(state);
|
||||
}
|
||||
|
||||
static bool32 sub_81CC004(struct Pokenav4Struct *state)
|
||||
{
|
||||
return IsDma3ManagerBusyWithBgCopy();
|
||||
}
|
||||
|
||||
static void sub_81CC014(struct Pokenav4Struct *state)
|
||||
{
|
||||
sub_81CC330(state);
|
||||
FillWindowPixelBuffer(state->unk12, PIXEL_FILL(1));
|
||||
CopyWindowToVram(state->unk12, 2);
|
||||
}
|
||||
|
||||
static void sub_81CC034(struct Pokenav4Struct *state)
|
||||
{
|
||||
state->unk14 = AddWindow(&gUnknown_08622808);
|
||||
sub_8197184(state->unk14, 1, 4);
|
||||
sub_81C7B40();
|
||||
}
|
||||
|
||||
static void sub_81CC058(struct Pokenav4Struct *state)
|
||||
{
|
||||
struct Sprite *sprite;
|
||||
sub_8197184(state->unk14, 1, 4);
|
||||
sub_81971C4(state->unk14, 1, 4);
|
||||
FillWindowPixelBuffer(state->unk14, PIXEL_FILL(1));
|
||||
PutWindowTilemap(state->unk14);
|
||||
CopyWindowToVram(state->unk14, 3);
|
||||
sprite = PauseSpinningPokenavSprite();
|
||||
sprite->pos1.x = 24;
|
||||
sprite->pos1.y = 112;
|
||||
sprite->pos2.y = 0;
|
||||
}
|
||||
|
||||
static void sub_81CC09C(struct Pokenav4Struct *state)
|
||||
{
|
||||
LoadUserWindowBorderGfx(state->unk14, 1, 0x40);
|
||||
DrawTextBorderOuter(state->unk14, 1, 4);
|
||||
FillWindowPixelBuffer(state->unk14, PIXEL_FILL(1));
|
||||
PutWindowTilemap(state->unk14);
|
||||
CopyWindowToVram(state->unk14, 3);
|
||||
}
|
||||
|
||||
static bool32 sub_81CC0D0(struct Pokenav4Struct *state)
|
||||
{
|
||||
return IsDma3ManagerBusyWithBgCopy();
|
||||
}
|
||||
|
||||
static void sub_81CC0E0(struct Pokenav4Struct *state)
|
||||
{
|
||||
AddTextPrinterParameterized(state->unk14, 1, gUnknown_086227F4, 32, 1, 1, NULL);
|
||||
}
|
||||
|
||||
static bool32 sub_81CC104(struct Pokenav4Struct *state)
|
||||
{
|
||||
RunTextPrinters();
|
||||
return IsTextPrinterActive(state->unk14);
|
||||
}
|
||||
|
||||
static void sub_81CC11C(struct Pokenav4Struct *state)
|
||||
{
|
||||
AddTextPrinterParameterized(state->unk14, 1, gText_TrainerCloseBy, 0, 1, 1, NULL);
|
||||
}
|
||||
|
||||
static bool32 sub_81CC140(struct Pokenav4Struct *state)
|
||||
{
|
||||
RunTextPrinters();
|
||||
return IsTextPrinterActive(state->unk14);
|
||||
}
|
||||
|
||||
static void sub_81CC158(struct Pokenav4Struct *state)
|
||||
{
|
||||
int index = GetSelectedMatchCall();
|
||||
const u8 *str = sub_81CAF78(index, &state->unkF);
|
||||
u8 speed = GetPlayerTextSpeedDelay();
|
||||
AddTextPrinterParameterized(state->unk14, 1, str, 32, 1, speed, NULL);
|
||||
}
|
||||
|
||||
static bool32 sub_81CC194(struct Pokenav4Struct *state)
|
||||
{
|
||||
if (gMain.heldKeys & A_BUTTON)
|
||||
gTextFlags.canABSpeedUpPrint = 1;
|
||||
else
|
||||
gTextFlags.canABSpeedUpPrint = 0;
|
||||
|
||||
RunTextPrinters();
|
||||
return IsTextPrinterActive(state->unk14);
|
||||
}
|
||||
|
||||
static void sub_81CC1DC(struct Pokenav4Struct *state)
|
||||
{
|
||||
ResumeSpinningPokenavSprite();
|
||||
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
}
|
||||
|
||||
static bool32 sub_81CC204(struct Pokenav4Struct *state)
|
||||
{
|
||||
return IsDma3ManagerBusyWithBgCopy();
|
||||
}
|
||||
|
||||
static void sub_81CC214(void)
|
||||
{
|
||||
int i;
|
||||
u8 paletteNum;
|
||||
struct SpriteSheet spriteSheet;
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gUnknown_08622810); i++)
|
||||
LoadCompressedSpriteSheet(&gUnknown_08622810[i]);
|
||||
|
||||
Pokenav_AllocAndLoadPalettes(gUnknown_08622818);
|
||||
state->unk1C = NULL;
|
||||
spriteSheet.data = state->unk1828;
|
||||
spriteSheet.size = 0x800;
|
||||
spriteSheet.tag = 8;
|
||||
state->unk1824 = (u8 *)OBJ_VRAM0 + LoadSpriteSheet(&spriteSheet) * 0x20;
|
||||
paletteNum = AllocSpritePalette(13);
|
||||
state->unk1A = 0x100 + paletteNum * 0x10;
|
||||
state->unk20 = sub_81CC370();
|
||||
state->unk20->invisible = 1;
|
||||
}
|
||||
|
||||
static void sub_81CC2B4(void)
|
||||
{
|
||||
struct Pokenav4Struct *state = GetSubstructPtr(6);
|
||||
if (state->unk1C)
|
||||
DestroySprite(state->unk1C);
|
||||
if (state->unk20)
|
||||
DestroySprite(state->unk20);
|
||||
|
||||
FreeSpriteTilesByTag(8);
|
||||
FreeSpriteTilesByTag(7);
|
||||
FreeSpritePaletteByTag(12);
|
||||
FreeSpritePaletteByTag(13);
|
||||
}
|
||||
|
||||
static void sub_81CC2F0(struct Pokenav4Struct *state, int top)
|
||||
{
|
||||
if (!state->unk1C)
|
||||
{
|
||||
u8 spriteId = CreateSprite(&gUnknown_08622830, 4, 80, 5);
|
||||
state->unk1C = &gSprites[spriteId];
|
||||
sub_81CC344(state, top);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CC330(struct Pokenav4Struct *state)
|
||||
{
|
||||
DestroySprite(state->unk1C);
|
||||
state->unk1C = NULL;
|
||||
}
|
||||
|
||||
static void sub_81CC344(struct Pokenav4Struct *state, int top)
|
||||
{
|
||||
state->unk1C->pos2.y = top * 16;
|
||||
}
|
||||
|
||||
void sub_81CC34C(struct Sprite *sprite)
|
||||
{
|
||||
if (++sprite->data[0] > 3)
|
||||
{
|
||||
sprite->data[0] = 0;
|
||||
sprite->pos2.x = (sprite->pos2.x + 1) & 0x7;
|
||||
}
|
||||
}
|
||||
|
||||
static struct Sprite *sub_81CC370(void)
|
||||
{
|
||||
u8 spriteId = CreateSprite(&gUnknown_08622850, 44, 104, 6);
|
||||
return &gSprites[spriteId];
|
||||
}
|
||||
|
||||
static void sub_81CC39C(struct Pokenav4Struct *state)
|
||||
{
|
||||
u16 cursor;
|
||||
int trainerId = sub_81CAF04(GetSelectedMatchCall());
|
||||
if (trainerId >= 0)
|
||||
{
|
||||
DecompressPicFromTable(&gTrainerFrontPicTable[trainerId], state->unk1828, SPECIES_NONE);
|
||||
LZ77UnCompWram(gTrainerFrontPicPaletteTable[trainerId].data, state->unk2028);
|
||||
cursor = RequestDma3Copy(state->unk1828, state->unk1824, 0x800, 1);
|
||||
LoadPalette(state->unk2028, state->unk1A, 0x20);
|
||||
state->unk20->data[0] = 0;
|
||||
state->unk20->data[7] = cursor;
|
||||
state->unk20->callback = sub_81CC440;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CC420(struct Pokenav4Struct *state)
|
||||
{
|
||||
state->unk20->callback = sub_81CC4A4;
|
||||
}
|
||||
|
||||
static bool32 sub_81CC42C(struct Pokenav4Struct *state)
|
||||
{
|
||||
return state->unk20->callback != SpriteCallbackDummy;
|
||||
}
|
||||
|
||||
static void sub_81CC440(struct Sprite *sprite)
|
||||
{
|
||||
switch (sprite->data[0])
|
||||
{
|
||||
case 0:
|
||||
if (CheckForSpaceForDma3Request(sprite->data[7]) != -1)
|
||||
{
|
||||
sprite->pos2.x = -80;
|
||||
sprite->invisible = 0;
|
||||
sprite->data[0]++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sprite->pos2.x += 8;
|
||||
if (sprite->pos2.x >= 0)
|
||||
{
|
||||
sprite->pos2.x = 0;
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81CC4A4(struct Sprite *sprite)
|
||||
{
|
||||
sprite->pos2.x -= 8;
|
||||
if (sprite->pos2.x <= -80)
|
||||
{
|
||||
sprite->invisible = 1;
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user