2019-04-07 20:40:35 +02:00
|
|
|
#include "global.h"
|
|
|
|
#include "pokenav.h"
|
|
|
|
#include "window.h"
|
|
|
|
#include "strings.h"
|
|
|
|
#include "text.h"
|
|
|
|
#include "bg.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "decompress.h"
|
|
|
|
|
2020-02-05 08:47:32 +01:00
|
|
|
// TODO: This UI isnt just for match call, seems to be the general pokenav list UI
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavListMenuWindow {
|
2019-04-07 20:40:35 +02:00
|
|
|
u8 bg;
|
|
|
|
u8 unk1;
|
|
|
|
u8 unk2;
|
|
|
|
u8 unk3;
|
|
|
|
u8 unk4;
|
|
|
|
u8 fontId;
|
|
|
|
u16 unk6;
|
|
|
|
u16 windowId;
|
|
|
|
u16 unkA;
|
|
|
|
u16 unkC;
|
|
|
|
u16 unkE;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MatchCallWindowState {
|
|
|
|
// The index of the element at the top of the window.
|
|
|
|
u16 windowTopIndex;
|
|
|
|
u16 listLength;
|
|
|
|
u16 unk4;
|
|
|
|
// The index of the cursor, relative to the top of the window.
|
|
|
|
u16 selectedIndexOffset;
|
|
|
|
u16 visibleEntries;
|
|
|
|
u16 unkA;
|
|
|
|
u32 unkC;
|
2019-08-05 19:47:04 +02:00
|
|
|
void * unk10;
|
2019-04-07 20:40:35 +02:00
|
|
|
};
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
struct PokenavSub17Substruct
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavListMenuWindow listWindow;
|
2019-04-07 20:40:35 +02:00
|
|
|
u32 unk10;
|
|
|
|
u32 unk14;
|
|
|
|
u32 unk18;
|
2019-08-05 19:47:04 +02:00
|
|
|
void * unk1C;
|
2019-04-07 20:40:35 +02:00
|
|
|
s32 unk20;
|
|
|
|
s32 unk24;
|
2020-10-11 00:17:34 +02:00
|
|
|
u32 loopedTaskId;
|
2019-04-07 20:40:35 +02:00
|
|
|
s32 unk2C;
|
|
|
|
u32 unk30;
|
2019-12-15 16:25:47 +01:00
|
|
|
void (*unk34)(struct PokenavMatchCallEntries *, u8*);
|
2019-04-07 20:40:35 +02:00
|
|
|
void (*unk38)(u16, u32, u32);
|
|
|
|
struct Sprite *rightArrow;
|
|
|
|
struct Sprite *upArrow;
|
|
|
|
struct Sprite *downArrow;
|
|
|
|
u8 unkTextBuffer[0x40];
|
|
|
|
};
|
|
|
|
|
|
|
|
// Generally at index 0x11 (17)
|
2019-08-04 19:09:12 +02:00
|
|
|
struct PokenavSub17
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17Substruct list;
|
2019-04-07 20:40:35 +02:00
|
|
|
u8 tilemapBuffer[0x800];
|
|
|
|
struct MatchCallWindowState unk888;
|
2019-08-04 19:09:12 +02:00
|
|
|
s32 unk89C;
|
2020-10-11 00:17:34 +02:00
|
|
|
u32 loopedTaskId;
|
2019-04-07 20:40:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern void sub_81DB620(u32 windowId, u32 a1, u32 a2, u32 a3, u32 a4);
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C82E4(struct PokenavSub17 *matchCall);
|
|
|
|
bool32 CopyPokenavListMenuTemplate(struct PokenavSub17Substruct *a0, const struct BgTemplate *a1, struct PokenavListTemplate *a2, s32 a3);
|
|
|
|
void InitMatchCallWindowState(struct MatchCallWindowState *a0, struct PokenavListTemplate *a1);
|
2019-04-07 20:40:35 +02:00
|
|
|
void SpriteCB_MatchCallUpArrow(struct Sprite *sprite);
|
|
|
|
void SpriteCB_MatchCallDownArrow(struct Sprite *sprite);
|
|
|
|
void SpriteCB_MatchCallRightArrow(struct Sprite *sprite);
|
2019-08-04 19:09:12 +02:00
|
|
|
void ToggleMatchCallArrows(struct PokenavSub17Substruct *a0, u32 a1);
|
2020-10-11 00:17:34 +02:00
|
|
|
void DestroyMatchCallListArrows(struct PokenavSub17Substruct *a0);
|
|
|
|
void CreateMatchCallArrowSprites(struct MatchCallWindowState *a0, struct PokenavSub17Substruct *a1);
|
2019-04-07 20:40:35 +02:00
|
|
|
void sub_81C8ED0(void);
|
2019-12-05 21:33:36 +01:00
|
|
|
static void PrintMatchCallFlavorText(struct MatchCallWindowState *a0, struct PokenavSub17Substruct *a1, u32 a2);
|
2019-08-04 19:09:12 +02:00
|
|
|
void PrintMatchCallFieldNames(struct PokenavSub17Substruct *a0, u32 a1);
|
|
|
|
void sub_81C8D4C(struct MatchCallWindowState *a0, struct PokenavSub17Substruct *a1);
|
|
|
|
void sub_81C8CB4(struct MatchCallWindowState *a0, struct PokenavSub17Substruct *a1);
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C8B70(struct PokenavListMenuWindow *a0, s32 a1, s32 a2);
|
2019-08-04 19:09:12 +02:00
|
|
|
void sub_81C8568(s32 a0, struct PokenavSub17Substruct *a1);
|
2019-08-05 19:47:04 +02:00
|
|
|
void sub_81C83AC(void * a0, u32 a1, u32 a2, u32 a3, u32 a4, struct PokenavSub17Substruct *a5);
|
2019-08-04 19:09:12 +02:00
|
|
|
void sub_81C837C(struct MatchCallWindowState *a0, struct PokenavSub17Substruct *a1);
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C835C(struct PokenavListMenuWindow *a0);
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C8254(s32 state);
|
2019-04-07 20:40:35 +02:00
|
|
|
bool32 sub_81C83E0(void);
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C83F0(s32 state);
|
|
|
|
u32 LoopedTask_sub_81C85A0(s32 state);
|
|
|
|
u32 LoopedTask_sub_81C8870(s32 state);
|
|
|
|
u32 LoopedTask_sub_81C8A28(s32 state);
|
2019-12-07 10:08:21 +01:00
|
|
|
u32 LoopedTask_PrintCheckPageInfo(s32 state);
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
static const u16 sMatchcallArrowPaletteData[] = INCBIN_U16("graphics/pokenav/arrows_matchcall.gbapal");
|
|
|
|
static const u32 sMatchcallArrowSpriteSheetData[] = INCBIN_U32("graphics/pokenav/arrows_matchcall.4bpp.lz");
|
|
|
|
|
|
|
|
EWRAM_DATA u32 gUnknown_0203CF44 = 0;
|
|
|
|
|
2019-12-15 16:25:47 +01:00
|
|
|
bool32 sub_81C81D4(const struct BgTemplate *arg0, struct PokenavListTemplate *arg1, s32 arg2)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_MATCH_CALL_LIST, sizeof(struct PokenavSub17));
|
2019-04-07 20:40:35 +02:00
|
|
|
if (structPtr == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
InitMatchCallWindowState(&structPtr->unk888, arg1);
|
|
|
|
if (!CopyPokenavListMenuTemplate(&structPtr->list, arg0, arg1, arg2))
|
2019-04-07 20:40:35 +02:00
|
|
|
return FALSE;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
CreateLoopedTask(LoopedTask_sub_81C8254, 6);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool32 sub_81C8224(void)
|
|
|
|
{
|
|
|
|
return FuncIsActiveLoopedTask(LoopedTask_sub_81C8254);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C8234(void)
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct PokenavSub17 *structPtr;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
|
|
|
DestroyMatchCallListArrows(&structPtr->list);
|
|
|
|
RemoveWindow(structPtr->list.listWindow.windowId);
|
|
|
|
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C8254(s32 state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct PokenavSub17 *structPtr;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
if (IsDma3ManagerBusyWithBgCopy())
|
2020-10-11 00:17:34 +02:00
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-08-04 19:09:12 +02:00
|
|
|
|
|
|
|
switch (state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
case 0:
|
|
|
|
sub_81C82E4(structPtr);
|
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
case 1:
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C835C(&structPtr->list.listWindow);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
case 2:
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C837C(&structPtr->unk888, &structPtr->list);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
case 3:
|
|
|
|
if (sub_81C83E0())
|
|
|
|
{
|
|
|
|
return LT_PAUSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sub_81C8ED0();
|
|
|
|
return LT_INC_AND_CONTINUE;
|
|
|
|
}
|
|
|
|
case 4:
|
2020-10-11 00:17:34 +02:00
|
|
|
CreateMatchCallArrowSprites(&structPtr->unk888, &structPtr->list);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
|
|
|
default:
|
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C82E4(struct PokenavSub17 *matchCall)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
u16 tileNum = (matchCall->list.listWindow.unk1 << 12) | matchCall->list.listWindow.unk6;
|
|
|
|
sub_8199DF0(matchCall->list.listWindow.bg, PIXEL_FILL(1), matchCall->list.listWindow.unk6, 1);
|
|
|
|
sub_8199DF0(matchCall->list.listWindow.bg, PIXEL_FILL(4), matchCall->list.listWindow.unk6 + 1, 1);
|
|
|
|
SetBgTilemapBuffer(matchCall->list.listWindow.bg, matchCall->tilemapBuffer);
|
|
|
|
FillBgTilemapBufferRect_Palette0(matchCall->list.listWindow.bg, tileNum, 0, 0, 32, 32);
|
|
|
|
ChangeBgY(matchCall->list.listWindow.bg, 0, 0);
|
|
|
|
ChangeBgX(matchCall->list.listWindow.bg, 0, 0);
|
|
|
|
ChangeBgY(matchCall->list.listWindow.bg, matchCall->list.listWindow.unk3 << 11, 2);
|
|
|
|
CopyBgTilemapBufferToVram(matchCall->list.listWindow.bg);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C835C(struct PokenavListMenuWindow *listWindow)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
FillWindowPixelBuffer(listWindow->windowId, PIXEL_FILL(1));
|
|
|
|
PutWindowTilemap(listWindow->windowId);
|
|
|
|
CopyWindowToVram(listWindow->windowId, 1);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C837C(struct MatchCallWindowState *state, struct PokenavSub17Substruct *a1)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
s32 arg2 = state->listLength - state->windowTopIndex;
|
|
|
|
if (arg2 > state->visibleEntries)
|
|
|
|
arg2 = state->visibleEntries;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C83AC(state->unk10, state->windowTopIndex, arg2, state->unkC, 0, a1);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C83AC(void * a0, u32 a1, u32 a2, u32 a3, u32 a4, struct PokenavSub17Substruct *list)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
if (a2 == 0)
|
|
|
|
return;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
list->unk1C = a0 + a1 * a3;
|
|
|
|
list->unk18 = a3;
|
|
|
|
list->listWindow.unkC = 0;
|
|
|
|
list->listWindow.unkE = a2;
|
|
|
|
list->unk14 = a1;
|
|
|
|
list->unk10 = a4;
|
2019-04-07 20:40:35 +02:00
|
|
|
CreateLoopedTask(LoopedTask_sub_81C83F0, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool32 sub_81C83E0(void)
|
|
|
|
{
|
|
|
|
return FuncIsActiveLoopedTask(LoopedTask_sub_81C83F0);
|
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C83F0(s32 state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
u32 v1;
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17Substruct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
switch (state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
case 0:
|
2020-10-11 00:17:34 +02:00
|
|
|
v1 = (structPtr->listWindow.unkA + structPtr->listWindow.unkC + structPtr->unk10) & 0xF;
|
2019-04-07 20:40:35 +02:00
|
|
|
structPtr->unk34(structPtr->unk1C, structPtr->unkTextBuffer);
|
|
|
|
if (structPtr->unk38 != NULL)
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr->unk38(structPtr->listWindow.windowId, structPtr->unk14, v1);
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
AddTextPrinterParameterized(structPtr->listWindow.windowId, structPtr->listWindow.fontId, structPtr->unkTextBuffer, 8, (v1 << 4) + 1, 255, NULL);
|
|
|
|
if (++structPtr->listWindow.unkC >= structPtr->listWindow.unkE)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
if (structPtr->unk38 != NULL)
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowToVram(structPtr->listWindow.windowId, 3);
|
2019-04-07 20:40:35 +02:00
|
|
|
else
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowToVram(structPtr->listWindow.windowId, 2);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
structPtr->unk1C += structPtr->unk18;
|
|
|
|
structPtr->unk14++;
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_CONTINUE;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
if (IsDma3ManagerBusyWithBgCopy())
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool32 ShouldShowUpArrow(void)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
return (structPtr->unk888.windowTopIndex != 0);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool32 ShouldShowDownArrow(void)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *subPtr = &structPtr->unk888;
|
|
|
|
|
|
|
|
return (subPtr->windowTopIndex + subPtr->visibleEntries < subPtr->listLength);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
void MatchCall_MoveWindow(s32 a0, bool32 a1)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *subPtr = &structPtr->unk888;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
if (a0 < 0)
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
if (subPtr->windowTopIndex + a0 < 0)
|
|
|
|
a0 = -1 * subPtr->windowTopIndex;
|
2019-04-07 20:40:35 +02:00
|
|
|
if (a1)
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C83AC(subPtr->unk10, subPtr->windowTopIndex + a0, a0 * -1, subPtr->unkC, a0, &structPtr->list);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else if (a1)
|
|
|
|
{
|
2019-04-08 02:09:53 +02:00
|
|
|
s32 temp = gUnknown_0203CF44 = subPtr->windowTopIndex + subPtr->visibleEntries;
|
2019-08-04 19:09:12 +02:00
|
|
|
if (temp + a0 >= subPtr->listLength)
|
|
|
|
a0 = subPtr->listLength - temp;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C83AC(subPtr->unk10, gUnknown_0203CF44, a0, subPtr->unkC, subPtr->visibleEntries, &structPtr->list);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8568(a0, &structPtr->list);
|
2019-08-04 19:09:12 +02:00
|
|
|
subPtr->windowTopIndex += a0;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C8568(s32 a0, struct PokenavSub17Substruct *list)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
list->unk20 = GetBgY(list->listWindow.bg);
|
|
|
|
list->unk24 = list->unk20 + (a0 << 12);
|
2019-04-07 20:40:35 +02:00
|
|
|
if (a0 > 0)
|
2020-10-11 00:17:34 +02:00
|
|
|
list->unk30 = 1;
|
2019-04-07 20:40:35 +02:00
|
|
|
else
|
2020-10-11 00:17:34 +02:00
|
|
|
list->unk30 = 2;
|
|
|
|
list->unk2C = a0;
|
|
|
|
list->loopedTaskId = CreateLoopedTask(LoopedTask_sub_81C85A0, 6);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C85A0(s32 state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
s32 y, v1;
|
2019-04-07 20:40:35 +02:00
|
|
|
bool32 flag;
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
|
|
|
struct PokenavSub17Substruct *subPtr = &structPtr->list;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
|
|
|
switch (state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
case 0:
|
2019-08-04 19:09:12 +02:00
|
|
|
if (!sub_81C83E0())
|
|
|
|
return LT_INC_AND_CONTINUE;
|
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 1:
|
|
|
|
flag = FALSE;
|
2020-10-11 00:17:34 +02:00
|
|
|
y = GetBgY(subPtr->listWindow.bg);
|
|
|
|
v1 = ChangeBgY(subPtr->listWindow.bg, 0x1000, subPtr->unk30);
|
2019-08-04 19:09:12 +02:00
|
|
|
if (subPtr->unk30 == 2)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
if ((y > subPtr->unk24 || y <= subPtr->unk20) && v1 <= subPtr->unk24)
|
2019-04-07 20:40:35 +02:00
|
|
|
flag = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
if ((y < subPtr->unk24 || y >= subPtr->unk20) && v1 >= subPtr->unk24)
|
2019-04-07 20:40:35 +02:00
|
|
|
flag = TRUE;
|
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
if (flag)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
subPtr->listWindow.unkA = (subPtr->listWindow.unkA + subPtr->unk2C) & 0xF;
|
|
|
|
ChangeBgY(subPtr->listWindow.bg, subPtr->unk24, 0);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
bool32 IsMonListLoopedTaskActive(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
|
|
|
return IsLoopedTaskActive(structPtr->list.loopedTaskId);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
struct MatchCallWindowState *GetMatchCallWindowStruct(void)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
return &structPtr->unk888;
|
|
|
|
}
|
|
|
|
|
2019-04-16 02:24:32 +02:00
|
|
|
int MatchCall_MoveCursorUp(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *structPtr = GetMatchCallWindowStruct();
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
if (structPtr->selectedIndexOffset != 0)
|
|
|
|
{
|
|
|
|
structPtr->selectedIndexOffset--;
|
|
|
|
return 1;
|
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
if (ShouldShowUpArrow())
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
MatchCall_MoveWindow(-1, TRUE);
|
|
|
|
return 2;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return 0;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-04-16 02:24:32 +02:00
|
|
|
int MatchCall_MoveCursorDown(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *structPtr = GetMatchCallWindowStruct();
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
if (structPtr->windowTopIndex + structPtr->selectedIndexOffset >= structPtr->listLength - 1)
|
|
|
|
return 0;
|
|
|
|
if (structPtr->selectedIndexOffset < structPtr->visibleEntries - 1)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
structPtr->selectedIndexOffset++;
|
|
|
|
return 1;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
if (ShouldShowDownArrow())
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
MatchCall_MoveWindow(1, TRUE);
|
|
|
|
return 2;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return 0;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-04-16 02:24:32 +02:00
|
|
|
int MatchCall_PageUp(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
s32 scroll;
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *structPtr = GetMatchCallWindowStruct();
|
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
if (ShouldShowUpArrow())
|
|
|
|
{
|
|
|
|
if (structPtr->windowTopIndex >= structPtr->visibleEntries)
|
|
|
|
scroll = structPtr->visibleEntries;
|
|
|
|
else
|
|
|
|
scroll = structPtr->windowTopIndex;
|
|
|
|
MatchCall_MoveWindow(scroll * -1, TRUE);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else if (structPtr->selectedIndexOffset != 0)
|
|
|
|
{
|
|
|
|
structPtr->selectedIndexOffset = 0;
|
|
|
|
return 1;
|
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return 0;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-04-16 02:24:32 +02:00
|
|
|
int MatchCall_PageDown(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *structPtr = GetMatchCallWindowStruct();
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
if (ShouldShowDownArrow())
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
s32 windowBottomIndex = structPtr->windowTopIndex + structPtr->visibleEntries;
|
|
|
|
s32 scroll = structPtr->unk4 - structPtr->windowTopIndex;
|
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
if (windowBottomIndex <= structPtr->unk4)
|
|
|
|
scroll = structPtr->visibleEntries;
|
|
|
|
MatchCall_MoveWindow(scroll, TRUE);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
s32 cursor, lastVisibleIndex;
|
2019-04-07 20:40:35 +02:00
|
|
|
if (structPtr->listLength >= structPtr->visibleEntries)
|
|
|
|
{
|
|
|
|
cursor = structPtr->selectedIndexOffset;
|
|
|
|
lastVisibleIndex = structPtr->visibleEntries;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cursor = structPtr->selectedIndexOffset;
|
|
|
|
lastVisibleIndex = structPtr->listLength;
|
|
|
|
}
|
|
|
|
lastVisibleIndex -= 1;
|
|
|
|
if (cursor >= lastVisibleIndex)
|
|
|
|
return 0;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
|
|
|
structPtr->selectedIndexOffset = lastVisibleIndex;
|
|
|
|
return 1;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
u32 GetSelectedPokenavListIndex(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *structPtr = GetMatchCallWindowStruct();
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
return structPtr->windowTopIndex + structPtr->selectedIndexOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 GetMatchCallListTopIndex(void)
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *structPtr = GetMatchCallWindowStruct();
|
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
return structPtr->windowTopIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C877C(void)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
structPtr->unk89C = 0;
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_sub_81C8870, 6);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-12-07 10:08:21 +01:00
|
|
|
void PrintCheckPageInfo(s16 a0)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-08-04 19:09:12 +02:00
|
|
|
structPtr->unk888.windowTopIndex += a0;
|
2019-04-07 20:40:35 +02:00
|
|
|
structPtr->unk89C = 0;
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_PrintCheckPageInfo, 6);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C87F0(void)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
structPtr->unk89C = 0;
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_sub_81C8A28, 6);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
bool32 IsMatchCallListTaskActive(void)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
|
|
|
return IsLoopedTaskActive(structPtr->loopedTaskId);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void sub_81C8838(void)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-08-04 19:09:12 +02:00
|
|
|
struct MatchCallWindowState *subPtr = &structPtr->unk888;
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr->list.unk38(structPtr->list.listWindow.windowId, subPtr->windowTopIndex + subPtr->selectedIndexOffset, (structPtr->list.listWindow.unkA + subPtr->selectedIndexOffset) & 0xF);
|
|
|
|
CopyWindowToVram(structPtr->list.listWindow.windowId, 1);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-12-07 10:08:21 +01:00
|
|
|
// TODO:
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C8870(s32 state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
switch (state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
case 0:
|
2020-10-11 00:17:34 +02:00
|
|
|
ToggleMatchCallArrows(&structPtr->list, 1);
|
2019-04-07 20:40:35 +02:00
|
|
|
// fall-through
|
|
|
|
case 1:
|
|
|
|
if (structPtr->unk89C != structPtr->unk888.selectedIndexOffset)
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8B70(&structPtr->list.listWindow, structPtr->unk89C, 1);
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
structPtr->unk89C++;
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 2:
|
2019-08-04 19:09:12 +02:00
|
|
|
if (!IsDma3ManagerBusyWithBgCopy())
|
|
|
|
{
|
|
|
|
if (structPtr->unk89C != structPtr->unk888.visibleEntries)
|
|
|
|
return 6;
|
|
|
|
if (structPtr->unk888.selectedIndexOffset != 0)
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8B70(&structPtr->list.listWindow, structPtr->unk89C, structPtr->unk888.selectedIndexOffset);
|
2019-08-04 19:09:12 +02:00
|
|
|
|
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
}
|
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 3:
|
2019-08-04 19:09:12 +02:00
|
|
|
if (!IsDma3ManagerBusyWithBgCopy())
|
|
|
|
{
|
|
|
|
if (structPtr->unk888.selectedIndexOffset != 0)
|
|
|
|
{
|
|
|
|
MatchCall_MoveWindow(structPtr->unk888.selectedIndexOffset, FALSE);
|
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
}
|
|
|
|
return LT_FINISH;
|
|
|
|
}
|
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 4:
|
2020-10-11 00:17:34 +02:00
|
|
|
if (IsMonListLoopedTaskActive())
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
structPtr->unk888.selectedIndexOffset = 0;
|
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-12-07 10:08:21 +01:00
|
|
|
u32 LoopedTask_PrintCheckPageInfo(s32 state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
if (IsDma3ManagerBusyWithBgCopy())
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
|
|
|
|
|
|
|
switch (state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
case 0:
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8CB4(&structPtr->unk888, &structPtr->list);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFieldNames(&structPtr->list, 0);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFlavorText(&structPtr->unk888, &structPtr->list, CHECK_PAGE_STRATEGY);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFieldNames(&structPtr->list, 1);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFlavorText(&structPtr->unk888, &structPtr->list, CHECK_PAGE_POKEMON);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFieldNames(&structPtr->list, 2);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 6:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFlavorText(&structPtr->unk888, &structPtr->list, CHECK_PAGE_INTRO_1);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
case 7:
|
2020-10-11 00:17:34 +02:00
|
|
|
PrintMatchCallFlavorText(&structPtr->unk888, &structPtr->list, CHECK_PAGE_INTRO_2);
|
2019-04-07 20:40:35 +02:00
|
|
|
break;
|
|
|
|
default:
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 LoopedTask_sub_81C8A28(s32 state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
struct PokenavSub17 *structPtr;
|
2019-04-07 20:40:35 +02:00
|
|
|
struct MatchCallWindowState *subPtr888;
|
2019-08-04 19:09:12 +02:00
|
|
|
struct PokenavSub17Substruct *subPtr0;
|
|
|
|
s32 r5, *ptr;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
if (IsDma3ManagerBusyWithBgCopy())
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2019-04-07 20:40:35 +02:00
|
|
|
subPtr888 = &structPtr->unk888;
|
2020-10-11 00:17:34 +02:00
|
|
|
subPtr0 = &structPtr->list;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
switch (state)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
sub_81C8D4C(subPtr888, subPtr0);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 1:
|
2019-08-04 19:09:12 +02:00
|
|
|
ptr = &structPtr->unk89C;
|
|
|
|
if (++(*ptr) < structPtr->unk888.visibleEntries)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8B70(&subPtr0->listWindow, *ptr, 1);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
*ptr = 0;
|
2019-04-07 20:40:35 +02:00
|
|
|
if (subPtr888->listLength <= subPtr888->visibleEntries)
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
if (subPtr888->windowTopIndex != 0)
|
|
|
|
{
|
|
|
|
s32 r4 = subPtr888->windowTopIndex;
|
|
|
|
r5 = -r4;
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8B70(&subPtr0->listWindow, r5, r4);
|
2019-08-04 19:09:12 +02:00
|
|
|
subPtr888->selectedIndexOffset = r4;
|
|
|
|
*ptr = r5;
|
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
}
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
if (subPtr888->windowTopIndex + subPtr888->visibleEntries > subPtr888->listLength)
|
|
|
|
{
|
|
|
|
s32 r4 = subPtr888->windowTopIndex + subPtr888->visibleEntries - subPtr888->listLength;
|
|
|
|
r5 = -r4;
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C8B70(&subPtr0->listWindow, r5, r4);
|
2019-08-04 19:09:12 +02:00
|
|
|
subPtr888->selectedIndexOffset = r4;
|
|
|
|
*ptr = r5;
|
|
|
|
return LT_INC_AND_PAUSE;
|
|
|
|
}
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
return 9;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 2:
|
|
|
|
MatchCall_MoveWindow(structPtr->unk89C, FALSE);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 3:
|
2020-10-11 00:17:34 +02:00
|
|
|
if (!IsMonListLoopedTaskActive())
|
2019-08-04 19:09:12 +02:00
|
|
|
{
|
|
|
|
structPtr->unk89C = 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 2;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 4:
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81C83AC(subPtr888->unk10, subPtr888->windowTopIndex + structPtr->unk89C, 1, subPtr888->unkC, structPtr->unk89C, &structPtr->list);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_INC_AND_PAUSE;
|
2019-04-07 20:40:35 +02:00
|
|
|
case 5:
|
|
|
|
if (sub_81C83E0())
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_PAUSE;
|
|
|
|
if (++structPtr->unk89C >= subPtr888->listLength || structPtr->unk89C >= subPtr888->visibleEntries)
|
|
|
|
return LT_INC_AND_CONTINUE;
|
2019-04-07 20:40:35 +02:00
|
|
|
return 9;
|
|
|
|
case 6:
|
|
|
|
ToggleMatchCallArrows(subPtr0, 0);
|
2019-08-04 19:09:12 +02:00
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2019-08-04 19:09:12 +02:00
|
|
|
|
|
|
|
return LT_FINISH;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C8B70(struct PokenavListMenuWindow *listWindow, s32 a1, s32 a2)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
u8 *v1 = (u8*)GetWindowAttribute(listWindow->windowId, WINDOW_TILE_DATA);
|
|
|
|
u32 v2 = listWindow->unk4 * 64;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
a1 = (listWindow->unkA + a1) & 0xF;
|
2019-08-04 19:09:12 +02:00
|
|
|
if (a1 + a2 <= 16)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
CpuFastFill8(PIXEL_FILL(1), v1 + a1 * v2, a2 * v2);
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowToVram(listWindow->windowId, 2);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 v3 = 16 - a1;
|
|
|
|
u32 v4 = a2 - v3;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
CpuFastFill8(PIXEL_FILL(1), v1 + a1 * v2, v3 * v2);
|
|
|
|
CpuFastFill8(PIXEL_FILL(1), v1, v4 * v2);
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowToVram(listWindow->windowId, 2);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
for (a2--; a2 != -1; a1 = (a1 + 1) & 0xF, a2--)
|
2020-10-11 00:17:34 +02:00
|
|
|
ClearRematchPokeballIcon(listWindow->windowId, a1);
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowToVram(listWindow->windowId, 1);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C8C64(struct PokenavListMenuWindow *listWindow, u32 a1)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
u16 var;
|
2020-10-11 00:17:34 +02:00
|
|
|
u16 *v1 = (u16*)GetBgTilemapBuffer(GetWindowAttribute(listWindow->windowId, WINDOW_BG));
|
|
|
|
v1 += ((listWindow->unkA << 6) + listWindow->unk2) - 1;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
|
|
|
if (a1 != 0)
|
2020-10-11 00:17:34 +02:00
|
|
|
var = (listWindow->unk1 << 12) | (listWindow->unk6 + 1);
|
2019-04-07 20:40:35 +02:00
|
|
|
else
|
2020-10-11 00:17:34 +02:00
|
|
|
var = (listWindow->unk1 << 12) | (listWindow->unk6);
|
2019-08-04 19:09:12 +02:00
|
|
|
|
|
|
|
v1[0] = var;
|
|
|
|
v1[0x20] = var;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C8CB4(struct MatchCallWindowState *state, struct PokenavSub17Substruct *list)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2021-04-10 04:39:34 +02:00
|
|
|
u8 colors[3] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_RED};
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
list->unk34(state->unk10 + state->unkC * state->windowTopIndex, list->unkTextBuffer);
|
|
|
|
list->unk38(list->listWindow.windowId, state->windowTopIndex, list->listWindow.unkA);
|
|
|
|
FillWindowPixelRect(list->listWindow.windowId, PIXEL_FILL(4), 0, list->listWindow.unkA * 16, list->listWindow.unk4 * 8, 16);
|
|
|
|
AddTextPrinterParameterized3(list->listWindow.windowId, list->listWindow.fontId, 8, (list->listWindow.unkA * 16) + 1, colors, TEXT_SPEED_FF, list->unkTextBuffer);
|
|
|
|
sub_81C8C64(&list->listWindow, 1);
|
|
|
|
CopyWindowRectToVram(list->listWindow.windowId, 3, 0, list->listWindow.unkA * 2, list->listWindow.unk4, 2);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void sub_81C8D4C(struct MatchCallWindowState *state, struct PokenavSub17Substruct *list)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
list->unk34(state->unk10 + state->unkC * state->windowTopIndex, list->unkTextBuffer);
|
|
|
|
FillWindowPixelRect(list->listWindow.windowId, PIXEL_FILL(1), 0, list->listWindow.unkA * 16, list->listWindow.unk4 * 8, 16);
|
|
|
|
AddTextPrinterParameterized(list->listWindow.windowId, list->listWindow.fontId, list->unkTextBuffer, 8, list->listWindow.unkA * 16 + 1, TEXT_SPEED_FF, NULL);
|
|
|
|
sub_81C8C64(&list->listWindow, 0);
|
|
|
|
CopyWindowToVram(list->listWindow.windowId, 3);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void PrintMatchCallFieldNames(struct PokenavSub17Substruct *list, u32 fieldId)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
const u8 *fieldNames[] = {gText_PokenavMatchCall_Strategy, gText_PokenavMatchCall_TrainerPokemon, gText_PokenavMatchCall_SelfIntroduction};
|
2019-12-05 21:33:36 +01:00
|
|
|
u8 colors[3] = {TEXT_COLOR_WHITE, TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED};
|
2020-10-11 00:17:34 +02:00
|
|
|
u32 top = (list->listWindow.unkA + 1 + (fieldId * 2)) & 0xF;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
FillWindowPixelRect(list->listWindow.windowId, PIXEL_FILL(1), 0, top << 4, list->listWindow.unk4, 16);
|
2021-10-30 22:47:37 +02:00
|
|
|
AddTextPrinterParameterized3(list->listWindow.windowId, FONT_NARROW, 2, (top << 4) + 1, colors, -1, fieldNames[fieldId]);
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowRectToVram(list->listWindow.windowId, 2, 0, top << 1, list->listWindow.unk4, 2);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
static void PrintMatchCallFlavorText(struct MatchCallWindowState *a0, struct PokenavSub17Substruct *list, u32 checkPageEntry)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-12-05 21:33:36 +01:00
|
|
|
// lines 1, 3, and 5 are the field names printed by PrintMatchCallFieldNames
|
2021-08-25 00:59:32 +02:00
|
|
|
static const u8 lineOffsets[CHECK_PAGE_ENTRY_COUNT] =
|
2019-12-05 21:33:36 +01:00
|
|
|
{
|
2021-08-25 00:59:32 +02:00
|
|
|
[CHECK_PAGE_STRATEGY] = 2,
|
|
|
|
[CHECK_PAGE_POKEMON] = 4,
|
|
|
|
[CHECK_PAGE_INTRO_1] = 6,
|
2019-12-05 21:33:36 +01:00
|
|
|
[CHECK_PAGE_INTRO_2] = 7
|
|
|
|
};
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
u32 r6 = (list->listWindow.unkA + lineOffsets[checkPageEntry]) & 0xF;
|
2019-12-05 21:33:36 +01:00
|
|
|
const u8 *str = GetMatchCallFlavorText(a0->windowTopIndex, checkPageEntry);
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
if (str != NULL)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
sub_81DB620(list->listWindow.windowId, 1, r6 * 2, list->listWindow.unk4 - 1, 2);
|
2021-10-30 22:47:37 +02:00
|
|
|
AddTextPrinterParameterized(list->listWindow.windowId, FONT_NARROW, str, 2, (r6 << 4) + 1, TEXT_SPEED_FF, NULL);
|
2020-10-11 00:17:34 +02:00
|
|
|
CopyWindowRectToVram(list->listWindow.windowId, 2, 0, r6 * 2, list->listWindow.unk4, 2);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-04 19:09:12 +02:00
|
|
|
static const struct CompressedSpriteSheet sMatchcallArrowSpriteSheets[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.data = sMatchcallArrowSpriteSheetData,
|
|
|
|
.size = 192,
|
|
|
|
.tag = 0xA
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct SpritePalette sMatchcallArrowPalettes[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
.data = sMatchcallArrowPaletteData,
|
|
|
|
.tag = 0x14
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct OamData sMatchCallRightArrowSpriteOam =
|
|
|
|
{
|
|
|
|
.y = 0,
|
|
|
|
.affineMode = ST_OAM_AFFINE_OFF,
|
|
|
|
.objMode = ST_OAM_OBJ_NORMAL,
|
|
|
|
.bpp = ST_OAM_4BPP,
|
|
|
|
.shape = SPRITE_SHAPE(8x16),
|
|
|
|
.x = 0,
|
|
|
|
.size = SPRITE_SIZE(8x16),
|
|
|
|
.tileNum = 0,
|
|
|
|
.priority = 2,
|
|
|
|
.paletteNum = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct SpriteTemplate sMatchCallRightArrowSprite =
|
|
|
|
{
|
|
|
|
.tileTag = 0xA,
|
|
|
|
.paletteTag = 0x14,
|
|
|
|
.oam = &sMatchCallRightArrowSpriteOam,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = SpriteCB_MatchCallRightArrow
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct OamData sMatchCallUpDownArrowSpriteOam =
|
|
|
|
{
|
|
|
|
.y = 0,
|
|
|
|
.affineMode = ST_OAM_AFFINE_OFF,
|
|
|
|
.objMode = ST_OAM_OBJ_NORMAL,
|
|
|
|
.bpp = ST_OAM_4BPP,
|
|
|
|
.shape = SPRITE_SHAPE(16x8),
|
|
|
|
.x = 0,
|
|
|
|
.size = SPRITE_SIZE(16x8),
|
|
|
|
.tileNum = 0,
|
|
|
|
.priority = 2,
|
|
|
|
.paletteNum = 0
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct SpriteTemplate sMatchCallUpDownArrowSprite =
|
|
|
|
{
|
|
|
|
.tileTag = 0xA,
|
|
|
|
.paletteTag = 0x14,
|
|
|
|
.oam = &sMatchCallUpDownArrowSpriteOam,
|
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = SpriteCallbackDummy
|
|
|
|
};
|
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
void sub_81C8ED0(void)
|
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
const struct CompressedSpriteSheet *ptr;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-08 00:31:01 +02:00
|
|
|
for (i = 0, ptr = sMatchcallArrowSpriteSheets; i < ARRAY_COUNT(sMatchcallArrowSpriteSheets); ptr++, i++)
|
2019-04-07 20:40:35 +02:00
|
|
|
LoadCompressedSpriteSheet(ptr);
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-08 00:31:01 +02:00
|
|
|
Pokenav_AllocAndLoadPalettes(sMatchcallArrowPalettes);
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void CreateMatchCallArrowSprites(struct MatchCallWindowState *windowState, struct PokenavSub17Substruct *list)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2019-08-04 19:09:12 +02:00
|
|
|
u32 spriteId;
|
|
|
|
s16 x;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
spriteId = CreateSprite(&sMatchCallRightArrowSprite, list->listWindow.unk2 * 8 + 3, (list->listWindow.unk3 + 1) * 8, 7);
|
|
|
|
list->rightArrow = &gSprites[spriteId];
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
x = list->listWindow.unk2 * 8 + (list->listWindow.unk4 - 1) * 4;
|
|
|
|
spriteId = CreateSprite(&sMatchCallUpDownArrowSprite, x, list->listWindow.unk3 * 8 + windowState->visibleEntries * 16, 7);
|
|
|
|
list->downArrow = &gSprites[spriteId];
|
|
|
|
list->downArrow->oam.tileNum += 2;
|
|
|
|
list->downArrow->callback = SpriteCB_MatchCallDownArrow;
|
2019-04-07 20:40:35 +02:00
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
spriteId = CreateSprite(&sMatchCallUpDownArrowSprite, x, list->listWindow.unk3 * 8, 7);
|
|
|
|
list->upArrow = &gSprites[spriteId];
|
|
|
|
list->upArrow->oam.tileNum += 4;
|
|
|
|
list->upArrow->callback = SpriteCB_MatchCallUpArrow;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void DestroyMatchCallListArrows(struct PokenavSub17Substruct *list)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
DestroySprite(list->rightArrow);
|
|
|
|
DestroySprite(list->upArrow);
|
|
|
|
DestroySprite(list->downArrow);
|
2019-04-07 20:40:35 +02:00
|
|
|
FreeSpriteTilesByTag(0xA);
|
|
|
|
FreeSpritePaletteByTag(0x14);
|
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void ToggleMatchCallArrows(struct PokenavSub17Substruct *list, bool32 shouldHide)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
if (shouldHide)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
list->rightArrow->callback = SpriteCallbackDummy;
|
|
|
|
list->upArrow->callback = SpriteCallbackDummy;
|
|
|
|
list->downArrow->callback = SpriteCallbackDummy;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
list->rightArrow->callback = SpriteCB_MatchCallRightArrow;
|
|
|
|
list->upArrow->callback = SpriteCB_MatchCallUpArrow;
|
|
|
|
list->downArrow->callback = SpriteCB_MatchCallDownArrow;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
2020-10-11 00:17:34 +02:00
|
|
|
list->rightArrow->invisible = shouldHide;
|
|
|
|
list->upArrow->invisible = shouldHide;
|
|
|
|
list->downArrow->invisible = shouldHide;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SpriteCB_MatchCallRightArrow(struct Sprite *sprite)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = structPtr->unk888.selectedIndexOffset << 4;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SpriteCB_MatchCallDownArrow(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->data[7] == 0 && ShouldShowDownArrow())
|
|
|
|
sprite->invisible = FALSE;
|
|
|
|
else
|
|
|
|
sprite->invisible = TRUE;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
if (++sprite->data[0] > 3)
|
|
|
|
{
|
|
|
|
s16 offset;
|
|
|
|
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
offset = (sprite->data[1] + 1) & 7;
|
|
|
|
sprite->data[1] = offset;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = offset;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SpriteCB_MatchCallUpArrow(struct Sprite *sprite)
|
|
|
|
{
|
|
|
|
if (sprite->data[7] == 0 && ShouldShowUpArrow())
|
|
|
|
sprite->invisible = FALSE;
|
|
|
|
else
|
|
|
|
sprite->invisible = TRUE;
|
2019-08-04 19:09:12 +02:00
|
|
|
|
2019-04-07 20:40:35 +02:00
|
|
|
if (++sprite->data[0] > 3)
|
|
|
|
{
|
|
|
|
s16 offset;
|
|
|
|
|
|
|
|
sprite->data[0] = 0;
|
|
|
|
offset = (sprite->data[1] + 1) & 7;
|
|
|
|
sprite->data[1] = offset;
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->y2 = -1 * offset;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ToggleMatchCallVerticalArrows(bool32 shouldHide)
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
struct PokenavSub17 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MATCH_CALL_LIST);
|
|
|
|
structPtr->list.upArrow->data[7] = shouldHide;
|
|
|
|
structPtr->list.downArrow->data[7] = shouldHide;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
void InitMatchCallWindowState(struct MatchCallWindowState *dst, struct PokenavListTemplate *template)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
dst->unk10 = template->list.matchCallEntries;
|
|
|
|
dst->windowTopIndex = template->unk6;
|
|
|
|
dst->listLength = template->count;
|
|
|
|
dst->unkC = template->unk8;
|
|
|
|
dst->visibleEntries = template->maxShowed;
|
|
|
|
if (dst->visibleEntries >= dst->listLength)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
dst->windowTopIndex = 0;
|
|
|
|
dst->unk4 = 0;
|
|
|
|
dst->selectedIndexOffset = template->unk6;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
dst->unk4 = dst->listLength - dst->visibleEntries;
|
|
|
|
if (dst->windowTopIndex + dst->visibleEntries > dst->listLength)
|
2019-08-04 19:09:12 +02:00
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
dst->selectedIndexOffset = dst->windowTopIndex + dst->visibleEntries - dst->listLength;
|
|
|
|
dst->windowTopIndex = template->unk6 - dst->selectedIndexOffset;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-11 00:17:34 +02:00
|
|
|
dst->selectedIndexOffset = 0;
|
2019-04-07 20:40:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
bool32 CopyPokenavListMenuTemplate(struct PokenavSub17Substruct *dest, const struct BgTemplate *bgTemplate, struct PokenavListTemplate *template, s32 a3)
|
2019-04-07 20:40:35 +02:00
|
|
|
{
|
|
|
|
struct WindowTemplate window;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
dest->listWindow.bg = bgTemplate->bg;
|
|
|
|
dest->listWindow.unk6 = a3;
|
|
|
|
dest->unk34 = template->listFunc.unk10_2;
|
|
|
|
dest->unk38 = template->unk14;
|
|
|
|
dest->listWindow.unk1 = template->fillValue;
|
|
|
|
dest->listWindow.unk2 = template->item_X;
|
|
|
|
dest->listWindow.unk3 = template->listTop;
|
|
|
|
dest->listWindow.unk4 = template->windowWidth;
|
|
|
|
dest->listWindow.fontId = template->fontId;
|
|
|
|
|
|
|
|
window.bg = bgTemplate->bg;
|
|
|
|
window.tilemapLeft = template->item_X;
|
2019-04-07 20:40:35 +02:00
|
|
|
window.tilemapTop = 0;
|
2020-10-11 00:17:34 +02:00
|
|
|
window.width = template->windowWidth;
|
2019-04-07 20:40:35 +02:00
|
|
|
window.height = 32;
|
2020-10-11 00:17:34 +02:00
|
|
|
window.paletteNum = template->fillValue;
|
2019-04-07 20:40:35 +02:00
|
|
|
window.baseBlock = a3 + 2;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
dest->listWindow.windowId = AddWindow(&window);
|
2021-02-20 00:36:48 +01:00
|
|
|
if (dest->listWindow.windowId == WINDOW_NONE)
|
2019-08-04 19:09:12 +02:00
|
|
|
return FALSE;
|
|
|
|
|
2020-10-11 00:17:34 +02:00
|
|
|
dest->listWindow.unkA = 0;
|
|
|
|
dest->rightArrow = NULL;
|
|
|
|
dest->upArrow = NULL;
|
|
|
|
dest->downArrow = NULL;
|
2019-08-04 19:09:12 +02:00
|
|
|
return 1;
|
2019-05-14 16:49:07 +02:00
|
|
|
}
|