mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 05:43:51 +01:00
Clean up pokenav ribbons
This commit is contained in:
parent
1c82571fa0
commit
43e942c3af
@ -459,18 +459,18 @@ void CreateSearchResultsLoopedTask(s32);
|
|||||||
u32 IsSearchResultLoopedTaskActive(void);
|
u32 IsSearchResultLoopedTaskActive(void);
|
||||||
void FreeSearchResultSubstruct2(void);
|
void FreeSearchResultSubstruct2(void);
|
||||||
|
|
||||||
// pokenav_ribbons_1.c
|
// pokenav_ribbons_list.c
|
||||||
u32 PokenavCallback_Init_MonRibbonList(void);
|
u32 PokenavCallback_Init_MonRibbonList(void);
|
||||||
u32 PokenavCallback_Init_RibbonsMonListFromSummary(void);
|
u32 PokenavCallback_Init_RibbonsMonListFromSummary(void);
|
||||||
u32 GetRibbonsMonListCallback(void);
|
u32 GetRibbonsMonListCallback(void);
|
||||||
void FreeRibbonsMonList1(void);
|
void FreeRibbonsMonList(void);
|
||||||
bool32 OpenRibbonsMonList(void);
|
bool32 OpenRibbonsMonList(void);
|
||||||
bool32 OpenRibbonsMonListFromRibbonsSummary(void);
|
bool32 OpenRibbonsMonListFromRibbonsSummary(void);
|
||||||
void CreateRibbonsMonListLoopedTask(s32);
|
void CreateRibbonsMonListLoopedTask(s32);
|
||||||
u32 IsRibbonsMonListLoopedTaskActive(void);
|
u32 IsRibbonsMonListLoopedTaskActive(void);
|
||||||
void FreeRibbonsMonList2(void);
|
void FreeRibbonsMonMenu(void);
|
||||||
|
|
||||||
// pokenav_ribbons_2.c
|
// pokenav_ribbons_summary.c
|
||||||
u32 PokenavCallback_Init_RibbonsSummaryMenu(void);
|
u32 PokenavCallback_Init_RibbonsSummaryMenu(void);
|
||||||
u32 GetRibbonsSummaryMenuCallback(void);
|
u32 GetRibbonsSummaryMenuCallback(void);
|
||||||
void FreeRibbonsSummaryScreen1(void);
|
void FreeRibbonsSummaryScreen1(void);
|
||||||
|
@ -319,8 +319,8 @@ SECTIONS {
|
|||||||
src/pokenav_conditions_1.o(.text);
|
src/pokenav_conditions_1.o(.text);
|
||||||
src/pokenav_conditions_2.o(.text);
|
src/pokenav_conditions_2.o(.text);
|
||||||
src/pokenav_conditions_3.o(.text);
|
src/pokenav_conditions_3.o(.text);
|
||||||
src/pokenav_ribbons_1.o(.text);
|
src/pokenav_ribbons_list.o(.text);
|
||||||
src/pokenav_ribbons_2.o(.text);
|
src/pokenav_ribbons_summary.o(.text);
|
||||||
src/pokenav_match_call_data.o(.text);
|
src/pokenav_match_call_data.o(.text);
|
||||||
src/menu_specialized.o(.text);
|
src/menu_specialized.o(.text);
|
||||||
src/ereader_helpers.o(.text);
|
src/ereader_helpers.o(.text);
|
||||||
@ -673,8 +673,8 @@ SECTIONS {
|
|||||||
src/pokenav_region_map.o(.rodata);
|
src/pokenav_region_map.o(.rodata);
|
||||||
src/pokenav_conditions_2.o(.rodata);
|
src/pokenav_conditions_2.o(.rodata);
|
||||||
src/pokenav_conditions_3.o(.rodata);
|
src/pokenav_conditions_3.o(.rodata);
|
||||||
src/pokenav_ribbons_1.o(.rodata);
|
src/pokenav_ribbons_list.o(.rodata);
|
||||||
src/pokenav_ribbons_2.o(.rodata);
|
src/pokenav_ribbons_summary.o(.rodata);
|
||||||
src/pokenav_match_call_data.o(.rodata);
|
src/pokenav_match_call_data.o(.rodata);
|
||||||
src/menu_specialized.o(.rodata);
|
src/menu_specialized.o(.rodata);
|
||||||
src/ereader_helpers.o(.rodata);
|
src/ereader_helpers.o(.rodata);
|
||||||
|
@ -179,8 +179,8 @@ const struct PokenavCallbacks PokenavMenuCallbacks[15] =
|
|||||||
.open = OpenRibbonsMonList,
|
.open = OpenRibbonsMonList,
|
||||||
.createLoopTask = CreateRibbonsMonListLoopedTask,
|
.createLoopTask = CreateRibbonsMonListLoopedTask,
|
||||||
.isLoopTaskActive = IsRibbonsMonListLoopedTaskActive,
|
.isLoopTaskActive = IsRibbonsMonListLoopedTaskActive,
|
||||||
.free1 = FreeRibbonsMonList1,
|
.free1 = FreeRibbonsMonList,
|
||||||
.free2 = FreeRibbonsMonList2,
|
.free2 = FreeRibbonsMonMenu,
|
||||||
},
|
},
|
||||||
[POKENAV_RIBBONS_SUMMARY_SCREEN - POKENAV_MENU_IDS_START] =
|
[POKENAV_RIBBONS_SUMMARY_SCREEN - POKENAV_MENU_IDS_START] =
|
||||||
{
|
{
|
||||||
@ -199,8 +199,8 @@ const struct PokenavCallbacks PokenavMenuCallbacks[15] =
|
|||||||
.open = OpenRibbonsMonListFromRibbonsSummary,
|
.open = OpenRibbonsMonListFromRibbonsSummary,
|
||||||
.createLoopTask = CreateRibbonsMonListLoopedTask,
|
.createLoopTask = CreateRibbonsMonListLoopedTask,
|
||||||
.isLoopTaskActive = IsRibbonsMonListLoopedTaskActive,
|
.isLoopTaskActive = IsRibbonsMonListLoopedTaskActive,
|
||||||
.free1 = FreeRibbonsMonList1,
|
.free1 = FreeRibbonsMonList,
|
||||||
.free2 = FreeRibbonsMonList2,
|
.free2 = FreeRibbonsMonMenu,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct PokenavSub9
|
struct Pokenav_RibbonsMonList
|
||||||
{
|
{
|
||||||
u32 (*callback)(struct PokenavSub9*);
|
u32 (*callback)(struct Pokenav_RibbonsMonList*);
|
||||||
u32 loopedTaskId;
|
u32 loopedTaskId;
|
||||||
u16 winid;
|
u16 winid;
|
||||||
s32 boxId;
|
s32 boxId;
|
||||||
@ -32,35 +32,35 @@ struct PokenavSub9
|
|||||||
struct PokenavSub18 *monList;
|
struct PokenavSub18 *monList;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PokenavSub10
|
struct Pokenav_RibbonsMonMenu
|
||||||
{
|
{
|
||||||
bool32 (*callback)(void);
|
bool32 (*callback)(void);
|
||||||
u32 ltid;
|
u32 loopedTaskId;
|
||||||
u16 winid;
|
u16 winid;
|
||||||
bool32 fromSummary;
|
bool32 fromSummary;
|
||||||
u8 buff[BG_SCREEN_SIZE];
|
u8 buff[BG_SCREEN_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
static u32 HandleRibbonsMonListInput_WaitListInit(struct PokenavSub9 *structPtr);
|
static u32 HandleRibbonsMonListInput_WaitListInit(struct Pokenav_RibbonsMonList *);
|
||||||
static u32 HandleRibbonsMonListInput(struct PokenavSub9 *structPtr);
|
static u32 HandleRibbonsMonListInput(struct Pokenav_RibbonsMonList *);
|
||||||
static u32 RibbonsMonMenu_ReturnToMainMenu(struct PokenavSub9 *structPtr);
|
static u32 RibbonsMonMenu_ReturnToMainMenu(struct Pokenav_RibbonsMonList *);
|
||||||
static u32 RibbonsMonMenu_ToSummaryScreen(struct PokenavSub9 *structPtr);
|
static u32 RibbonsMonMenu_ToSummaryScreen(struct Pokenav_RibbonsMonList *);
|
||||||
static u32 BuildPartyMonRibbonList(s32 state);
|
static u32 BuildPartyMonRibbonList(s32);
|
||||||
static u32 InitBoxMonRibbonList(s32 state);
|
static u32 InitBoxMonRibbonList(s32);
|
||||||
static u32 BuildBoxMonRibbonList(s32 state);
|
static u32 BuildBoxMonRibbonList(s32);
|
||||||
static u32 GetMonRibbonListLoopTaskFunc(s32 state);
|
static u32 GetMonRibbonListLoopTaskFunc(s32);
|
||||||
static void sub_81CFCEC(struct PokenavSub9 *structPtr, struct PokenavMonList *item);
|
static void InsertMonListItem(struct Pokenav_RibbonsMonList *, struct PokenavMonList *);
|
||||||
static u32 LoopedTask_OpenRibbonsMonList(s32 state);
|
static u32 LoopedTask_OpenRibbonsMonList(s32);
|
||||||
static bool32 GetRibbonsMonCurrentLoopedTaskActive(void);
|
static bool32 GetRibbonsMonCurrentLoopedTaskActive(void);
|
||||||
static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state);
|
static u32 LoopedTask_RibbonsListMoveCursorUp(s32);
|
||||||
static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state);
|
static u32 LoopedTask_RibbonsListMoveCursorDown(s32);
|
||||||
static u32 LoopedTask_RibbonsListMovePageUp(s32 state);
|
static u32 LoopedTask_RibbonsListMovePageUp(s32);
|
||||||
static u32 LoopedTask_RibbonsListMovePageDown(s32 state);
|
static u32 LoopedTask_RibbonsListMovePageDown(s32);
|
||||||
static u32 LoopedTask_RibbonsListReturnToMainMenu(s32 state);
|
static u32 LoopedTask_RibbonsListReturnToMainMenu(s32);
|
||||||
static u32 LoopedTask_RibbonsListOpenSummary(s32 state);
|
static u32 LoopedTask_RibbonsListOpenSummary(s32);
|
||||||
static void sub_81D02B0(s32 windowId, s32 val1, s32 val2);
|
static void DrawListIndexNumber(s32, s32, s32);
|
||||||
static void AddRibbonsMonListWindow(struct PokenavSub10 *ptr);
|
static void AddRibbonsMonListWindow(struct Pokenav_RibbonsMonMenu *);
|
||||||
static void sub_81D0288(struct PokenavSub10 *ptr);
|
static void UpdateIndexNumberDisplay(struct Pokenav_RibbonsMonMenu *);
|
||||||
static void InitMonRibbonPokenavListMenuTemplate(void);
|
static void InitMonRibbonPokenavListMenuTemplate(void);
|
||||||
static void BufferRibbonMonInfoText(struct PokenavMonList *, u8 *);
|
static void BufferRibbonMonInfoText(struct PokenavMonList *, u8 *);
|
||||||
|
|
||||||
@ -125,54 +125,54 @@ static const u8 sText_NoGenderSymbol[] = _("{UNK_SPACER}");
|
|||||||
|
|
||||||
bool32 PokenavCallback_Init_MonRibbonList(void)
|
bool32 PokenavCallback_Init_MonRibbonList(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST, sizeof(struct PokenavSub9));
|
struct Pokenav_RibbonsMonList *list = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST, sizeof(struct Pokenav_RibbonsMonList));
|
||||||
if (structPtr == NULL)
|
if (list == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
structPtr->monList = AllocSubstruct(POKENAV_SUBSTRUCT_MON_LIST, sizeof(struct PokenavSub18));
|
list->monList = AllocSubstruct(POKENAV_SUBSTRUCT_MON_LIST, sizeof(struct PokenavSub18));
|
||||||
if (structPtr->monList == NULL)
|
if (list->monList == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
structPtr->callback = HandleRibbonsMonListInput_WaitListInit;
|
list->callback = HandleRibbonsMonListInput_WaitListInit;
|
||||||
structPtr->loopedTaskId = CreateLoopedTask(GetMonRibbonListLoopTaskFunc, 1);
|
list->loopedTaskId = CreateLoopedTask(GetMonRibbonListLoopTaskFunc, 1);
|
||||||
structPtr->changeBgs = 0;
|
list->changeBgs = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 PokenavCallback_Init_RibbonsMonListFromSummary(void)
|
bool32 PokenavCallback_Init_RibbonsMonListFromSummary(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST, sizeof(struct PokenavSub9));
|
struct Pokenav_RibbonsMonList *list = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST, sizeof(struct Pokenav_RibbonsMonList));
|
||||||
if (structPtr == NULL)
|
if (list == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
structPtr->monList = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
list->monList = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||||
structPtr->callback = HandleRibbonsMonListInput;
|
list->callback = HandleRibbonsMonListInput;
|
||||||
structPtr->changeBgs = 1;
|
list->changeBgs = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetRibbonsMonListCallback(void)
|
u32 GetRibbonsMonListCallback(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
return structPtr->callback(structPtr);
|
return list->callback(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeRibbonsMonList1(void)
|
void FreeRibbonsMonList(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
if (!structPtr->saveMonList)
|
if (!list->saveMonList)
|
||||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MON_LIST);
|
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MON_LIST);
|
||||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 HandleRibbonsMonListInput_WaitListInit(struct PokenavSub9 *structPtr)
|
static u32 HandleRibbonsMonListInput_WaitListInit(struct Pokenav_RibbonsMonList *list)
|
||||||
{
|
{
|
||||||
if (!IsLoopedTaskActive(structPtr->loopedTaskId))
|
if (!IsLoopedTaskActive(list->loopedTaskId))
|
||||||
structPtr->callback = HandleRibbonsMonListInput;
|
list->callback = HandleRibbonsMonListInput;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 HandleRibbonsMonListInput(struct PokenavSub9 *structPtr)
|
static u32 HandleRibbonsMonListInput(struct Pokenav_RibbonsMonList *list)
|
||||||
{
|
{
|
||||||
if (JOY_REPEAT(DPAD_UP))
|
if (JOY_REPEAT(DPAD_UP))
|
||||||
return RIBBONS_MON_LIST_FUNC_MOVE_UP;
|
return RIBBONS_MON_LIST_FUNC_MOVE_UP;
|
||||||
@ -184,60 +184,60 @@ static u32 HandleRibbonsMonListInput(struct PokenavSub9 *structPtr)
|
|||||||
return RIBBONS_MON_LIST_FUNC_PAGE_DOWN;
|
return RIBBONS_MON_LIST_FUNC_PAGE_DOWN;
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (JOY_NEW(B_BUTTON))
|
||||||
{
|
{
|
||||||
structPtr->saveMonList = 0;
|
list->saveMonList = 0;
|
||||||
structPtr->callback = RibbonsMonMenu_ReturnToMainMenu;
|
list->callback = RibbonsMonMenu_ReturnToMainMenu;
|
||||||
return RIBBONS_MON_LIST_FUNC_EXIT;
|
return RIBBONS_MON_LIST_FUNC_EXIT;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (JOY_NEW(A_BUTTON))
|
||||||
{
|
{
|
||||||
structPtr->monList->currIndex = GetSelectedPokenavListIndex();
|
list->monList->currIndex = GetSelectedPokenavListIndex();
|
||||||
structPtr->saveMonList = 1;
|
list->saveMonList = 1;
|
||||||
structPtr->callback = RibbonsMonMenu_ToSummaryScreen;
|
list->callback = RibbonsMonMenu_ToSummaryScreen;
|
||||||
return RIBBONS_MON_LIST_FUNC_OPEN_RIBBONS_SUMMARY;
|
return RIBBONS_MON_LIST_FUNC_OPEN_RIBBONS_SUMMARY;
|
||||||
}
|
}
|
||||||
return RIBBONS_MON_LIST_FUNC_NONE;
|
return RIBBONS_MON_LIST_FUNC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 RibbonsMonMenu_ReturnToMainMenu(struct PokenavSub9 *structPtr)
|
static u32 RibbonsMonMenu_ReturnToMainMenu(struct Pokenav_RibbonsMonList *list)
|
||||||
{
|
{
|
||||||
return POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS;
|
return POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 RibbonsMonMenu_ToSummaryScreen(struct PokenavSub9 *structPtr)
|
static u32 RibbonsMonMenu_ToSummaryScreen(struct Pokenav_RibbonsMonList *list)
|
||||||
{
|
{
|
||||||
return POKENAV_RIBBONS_SUMMARY_SCREEN;
|
return POKENAV_RIBBONS_SUMMARY_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 UpdateMonListBgs(void)
|
static u32 UpdateMonListBgs(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
return structPtr->changeBgs;
|
return list->changeBgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PokenavMonList *GetMonRibbonMonListData(void)
|
static struct PokenavMonList *GetMonRibbonMonListData(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
return ptr->monList->monData;
|
return list->monList->monData;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 GetRibbonsMonListCount(void)
|
static s32 GetRibbonsMonListCount(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
return ptr->monList->listCount;
|
return list->monList->listCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unused
|
//unused
|
||||||
static s32 GetMonRibbonSelectedMonData(void)
|
static s32 GetMonRibbonSelectedMonData(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
s32 idx = GetSelectedPokenavListIndex();
|
s32 idx = GetSelectedPokenavListIndex();
|
||||||
return ptr->monList->monData[idx].data;
|
return list->monList->monData[idx].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 GetRibbonListMenuCurrIndex(void)
|
static s32 GetRibbonListMenuCurrIndex(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
return ptr->monList->currIndex;
|
return list->monList->currIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 GetMonRibbonListLoopTaskFunc(s32 state)
|
static u32 GetMonRibbonListLoopTaskFunc(s32 state)
|
||||||
@ -249,10 +249,10 @@ static u32 BuildPartyMonRibbonList(s32 state)
|
|||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
struct PokenavMonList item;
|
struct PokenavMonList item;
|
||||||
struct PokenavSub9 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
|
|
||||||
ptr->monList->listCount = 0;
|
list->monList->listCount = 0;
|
||||||
ptr->monList->currIndex = 0;
|
list->monList->currIndex = 0;
|
||||||
item.boxId = TOTAL_BOXES_COUNT;
|
item.boxId = TOTAL_BOXES_COUNT;
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
@ -266,7 +266,7 @@ static u32 BuildPartyMonRibbonList(s32 state)
|
|||||||
{
|
{
|
||||||
item.monId = i;
|
item.monId = i;
|
||||||
item.data = ribbonCount;
|
item.data = ribbonCount;
|
||||||
sub_81CFCEC(ptr, &item);
|
InsertMonListItem(list, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,17 +276,17 @@ static u32 BuildPartyMonRibbonList(s32 state)
|
|||||||
|
|
||||||
static u32 InitBoxMonRibbonList(s32 state)
|
static u32 InitBoxMonRibbonList(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 *ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
ptr->monId = 0;
|
list->monId = 0;
|
||||||
ptr->boxId = 0;
|
list->boxId = 0;
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 BuildBoxMonRibbonList(s32 state)
|
static u32 BuildBoxMonRibbonList(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub9 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
struct Pokenav_RibbonsMonList * list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_LIST);
|
||||||
s32 boxId = ptr->boxId;
|
s32 boxId = list->boxId;
|
||||||
s32 monId = ptr->monId;
|
s32 monId = list->monId;
|
||||||
s32 boxCount = 0;
|
s32 boxCount = 0;
|
||||||
struct PokenavMonList item;
|
struct PokenavMonList item;
|
||||||
|
|
||||||
@ -302,15 +302,15 @@ static u32 BuildBoxMonRibbonList(s32 state)
|
|||||||
item.boxId = boxId;
|
item.boxId = boxId;
|
||||||
item.monId = monId;
|
item.monId = monId;
|
||||||
item.data = ribbonCount;
|
item.data = ribbonCount;
|
||||||
sub_81CFCEC(ptr, &item);
|
InsertMonListItem(list, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boxCount++;
|
boxCount++;
|
||||||
monId++;
|
monId++;
|
||||||
if (boxCount > TOTAL_BOXES_COUNT)
|
if (boxCount > TOTAL_BOXES_COUNT)
|
||||||
{
|
{
|
||||||
ptr->boxId = boxId;
|
list->boxId = boxId;
|
||||||
ptr->monId = monId;
|
list->monId = monId;
|
||||||
return LT_CONTINUE;
|
return LT_CONTINUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,28 +318,28 @@ static u32 BuildBoxMonRibbonList(s32 state)
|
|||||||
boxId++;
|
boxId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr->changeBgs = 1;
|
list->changeBgs = 1;
|
||||||
return LT_FINISH;
|
return LT_FINISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81CFCEC(struct PokenavSub9 *structPtr, struct PokenavMonList *item)
|
static void InsertMonListItem(struct Pokenav_RibbonsMonList *list, struct PokenavMonList *item)
|
||||||
{
|
{
|
||||||
u32 left = 0;
|
u32 left = 0;
|
||||||
u32 right = structPtr->monList->listCount;
|
u32 right = list->monList->listCount;
|
||||||
u32 insertionIdx = left + (right - left) / 2;
|
u32 insertionIdx = left + (right - left) / 2;
|
||||||
|
|
||||||
while (right != insertionIdx)
|
while (right != insertionIdx)
|
||||||
{
|
{
|
||||||
if (item->data > structPtr->monList->monData[insertionIdx].data)
|
if (item->data > list->monList->monData[insertionIdx].data)
|
||||||
right = insertionIdx;
|
right = insertionIdx;
|
||||||
else
|
else
|
||||||
left = insertionIdx + 1;
|
left = insertionIdx + 1;
|
||||||
insertionIdx = left + (right - left) / 2;
|
insertionIdx = left + (right - left) / 2;
|
||||||
}
|
}
|
||||||
for (right = structPtr->monList->listCount; right > insertionIdx; right--)
|
for (right = list->monList->listCount; right > insertionIdx; right--)
|
||||||
structPtr->monList->monData[right] = structPtr->monList->monData[right - 1];
|
list->monList->monData[right] = list->monList->monData[right - 1];
|
||||||
structPtr->monList->monData[insertionIdx] = *item;
|
list->monList->monData[insertionIdx] = *item;
|
||||||
structPtr->monList->listCount++;
|
list->monList->listCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
@ -374,62 +374,62 @@ static bool32 PlayerHasRibbonsMon(void)
|
|||||||
|
|
||||||
bool32 OpenRibbonsMonList(void)
|
bool32 OpenRibbonsMonList(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *ptr = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU, sizeof(struct PokenavSub10));
|
struct Pokenav_RibbonsMonMenu *menu = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU, sizeof(struct Pokenav_RibbonsMonMenu));
|
||||||
if (ptr == NULL)
|
if (menu == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
ptr->ltid = CreateLoopedTask(LoopedTask_OpenRibbonsMonList, 1);
|
menu->loopedTaskId = CreateLoopedTask(LoopedTask_OpenRibbonsMonList, 1);
|
||||||
ptr->callback = GetRibbonsMonCurrentLoopedTaskActive;
|
menu->callback = GetRibbonsMonCurrentLoopedTaskActive;
|
||||||
ptr->fromSummary = FALSE;
|
menu->fromSummary = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 OpenRibbonsMonListFromRibbonsSummary(void)
|
bool32 OpenRibbonsMonListFromRibbonsSummary(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU, sizeof(struct PokenavSub10));
|
struct Pokenav_RibbonsMonMenu *menu = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU, sizeof(struct Pokenav_RibbonsMonMenu));
|
||||||
if (monMenu == NULL)
|
if (menu == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
monMenu->ltid = CreateLoopedTask(LoopedTask_OpenRibbonsMonList, 1);
|
menu->loopedTaskId = CreateLoopedTask(LoopedTask_OpenRibbonsMonList, 1);
|
||||||
monMenu->callback = GetRibbonsMonCurrentLoopedTaskActive;
|
menu->callback = GetRibbonsMonCurrentLoopedTaskActive;
|
||||||
monMenu->fromSummary = TRUE;
|
menu->fromSummary = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateRibbonsMonListLoopedTask(s32 idx)
|
void CreateRibbonsMonListLoopedTask(s32 idx)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
monMenu->ltid = CreateLoopedTask(sRibbonsMonMenuLoopTaskFuncs[idx], 1);
|
menu->loopedTaskId = CreateLoopedTask(sRibbonsMonMenuLoopTaskFuncs[idx], 1);
|
||||||
monMenu->callback = GetRibbonsMonCurrentLoopedTaskActive;
|
menu->callback = GetRibbonsMonCurrentLoopedTaskActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsRibbonsMonListLoopedTaskActive(void)
|
bool32 IsRibbonsMonListLoopedTaskActive(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
return monMenu->callback();
|
return menu->callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 GetRibbonsMonCurrentLoopedTaskActive(void)
|
bool32 GetRibbonsMonCurrentLoopedTaskActive(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
return IsLoopedTaskActive(ptr->ltid);
|
return IsLoopedTaskActive(menu->loopedTaskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeRibbonsMonList2(void)
|
void FreeRibbonsMonMenu(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
sub_81C8234();
|
sub_81C8234();
|
||||||
RemoveWindow(ptr->winid);
|
RemoveWindow(menu->winid);
|
||||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 LoopedTask_OpenRibbonsMonList(s32 state)
|
static u32 LoopedTask_OpenRibbonsMonList(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
InitBgTemplates(sMonRibbonListBgTemplates, ARRAY_COUNT(sMonRibbonListBgTemplates));
|
InitBgTemplates(sMonRibbonListBgTemplates, ARRAY_COUNT(sMonRibbonListBgTemplates));
|
||||||
DecompressAndCopyTileDataToVram(1, sMonRibbonListFrameTiles, 0, 0, 0);
|
DecompressAndCopyTileDataToVram(1, sMonRibbonListFrameTiles, 0, 0, 0);
|
||||||
SetBgTilemapBuffer(1, monMenu->buff);
|
SetBgTilemapBuffer(1, menu->buff);
|
||||||
CopyToBgTilemapBuffer(1, sMonRibbonListFrameTilemap, 0, 0);
|
CopyToBgTilemapBuffer(1, sMonRibbonListFrameTilemap, 0, 0);
|
||||||
CopyPaletteIntoBufferUnfaded(sMonRibbonListFramePal, 0x10, 0x20);
|
CopyPaletteIntoBufferUnfaded(sMonRibbonListFramePal, 0x10, 0x20);
|
||||||
CopyBgTilemapBufferToVram(1);
|
CopyBgTilemapBufferToVram(1);
|
||||||
@ -452,7 +452,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
|
|||||||
case 3:
|
case 3:
|
||||||
if (sub_81C8224())
|
if (sub_81C8224())
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
AddRibbonsMonListWindow(monMenu);
|
AddRibbonsMonListWindow(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 4:
|
case 4:
|
||||||
if (FreeTempTileDataBuffersIfPossible())
|
if (FreeTempTileDataBuffersIfPossible())
|
||||||
@ -461,7 +461,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
|
|||||||
HideBg(3);
|
HideBg(3);
|
||||||
PrintHelpBarText(HELPBAR_RIBBONS_MON_LIST);
|
PrintHelpBarText(HELPBAR_RIBBONS_MON_LIST);
|
||||||
PokenavFadeScreen(1);
|
PokenavFadeScreen(1);
|
||||||
if (!monMenu->fromSummary)
|
if (!menu->fromSummary)
|
||||||
{
|
{
|
||||||
LoadLeftHeaderGfxForIndex(POKENAV_GFX_RIBBONS_MENU);
|
LoadLeftHeaderGfxForIndex(POKENAV_GFX_RIBBONS_MENU);
|
||||||
ShowLeftHeaderGfx(POKENAV_GFX_RIBBONS_MENU, 1, 0);
|
ShowLeftHeaderGfx(POKENAV_GFX_RIBBONS_MENU, 1, 0);
|
||||||
@ -479,7 +479,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
|
static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -500,7 +500,7 @@ static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
|
|||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case 2:
|
case 2:
|
||||||
sub_81D0288(monMenu);
|
UpdateIndexNumberDisplay(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 3:
|
case 3:
|
||||||
if (IsDma3ManagerBusyWithBgCopy())
|
if (IsDma3ManagerBusyWithBgCopy())
|
||||||
@ -512,7 +512,7 @@ static u32 LoopedTask_RibbonsListMoveCursorUp(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
|
static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -533,7 +533,7 @@ static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
|
|||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case 2:
|
case 2:
|
||||||
sub_81D0288(monMenu);
|
UpdateIndexNumberDisplay(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 3:
|
case 3:
|
||||||
if (IsDma3ManagerBusyWithBgCopy())
|
if (IsDma3ManagerBusyWithBgCopy())
|
||||||
@ -545,7 +545,7 @@ static u32 LoopedTask_RibbonsListMoveCursorDown(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
|
static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -566,7 +566,7 @@ static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
|
|||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case 2:
|
case 2:
|
||||||
sub_81D0288(monMenu);
|
UpdateIndexNumberDisplay(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 3:
|
case 3:
|
||||||
if (IsDma3ManagerBusyWithBgCopy())
|
if (IsDma3ManagerBusyWithBgCopy())
|
||||||
@ -578,7 +578,7 @@ static u32 LoopedTask_RibbonsListMovePageUp(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
|
static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub10 *monMenu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
struct Pokenav_RibbonsMonMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_MON_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -599,7 +599,7 @@ static u32 LoopedTask_RibbonsListMovePageDown(s32 state)
|
|||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case 2:
|
case 2:
|
||||||
sub_81D0288(monMenu);
|
UpdateIndexNumberDisplay(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 3:
|
case 3:
|
||||||
if (IsDma3ManagerBusyWithBgCopy())
|
if (IsDma3ManagerBusyWithBgCopy())
|
||||||
@ -645,34 +645,34 @@ static u32 LoopedTask_RibbonsListOpenSummary(s32 state)
|
|||||||
return LT_FINISH;
|
return LT_FINISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddRibbonsMonListWindow(struct PokenavSub10 *monMenu)
|
static void AddRibbonsMonListWindow(struct Pokenav_RibbonsMonMenu *menu)
|
||||||
{
|
{
|
||||||
s32 r2;
|
s32 listCount;
|
||||||
monMenu->winid = AddWindow(&sRibbonsMonListWindowTemplate);
|
menu->winid = AddWindow(&sRibbonsMonListWindowTemplate);
|
||||||
PutWindowTilemap(monMenu->winid);
|
PutWindowTilemap(menu->winid);
|
||||||
r2 = GetRibbonsMonListCount();
|
listCount = GetRibbonsMonListCount();
|
||||||
sub_81D02B0(monMenu->winid, 0, r2);
|
DrawListIndexNumber(menu->winid, 0, listCount);
|
||||||
CopyWindowToVram(monMenu->winid, COPYWIN_MAP);
|
CopyWindowToVram(menu->winid, COPYWIN_MAP);
|
||||||
sub_81D0288(monMenu);
|
UpdateIndexNumberDisplay(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81D0288(struct PokenavSub10 *monMenu)
|
static void UpdateIndexNumberDisplay(struct Pokenav_RibbonsMonMenu *menu)
|
||||||
{
|
{
|
||||||
s32 r4 = GetSelectedPokenavListIndex();
|
s32 listIndex = GetSelectedPokenavListIndex();
|
||||||
s32 r2 = GetRibbonsMonListCount();
|
s32 listCount = GetRibbonsMonListCount();
|
||||||
sub_81D02B0(monMenu->winid, r4 + 1, r2);
|
DrawListIndexNumber(menu->winid, listIndex + 1, listCount);
|
||||||
CopyWindowToVram(monMenu->winid, COPYWIN_GFX);
|
CopyWindowToVram(menu->winid, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81D02B0(s32 windowId, s32 val1, s32 val2)
|
static void DrawListIndexNumber(s32 windowId, s32 index, s32 max)
|
||||||
{
|
{
|
||||||
u8 strbuf[16];
|
u8 strbuf[16];
|
||||||
u32 x;
|
u32 x;
|
||||||
|
|
||||||
u8 * ptr = strbuf;
|
u8 * ptr = strbuf;
|
||||||
ptr = ConvertIntToDecimalStringN(ptr, val1, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
ptr = ConvertIntToDecimalStringN(ptr, index, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||||
*ptr++ = CHAR_SLASH;
|
*ptr++ = CHAR_SLASH;
|
||||||
ConvertIntToDecimalStringN(ptr, val2, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
ConvertIntToDecimalStringN(ptr, max, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||||
x = GetStringCenterAlignXOffset(FONT_NORMAL, strbuf, 56);
|
x = GetStringCenterAlignXOffset(FONT_NORMAL, strbuf, 56);
|
||||||
AddTextPrinterParameterized(windowId, FONT_NORMAL, strbuf, x, 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(windowId, FONT_NORMAL, strbuf, x, 1, TEXT_SKIP_DRAW, NULL);
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ enum
|
|||||||
#define MON_SPRITE_X_OFF -32
|
#define MON_SPRITE_X_OFF -32
|
||||||
#define MON_SPRITE_Y 104
|
#define MON_SPRITE_Y 104
|
||||||
|
|
||||||
struct PokenavSub13
|
struct Pokenav_RibbonsSummaryList
|
||||||
{
|
{
|
||||||
u8 unused1[8];
|
u8 unused1[8];
|
||||||
struct PokenavSub18 *monList;
|
struct PokenavSub18 *monList;
|
||||||
@ -50,10 +50,10 @@ struct PokenavSub13
|
|||||||
u32 ribbonIds[FIRST_GIFT_RIBBON];
|
u32 ribbonIds[FIRST_GIFT_RIBBON];
|
||||||
u32 giftRibbonIds[NUM_GIFT_RIBBONS];
|
u32 giftRibbonIds[NUM_GIFT_RIBBONS];
|
||||||
u32 unused2;
|
u32 unused2;
|
||||||
u32 (*callback)(struct PokenavSub13 *);
|
u32 (*callback)(struct Pokenav_RibbonsSummaryList *);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PokenavSub14
|
struct Pokenav_RibbonsSummaryMenu
|
||||||
{
|
{
|
||||||
u32 (*callback)(void);
|
u32 (*callback)(void);
|
||||||
u32 loopedTaskId;
|
u32 loopedTaskId;
|
||||||
@ -71,31 +71,31 @@ struct PokenavSub14
|
|||||||
static u32 sRibbonDraw_Total;
|
static u32 sRibbonDraw_Total;
|
||||||
static u32 sRibbonDraw_Current;
|
static u32 sRibbonDraw_Current;
|
||||||
|
|
||||||
static void PrintCurrentMonRibbonCount(struct PokenavSub14 *);
|
static void PrintCurrentMonRibbonCount(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *);
|
static void PrintRibbbonsSummaryMonInfo(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void PrintRibbonsMonListIndex(struct PokenavSub14 *);
|
static void PrintRibbonsMonListIndex(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void ZoomOutSelectedRibbon(struct PokenavSub14 *);
|
static void ZoomOutSelectedRibbon(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void UpdateAndZoomInSelectedRibbon(struct PokenavSub14 *);
|
static void UpdateAndZoomInSelectedRibbon(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void PrintRibbonNameAndDescription(struct PokenavSub14 *);
|
static void PrintRibbonNameAndDescription(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void ResetSpritesAndDrawMonFrontPic(struct PokenavSub14 *);
|
static void ResetSpritesAndDrawMonFrontPic(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void AddRibbonListIndexWindow(struct PokenavSub14 *);
|
static void AddRibbonListIndexWindow(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void DestroyRibbonsMonFrontPic(struct PokenavSub14 *);
|
static void DestroyRibbonsMonFrontPic(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void SlideMonSpriteOff(struct PokenavSub14 *);
|
static void SlideMonSpriteOff(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void SlideMonSpriteOn(struct PokenavSub14 *);
|
static void SlideMonSpriteOn(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void AddRibbonCountWindow(struct PokenavSub14 *);
|
static void AddRibbonCountWindow(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void CreateBigRibbonSprite(struct PokenavSub14 *);
|
static void CreateBigRibbonSprite(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void AddRibbonSummaryMonNameWindow(struct PokenavSub14 *);
|
static void AddRibbonSummaryMonNameWindow(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void DrawAllRibbonsSmall(struct PokenavSub14 *);
|
static void DrawAllRibbonsSmall(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static bool32 IsRibbonAnimating(struct PokenavSub14 *);
|
static bool32 IsRibbonAnimating(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static bool32 IsMonSpriteAnimating(struct PokenavSub14 *);
|
static bool32 IsMonSpriteAnimating(struct Pokenav_RibbonsSummaryMenu *);
|
||||||
static void GetMonRibbons(struct PokenavSub13 *);
|
static void GetMonRibbons(struct Pokenav_RibbonsSummaryList *);
|
||||||
static u32 HandleExpandedRibbonInput(struct PokenavSub13 *);
|
static u32 HandleExpandedRibbonInput(struct Pokenav_RibbonsSummaryList *);
|
||||||
static u32 RibbonsSummaryHandleInput(struct PokenavSub13 *);
|
static u32 RibbonsSummaryHandleInput(struct Pokenav_RibbonsSummaryList *);
|
||||||
static u32 ReturnToRibbonsListFromSummary(struct PokenavSub13 *);
|
static u32 ReturnToRibbonsListFromSummary(struct Pokenav_RibbonsSummaryList *);
|
||||||
static bool32 TrySelectRibbonUp(struct PokenavSub13 *);
|
static bool32 TrySelectRibbonUp(struct Pokenav_RibbonsSummaryList *);
|
||||||
static bool32 TrySelectRibbonRight(struct PokenavSub13 *);
|
static bool32 TrySelectRibbonRight(struct Pokenav_RibbonsSummaryList *);
|
||||||
static bool32 TrySelectRibbonLeft(struct PokenavSub13 *);
|
static bool32 TrySelectRibbonLeft(struct Pokenav_RibbonsSummaryList *);
|
||||||
static bool32 TrySelectRibbonDown(struct PokenavSub13 *);
|
static bool32 TrySelectRibbonDown(struct Pokenav_RibbonsSummaryList *);
|
||||||
static bool32 GetCurrentLoopedTaskActive(void);
|
static bool32 GetCurrentLoopedTaskActive(void);
|
||||||
static u32 GetRibbonsSummaryCurrentIndex(void);
|
static u32 GetRibbonsSummaryCurrentIndex(void);
|
||||||
static u32 GetRibbonsSummaryMonListCount(void);
|
static u32 GetRibbonsSummaryMonListCount(void);
|
||||||
@ -186,16 +186,16 @@ static const LoopedTask sRibbonsSummaryMenuLoopTaskFuncs[] =
|
|||||||
|
|
||||||
bool32 PokenavCallback_Init_RibbonsSummaryMenu(void)
|
bool32 PokenavCallback_Init_RibbonsSummaryMenu(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST, sizeof(struct PokenavSub13));
|
struct Pokenav_RibbonsSummaryList *list = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST, sizeof(struct Pokenav_RibbonsSummaryList));
|
||||||
if (structPtr == NULL)
|
if (list == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
structPtr->monList = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
list->monList = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||||
if (structPtr->monList == NULL)
|
if (list->monList == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GetMonRibbons(structPtr);
|
GetMonRibbons(list);
|
||||||
structPtr->callback = RibbonsSummaryHandleInput;
|
list->callback = RibbonsSummaryHandleInput;
|
||||||
gKeyRepeatContinueDelay = 3;
|
gKeyRepeatContinueDelay = 3;
|
||||||
gKeyRepeatStartDelay = 10;
|
gKeyRepeatStartDelay = 10;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -203,8 +203,8 @@ bool32 PokenavCallback_Init_RibbonsSummaryMenu(void)
|
|||||||
|
|
||||||
u32 GetRibbonsSummaryMenuCallback(void)
|
u32 GetRibbonsSummaryMenuCallback(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
return structPtr->callback(structPtr);
|
return list->callback(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeRibbonsSummaryScreen1(void)
|
void FreeRibbonsSummaryScreen1(void)
|
||||||
@ -213,150 +213,150 @@ void FreeRibbonsSummaryScreen1(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handles input when a specific ribbon is not currently selected
|
// Handles input when a specific ribbon is not currently selected
|
||||||
static u32 RibbonsSummaryHandleInput(struct PokenavSub13 *structPtr)
|
static u32 RibbonsSummaryHandleInput(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
// Handle Up/Down movement to select a new Pokémon to show ribbons for
|
// Handle Up/Down movement to select a new Pokémon to show ribbons for
|
||||||
if (JOY_REPEAT(DPAD_UP) && structPtr->monList->currIndex != 0)
|
if (JOY_REPEAT(DPAD_UP) && list->monList->currIndex != 0)
|
||||||
{
|
{
|
||||||
structPtr->monList->currIndex--;
|
list->monList->currIndex--;
|
||||||
structPtr->selectedPos = 0;
|
list->selectedPos = 0;
|
||||||
GetMonRibbons(structPtr);
|
GetMonRibbons(list);
|
||||||
return RIBBONS_SUMMARY_FUNC_SWITCH_MONS;
|
return RIBBONS_SUMMARY_FUNC_SWITCH_MONS;
|
||||||
}
|
}
|
||||||
if (JOY_REPEAT(DPAD_DOWN) && structPtr->monList->currIndex < structPtr->monList->listCount - 1)
|
if (JOY_REPEAT(DPAD_DOWN) && list->monList->currIndex < list->monList->listCount - 1)
|
||||||
{
|
{
|
||||||
structPtr->monList->currIndex++;
|
list->monList->currIndex++;
|
||||||
structPtr->selectedPos = 0;
|
list->selectedPos = 0;
|
||||||
GetMonRibbons(structPtr);
|
GetMonRibbons(list);
|
||||||
return RIBBONS_SUMMARY_FUNC_SWITCH_MONS;
|
return RIBBONS_SUMMARY_FUNC_SWITCH_MONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JOY_NEW(A_BUTTON))
|
if (JOY_NEW(A_BUTTON))
|
||||||
{
|
{
|
||||||
// Enter ribbon selection
|
// Enter ribbon selection
|
||||||
structPtr->callback = HandleExpandedRibbonInput;
|
list->callback = HandleExpandedRibbonInput;
|
||||||
return RIBBONS_SUMMARY_FUNC_SELECT_RIBBON;
|
return RIBBONS_SUMMARY_FUNC_SELECT_RIBBON;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (JOY_NEW(B_BUTTON))
|
||||||
{
|
{
|
||||||
// Exit ribbon summary menu
|
// Exit ribbon summary menu
|
||||||
structPtr->callback = ReturnToRibbonsListFromSummary;
|
list->callback = ReturnToRibbonsListFromSummary;
|
||||||
return RIBBONS_SUMMARY_FUNC_EXIT;
|
return RIBBONS_SUMMARY_FUNC_EXIT;
|
||||||
}
|
}
|
||||||
return RIBBONS_SUMMARY_FUNC_NONE;
|
return RIBBONS_SUMMARY_FUNC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles input when a ribbon is selected
|
// Handles input when a ribbon is selected
|
||||||
static u32 HandleExpandedRibbonInput(struct PokenavSub13 *structPtr)
|
static u32 HandleExpandedRibbonInput(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
// Handle movement while a ribbon is selected
|
// Handle movement while a ribbon is selected
|
||||||
if (JOY_REPEAT(DPAD_UP) && TrySelectRibbonUp(structPtr))
|
if (JOY_REPEAT(DPAD_UP) && TrySelectRibbonUp(list))
|
||||||
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
||||||
if (JOY_REPEAT(DPAD_DOWN) && TrySelectRibbonDown(structPtr))
|
if (JOY_REPEAT(DPAD_DOWN) && TrySelectRibbonDown(list))
|
||||||
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
||||||
if (JOY_REPEAT(DPAD_LEFT) && TrySelectRibbonLeft(structPtr))
|
if (JOY_REPEAT(DPAD_LEFT) && TrySelectRibbonLeft(list))
|
||||||
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
||||||
if (JOY_REPEAT(DPAD_RIGHT) && TrySelectRibbonRight(structPtr))
|
if (JOY_REPEAT(DPAD_RIGHT) && TrySelectRibbonRight(list))
|
||||||
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
return RIBBONS_SUMMARY_FUNC_EXPANDED_CURSOR_MOVE;
|
||||||
|
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (JOY_NEW(B_BUTTON))
|
||||||
{
|
{
|
||||||
// Exit ribbon selection
|
// Exit ribbon selection
|
||||||
structPtr->callback = RibbonsSummaryHandleInput;
|
list->callback = RibbonsSummaryHandleInput;
|
||||||
return RIBBONS_SUMMARY_FUNC_EXPANDED_CANCEL;
|
return RIBBONS_SUMMARY_FUNC_EXPANDED_CANCEL;
|
||||||
}
|
}
|
||||||
return RIBBONS_SUMMARY_FUNC_NONE;
|
return RIBBONS_SUMMARY_FUNC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 ReturnToRibbonsListFromSummary(struct PokenavSub13 *structPtr)
|
static u32 ReturnToRibbonsListFromSummary(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
return POKENAV_RIBBONS_RETURN_TO_MON_LIST;
|
return POKENAV_RIBBONS_RETURN_TO_MON_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 TrySelectRibbonUp(struct PokenavSub13 *structPtr)
|
static bool32 TrySelectRibbonUp(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
if (structPtr->selectedPos < FIRST_GIFT_RIBBON)
|
if (list->selectedPos < FIRST_GIFT_RIBBON)
|
||||||
{
|
{
|
||||||
// In normal ribbons, try to move up a row
|
// In normal ribbons, try to move up a row
|
||||||
if (structPtr->selectedPos < RIBBONS_PER_ROW)
|
if (list->selectedPos < RIBBONS_PER_ROW)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
structPtr->selectedPos -= RIBBONS_PER_ROW;
|
list->selectedPos -= RIBBONS_PER_ROW;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (structPtr->numNormalRibbons != 0)
|
if (list->numNormalRibbons != 0)
|
||||||
{
|
{
|
||||||
// In gift ribbons, try to move up into normal ribbons
|
// In gift ribbons, try to move up into normal ribbons
|
||||||
// If there's > 1 row of gift ribbons (not normally possible)
|
// If there's > 1 row of gift ribbons (not normally possible)
|
||||||
// it's impossible to move up between them
|
// it's impossible to move up between them
|
||||||
u32 ribbonPos = structPtr->selectedPos - GIFT_RIBBON_START_POS;
|
u32 ribbonPos = list->selectedPos - GIFT_RIBBON_START_POS;
|
||||||
structPtr->selectedPos = ribbonPos + structPtr->normalRibbonLastRowStart;
|
list->selectedPos = ribbonPos + list->normalRibbonLastRowStart;
|
||||||
if (structPtr->selectedPos >= structPtr->numNormalRibbons)
|
if (list->selectedPos >= list->numNormalRibbons)
|
||||||
structPtr->selectedPos = structPtr->numNormalRibbons - 1;
|
list->selectedPos = list->numNormalRibbons - 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 TrySelectRibbonDown(struct PokenavSub13 *structPtr)
|
static bool32 TrySelectRibbonDown(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
if (structPtr->selectedPos >= FIRST_GIFT_RIBBON)
|
if (list->selectedPos >= FIRST_GIFT_RIBBON)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (structPtr->selectedPos < structPtr->normalRibbonLastRowStart)
|
if (list->selectedPos < list->normalRibbonLastRowStart)
|
||||||
{
|
{
|
||||||
// Not in last row of normal ribbons, advance to next row
|
// Not in last row of normal ribbons, advance to next row
|
||||||
structPtr->selectedPos += RIBBONS_PER_ROW;
|
list->selectedPos += RIBBONS_PER_ROW;
|
||||||
if (structPtr->selectedPos >= structPtr->numNormalRibbons)
|
if (list->selectedPos >= list->numNormalRibbons)
|
||||||
structPtr->selectedPos = structPtr->numNormalRibbons - 1;
|
list->selectedPos = list->numNormalRibbons - 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (structPtr->numGiftRibbons != 0)
|
if (list->numGiftRibbons != 0)
|
||||||
{
|
{
|
||||||
// In/beyond last of row of normal ribbons and gift ribbons present, move down to gift ribbon row
|
// In/beyond last of row of normal ribbons and gift ribbons present, move down to gift ribbon row
|
||||||
int ribbonPos = structPtr->selectedPos - structPtr->normalRibbonLastRowStart;
|
int ribbonPos = list->selectedPos - list->normalRibbonLastRowStart;
|
||||||
if (ribbonPos >= structPtr->numGiftRibbons)
|
if (ribbonPos >= list->numGiftRibbons)
|
||||||
ribbonPos = structPtr->numGiftRibbons - 1;
|
ribbonPos = list->numGiftRibbons - 1;
|
||||||
|
|
||||||
structPtr->selectedPos = ribbonPos + GIFT_RIBBON_START_POS;
|
list->selectedPos = ribbonPos + GIFT_RIBBON_START_POS;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 TrySelectRibbonLeft(struct PokenavSub13 *structPtr)
|
static bool32 TrySelectRibbonLeft(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
u16 column = structPtr->selectedPos % RIBBONS_PER_ROW;
|
u16 column = list->selectedPos % RIBBONS_PER_ROW;
|
||||||
if (column != 0)
|
if (column != 0)
|
||||||
{
|
{
|
||||||
structPtr->selectedPos--;
|
list->selectedPos--;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 TrySelectRibbonRight(struct PokenavSub13 *structPtr)
|
static bool32 TrySelectRibbonRight(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
int column = structPtr->selectedPos % RIBBONS_PER_ROW;
|
int column = list->selectedPos % RIBBONS_PER_ROW;
|
||||||
|
|
||||||
if (column >= RIBBONS_PER_ROW - 1)
|
if (column >= RIBBONS_PER_ROW - 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (structPtr->selectedPos < GIFT_RIBBON_START_POS)
|
if (list->selectedPos < GIFT_RIBBON_START_POS)
|
||||||
{
|
{
|
||||||
// Move right in normal ribbon row
|
// Move right in normal ribbon row
|
||||||
if (structPtr->selectedPos < structPtr->numNormalRibbons - 1)
|
if (list->selectedPos < list->numNormalRibbons - 1)
|
||||||
{
|
{
|
||||||
structPtr->selectedPos++;
|
list->selectedPos++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Move right in gift ribbon row
|
// Move right in gift ribbon row
|
||||||
if (column < structPtr->numGiftRibbons - 1)
|
if (column < list->numGiftRibbons - 1)
|
||||||
{
|
{
|
||||||
structPtr->selectedPos++;
|
list->selectedPos++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,20 +365,20 @@ static bool32 TrySelectRibbonRight(struct PokenavSub13 *structPtr)
|
|||||||
|
|
||||||
static u32 GetRibbonsSummaryCurrentIndex(void)
|
static u32 GetRibbonsSummaryCurrentIndex(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
return structPtr->monList->currIndex;
|
return list->monList->currIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 GetRibbonsSummaryMonListCount(void)
|
static u32 GetRibbonsSummaryMonListCount(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
return structPtr->monList->listCount;
|
return list->monList->listCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetMonNicknameLevelGender(u8 *nick, u8 *level, u8 *gender)
|
static void GetMonNicknameLevelGender(u8 *nick, u8 *level, u8 *gender)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
struct PokenavSub18 *mons = structPtr->monList;
|
struct PokenavSub18 *mons = list->monList;
|
||||||
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
||||||
|
|
||||||
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
||||||
@ -402,8 +402,8 @@ static void GetMonNicknameLevelGender(u8 *nick, u8 *level, u8 *gender)
|
|||||||
|
|
||||||
static void GetMonSpeciesPersonalityOtId(u16 *species, u32 *personality, u32 *otId)
|
static void GetMonSpeciesPersonalityOtId(u16 *species, u32 *personality, u32 *otId)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
struct PokenavSub18 *mons = structPtr->monList;
|
struct PokenavSub18 *mons = list->monList;
|
||||||
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
||||||
|
|
||||||
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
||||||
@ -426,8 +426,8 @@ static void GetMonSpeciesPersonalityOtId(u16 *species, u32 *personality, u32 *ot
|
|||||||
|
|
||||||
static u32 GetCurrMonRibbonCount(void)
|
static u32 GetCurrMonRibbonCount(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
struct PokenavSub18 *mons = structPtr->monList;
|
struct PokenavSub18 *mons = list->monList;
|
||||||
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
||||||
|
|
||||||
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
||||||
@ -436,11 +436,11 @@ static u32 GetCurrMonRibbonCount(void)
|
|||||||
return GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBON_COUNT);
|
return GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBON_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetMonRibbons(struct PokenavSub13 *structPtr)
|
static void GetMonRibbons(struct Pokenav_RibbonsSummaryList *list)
|
||||||
{
|
{
|
||||||
u32 ribbonFlags;
|
u32 ribbonFlags;
|
||||||
s32 i, j;
|
s32 i, j;
|
||||||
struct PokenavSub18 *mons = structPtr->monList;
|
struct PokenavSub18 *mons = list->monList;
|
||||||
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
struct PokenavMonList *monInfo = &mons->monData[mons->currIndex];
|
||||||
|
|
||||||
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
if (monInfo->boxId == TOTAL_BOXES_COUNT)
|
||||||
@ -448,8 +448,8 @@ static void GetMonRibbons(struct PokenavSub13 *structPtr)
|
|||||||
else
|
else
|
||||||
ribbonFlags = GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBONS);
|
ribbonFlags = GetBoxMonDataAt(monInfo->boxId, monInfo->monId, MON_DATA_RIBBONS);
|
||||||
|
|
||||||
structPtr->numNormalRibbons = 0;
|
list->numNormalRibbons = 0;
|
||||||
structPtr->numGiftRibbons = 0;
|
list->numGiftRibbons = 0;
|
||||||
for (i = 0; i < ARRAY_COUNT(sRibbonData); i++)
|
for (i = 0; i < ARRAY_COUNT(sRibbonData); i++)
|
||||||
{
|
{
|
||||||
// For all non-contest ribbons, numRibbons will be 1 if they have it, 0 if they don't
|
// For all non-contest ribbons, numRibbons will be 1 if they have it, 0 if they don't
|
||||||
@ -458,119 +458,119 @@ static void GetMonRibbons(struct PokenavSub13 *structPtr)
|
|||||||
if (!sRibbonData[i].isGiftRibbon)
|
if (!sRibbonData[i].isGiftRibbon)
|
||||||
{
|
{
|
||||||
for (j = 0; j < numRibbons; j++)
|
for (j = 0; j < numRibbons; j++)
|
||||||
structPtr->ribbonIds[structPtr->numNormalRibbons++] = sRibbonData[i].ribbonId + j;
|
list->ribbonIds[list->numNormalRibbons++] = sRibbonData[i].ribbonId + j;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (j = 0; j < numRibbons; j++)
|
for (j = 0; j < numRibbons; j++)
|
||||||
structPtr->giftRibbonIds[structPtr->numGiftRibbons++] = sRibbonData[i].ribbonId + j;
|
list->giftRibbonIds[list->numGiftRibbons++] = sRibbonData[i].ribbonId + j;
|
||||||
}
|
}
|
||||||
ribbonFlags >>= sRibbonData[i].numBits;
|
ribbonFlags >>= sRibbonData[i].numBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (structPtr->numNormalRibbons != 0)
|
if (list->numNormalRibbons != 0)
|
||||||
{
|
{
|
||||||
structPtr->normalRibbonLastRowStart = ((structPtr->numNormalRibbons - 1) / RIBBONS_PER_ROW) * RIBBONS_PER_ROW;
|
list->normalRibbonLastRowStart = ((list->numNormalRibbons - 1) / RIBBONS_PER_ROW) * RIBBONS_PER_ROW;
|
||||||
structPtr->selectedPos = 0;
|
list->selectedPos = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// There are no normal ribbons, move cursor to first gift ribbon
|
// There are no normal ribbons, move cursor to first gift ribbon
|
||||||
structPtr->normalRibbonLastRowStart = 0;
|
list->normalRibbonLastRowStart = 0;
|
||||||
structPtr->selectedPos = GIFT_RIBBON_START_POS;
|
list->selectedPos = GIFT_RIBBON_START_POS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 *GetNormalRibbonIds(u32 *size)
|
static u32 *GetNormalRibbonIds(u32 *size)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
*size = structPtr->numNormalRibbons;
|
*size = list->numNormalRibbons;
|
||||||
return structPtr->ribbonIds;
|
return list->ribbonIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 *GetGiftRibbonIds(u32 *size)
|
static u32 *GetGiftRibbonIds(u32 *size)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
*size = structPtr->numGiftRibbons;
|
*size = list->numGiftRibbons;
|
||||||
return structPtr->giftRibbonIds;
|
return list->giftRibbonIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u16 GetSelectedPosition(void)
|
static u16 GetSelectedPosition(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
return structPtr->selectedPos;
|
return list->selectedPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 GetRibbonId(void)
|
static u32 GetRibbonId(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub13 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
struct Pokenav_RibbonsSummaryList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST);
|
||||||
int ribbonPos = structPtr->selectedPos;
|
int ribbonPos = list->selectedPos;
|
||||||
if (ribbonPos < FIRST_GIFT_RIBBON)
|
if (ribbonPos < FIRST_GIFT_RIBBON)
|
||||||
return structPtr->ribbonIds[ribbonPos];
|
return list->ribbonIds[ribbonPos];
|
||||||
else
|
else
|
||||||
return structPtr->giftRibbonIds[ribbonPos - GIFT_RIBBON_START_POS];
|
return list->giftRibbonIds[ribbonPos - GIFT_RIBBON_START_POS];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 OpenRibbonsSummaryMenu(void)
|
bool32 OpenRibbonsSummaryMenu(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU, sizeof(struct PokenavSub14));
|
struct Pokenav_RibbonsSummaryMenu *menu = AllocSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU, sizeof(struct Pokenav_RibbonsSummaryMenu));
|
||||||
if (structPtr == NULL)
|
if (menu == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_OpenRibbonsSummaryMenu, 1);
|
menu->loopedTaskId = CreateLoopedTask(LoopedTask_OpenRibbonsSummaryMenu, 1);
|
||||||
structPtr->callback = GetCurrentLoopedTaskActive;
|
menu->callback = GetCurrentLoopedTaskActive;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateRibbonsSummaryLoopedTask(s32 id)
|
void CreateRibbonsSummaryLoopedTask(s32 id)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
structPtr->loopedTaskId = CreateLoopedTask(sRibbonsSummaryMenuLoopTaskFuncs[id], 1);
|
menu->loopedTaskId = CreateLoopedTask(sRibbonsSummaryMenuLoopTaskFuncs[id], 1);
|
||||||
structPtr->callback = GetCurrentLoopedTaskActive;
|
menu->callback = GetCurrentLoopedTaskActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 IsRibbonsSummaryLoopedTaskActive(void)
|
u32 IsRibbonsSummaryLoopedTaskActive(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
return structPtr->callback();
|
return menu->callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FreeRibbonsSummaryScreen2(void)
|
void FreeRibbonsSummaryScreen2(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
RemoveWindow(structPtr->ribbonCountWindowId);
|
RemoveWindow(menu->ribbonCountWindowId);
|
||||||
RemoveWindow(structPtr->nameWindowId);
|
RemoveWindow(menu->nameWindowId);
|
||||||
RemoveWindow(structPtr->listIdxWindowId);
|
RemoveWindow(menu->listIdxWindowId);
|
||||||
#ifndef BUGFIX
|
#ifndef BUGFIX
|
||||||
RemoveWindow(structPtr->unusedWindowId); // Removing window, but window id is never set
|
RemoveWindow(menu->unusedWindowId); // Removing window, but window id is never set
|
||||||
#endif
|
#endif
|
||||||
DestroyRibbonsMonFrontPic(structPtr);
|
DestroyRibbonsMonFrontPic(menu);
|
||||||
FreeSpriteTilesByTag(GFXTAG_RIBBON_ICONS_BIG);
|
FreeSpriteTilesByTag(GFXTAG_RIBBON_ICONS_BIG);
|
||||||
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_1);
|
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_1);
|
||||||
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_2);
|
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_2);
|
||||||
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_3);
|
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_3);
|
||||||
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_4);
|
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_4);
|
||||||
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_5);
|
FreeSpritePaletteByTag(PALTAG_RIBBON_ICONS_5);
|
||||||
FreeSpriteOamMatrix(structPtr->bigRibbonSprite);
|
FreeSpriteOamMatrix(menu->bigRibbonSprite);
|
||||||
DestroySprite(structPtr->bigRibbonSprite);
|
DestroySprite(menu->bigRibbonSprite);
|
||||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
FreePokenavSubstruct(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 GetCurrentLoopedTaskActive(void)
|
static bool32 GetCurrentLoopedTaskActive(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
return IsLoopedTaskActive(structPtr->loopedTaskId);
|
return IsLoopedTaskActive(menu->loopedTaskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
|
static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
InitBgTemplates(sBgTemplates, ARRAY_COUNT(sBgTemplates));
|
InitBgTemplates(sBgTemplates, ARRAY_COUNT(sBgTemplates));
|
||||||
DecompressAndCopyTileDataToVram(2, gPokenavRibbonsSummaryBg_Gfx, 0, 0, 0);
|
DecompressAndCopyTileDataToVram(2, gPokenavRibbonsSummaryBg_Gfx, 0, 0, 0);
|
||||||
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[0]);
|
SetBgTilemapBuffer(2, menu->tilemapBuffers[0]);
|
||||||
CopyToBgTilemapBuffer(2, gPokenavRibbonsSummaryBg_Tilemap, 0, 0);
|
CopyToBgTilemapBuffer(2, gPokenavRibbonsSummaryBg_Tilemap, 0, 0);
|
||||||
CopyPaletteIntoBufferUnfaded(gPokenavRibbonsSummaryBg_Pal, 0x10, 0x20);
|
CopyPaletteIntoBufferUnfaded(gPokenavRibbonsSummaryBg_Pal, 0x10, 0x20);
|
||||||
CopyBgTilemapBufferToVram(2);
|
CopyBgTilemapBufferToVram(2);
|
||||||
@ -580,7 +580,7 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
|
|||||||
{
|
{
|
||||||
BgDmaFill(1, 0, 0, 1);
|
BgDmaFill(1, 0, 0, 1);
|
||||||
DecompressAndCopyTileDataToVram(1, sRibbonIconsSmall_Gfx, 0, 1, 0);
|
DecompressAndCopyTileDataToVram(1, sRibbonIconsSmall_Gfx, 0, 1, 0);
|
||||||
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
|
SetBgTilemapBuffer(1, menu->tilemapBuffers[1]);
|
||||||
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
|
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
|
||||||
CopyPaletteIntoBufferUnfaded(sRibbonIcons1_Pal, 0x20, 0xA0);
|
CopyPaletteIntoBufferUnfaded(sRibbonIcons1_Pal, 0x20, 0xA0);
|
||||||
CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, 0xA0, 0x20);
|
CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, 0xA0, 0x20);
|
||||||
@ -591,21 +591,21 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
|
|||||||
case 2:
|
case 2:
|
||||||
if (!FreeTempTileDataBuffersIfPossible())
|
if (!FreeTempTileDataBuffersIfPossible())
|
||||||
{
|
{
|
||||||
AddRibbonCountWindow(structPtr);
|
AddRibbonCountWindow(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 3:
|
case 3:
|
||||||
if (!FreeTempTileDataBuffersIfPossible())
|
if (!FreeTempTileDataBuffersIfPossible())
|
||||||
{
|
{
|
||||||
AddRibbonSummaryMonNameWindow(structPtr);
|
AddRibbonSummaryMonNameWindow(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 4:
|
case 4:
|
||||||
if (!FreeTempTileDataBuffersIfPossible())
|
if (!FreeTempTileDataBuffersIfPossible())
|
||||||
{
|
{
|
||||||
AddRibbonListIndexWindow(structPtr);
|
AddRibbonListIndexWindow(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
@ -619,18 +619,18 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
|
|||||||
case 6:
|
case 6:
|
||||||
if (!IsDma3ManagerBusyWithBgCopy())
|
if (!IsDma3ManagerBusyWithBgCopy())
|
||||||
{
|
{
|
||||||
ResetSpritesAndDrawMonFrontPic(structPtr);
|
ResetSpritesAndDrawMonFrontPic(menu);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 7:
|
case 7:
|
||||||
DrawAllRibbonsSmall(structPtr);
|
DrawAllRibbonsSmall(menu);
|
||||||
PrintHelpBarText(HELPBAR_RIBBONS_LIST);
|
PrintHelpBarText(HELPBAR_RIBBONS_LIST);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 8:
|
case 8:
|
||||||
if (!IsDma3ManagerBusyWithBgCopy())
|
if (!IsDma3ManagerBusyWithBgCopy())
|
||||||
{
|
{
|
||||||
CreateBigRibbonSprite(structPtr);
|
CreateBigRibbonSprite(menu);
|
||||||
ChangeBgX(1, 0, BG_COORD_SET);
|
ChangeBgX(1, 0, BG_COORD_SET);
|
||||||
ChangeBgY(1, 0, BG_COORD_SET);
|
ChangeBgY(1, 0, BG_COORD_SET);
|
||||||
ChangeBgX(2, 0, BG_COORD_SET);
|
ChangeBgX(2, 0, BG_COORD_SET);
|
||||||
@ -667,38 +667,38 @@ static u32 LoopedTask_ExitRibbonsSummaryMenu(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_SwitchRibbonsSummaryMon(s32 state)
|
static u32 LoopedTask_SwitchRibbonsSummaryMon(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
SlideMonSpriteOff(structPtr);
|
SlideMonSpriteOff(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 1:
|
case 1:
|
||||||
if (!IsMonSpriteAnimating(structPtr))
|
if (!IsMonSpriteAnimating(menu))
|
||||||
{
|
{
|
||||||
PrintRibbbonsSummaryMonInfo(structPtr);
|
PrintRibbbonsSummaryMonInfo(menu);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 2:
|
case 2:
|
||||||
DrawAllRibbonsSmall(structPtr);
|
DrawAllRibbonsSmall(menu);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 3:
|
case 3:
|
||||||
PrintRibbonsMonListIndex(structPtr);
|
PrintRibbonsMonListIndex(menu);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 4:
|
case 4:
|
||||||
PrintCurrentMonRibbonCount(structPtr);
|
PrintCurrentMonRibbonCount(menu);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 5:
|
case 5:
|
||||||
if (!IsDma3ManagerBusyWithBgCopy())
|
if (!IsDma3ManagerBusyWithBgCopy())
|
||||||
{
|
{
|
||||||
SlideMonSpriteOn(structPtr);
|
SlideMonSpriteOn(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 6:
|
case 6:
|
||||||
if (IsMonSpriteAnimating(structPtr))
|
if (IsMonSpriteAnimating(menu))
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_FINISH;
|
return LT_FINISH;
|
||||||
@ -706,17 +706,17 @@ static u32 LoopedTask_SwitchRibbonsSummaryMon(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_ExpandSelectedRibbon(s32 state)
|
static u32 LoopedTask_ExpandSelectedRibbon(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
UpdateAndZoomInSelectedRibbon(structPtr);
|
UpdateAndZoomInSelectedRibbon(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 1:
|
case 1:
|
||||||
if (!IsRibbonAnimating(structPtr))
|
if (!IsRibbonAnimating(menu))
|
||||||
{
|
{
|
||||||
PrintRibbonNameAndDescription(structPtr);
|
PrintRibbonNameAndDescription(menu);
|
||||||
PrintHelpBarText(HELPBAR_RIBBONS_CHECK);
|
PrintHelpBarText(HELPBAR_RIBBONS_CHECK);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
@ -730,24 +730,24 @@ static u32 LoopedTask_ExpandSelectedRibbon(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state)
|
static u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ZoomOutSelectedRibbon(structPtr);
|
ZoomOutSelectedRibbon(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 1:
|
case 1:
|
||||||
if (!IsRibbonAnimating(structPtr))
|
if (!IsRibbonAnimating(menu))
|
||||||
{
|
{
|
||||||
UpdateAndZoomInSelectedRibbon(structPtr);
|
UpdateAndZoomInSelectedRibbon(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 2:
|
case 2:
|
||||||
if (!IsRibbonAnimating(structPtr))
|
if (!IsRibbonAnimating(menu))
|
||||||
{
|
{
|
||||||
PrintRibbonNameAndDescription(structPtr);
|
PrintRibbonNameAndDescription(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
@ -760,17 +760,17 @@ static u32 LoopedTask_MoveRibbonsCursorExpanded(s32 state)
|
|||||||
|
|
||||||
static u32 LoopedTask_ShrinkExpandedRibbon(s32 state)
|
static u32 LoopedTask_ShrinkExpandedRibbon(s32 state)
|
||||||
{
|
{
|
||||||
struct PokenavSub14 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
struct Pokenav_RibbonsSummaryMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU);
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
ZoomOutSelectedRibbon(structPtr);
|
ZoomOutSelectedRibbon(menu);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 1:
|
case 1:
|
||||||
if (!IsRibbonAnimating(structPtr))
|
if (!IsRibbonAnimating(menu))
|
||||||
{
|
{
|
||||||
PrintCurrentMonRibbonCount(structPtr);
|
PrintCurrentMonRibbonCount(menu);
|
||||||
PrintHelpBarText(HELPBAR_RIBBONS_LIST);
|
PrintHelpBarText(HELPBAR_RIBBONS_LIST);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
}
|
}
|
||||||
@ -793,14 +793,14 @@ static const struct WindowTemplate sRibbonCountWindowTemplate =
|
|||||||
.baseBlock = 0x14,
|
.baseBlock = 0x14,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AddRibbonCountWindow(struct PokenavSub14 *structPtr)
|
static void AddRibbonCountWindow(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
structPtr->ribbonCountWindowId = AddWindow(&sRibbonCountWindowTemplate);
|
menu->ribbonCountWindowId = AddWindow(&sRibbonCountWindowTemplate);
|
||||||
PutWindowTilemap(structPtr->ribbonCountWindowId);
|
PutWindowTilemap(menu->ribbonCountWindowId);
|
||||||
PrintCurrentMonRibbonCount(structPtr);
|
PrintCurrentMonRibbonCount(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr)
|
static void PrintCurrentMonRibbonCount(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
u8 color[] = {TEXT_COLOR_RED, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY};
|
u8 color[] = {TEXT_COLOR_RED, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY};
|
||||||
|
|
||||||
@ -808,23 +808,23 @@ static void PrintCurrentMonRibbonCount(struct PokenavSub14 *structPtr)
|
|||||||
DynamicPlaceholderTextUtil_Reset();
|
DynamicPlaceholderTextUtil_Reset();
|
||||||
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
|
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
|
||||||
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_RibbonsF700);
|
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_RibbonsF700);
|
||||||
FillWindowPixelBuffer(structPtr->ribbonCountWindowId, PIXEL_FILL(4));
|
FillWindowPixelBuffer(menu->ribbonCountWindowId, PIXEL_FILL(4));
|
||||||
AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, FONT_NORMAL, 0, 1, color, TEXT_SKIP_DRAW, gStringVar4);
|
AddTextPrinterParameterized3(menu->ribbonCountWindowId, FONT_NORMAL, 0, 1, color, TEXT_SKIP_DRAW, gStringVar4);
|
||||||
CopyWindowToVram(structPtr->ribbonCountWindowId, COPYWIN_GFX);
|
CopyWindowToVram(menu->ribbonCountWindowId, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintRibbonNameAndDescription(struct PokenavSub14 *structPtr)
|
static void PrintRibbonNameAndDescription(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
u32 ribbonId = GetRibbonId();
|
u32 ribbonId = GetRibbonId();
|
||||||
u8 color[] = {TEXT_COLOR_RED, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY};
|
u8 color[] = {TEXT_COLOR_RED, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY};
|
||||||
|
|
||||||
FillWindowPixelBuffer(structPtr->ribbonCountWindowId, PIXEL_FILL(4));
|
FillWindowPixelBuffer(menu->ribbonCountWindowId, PIXEL_FILL(4));
|
||||||
if (ribbonId < FIRST_GIFT_RIBBON)
|
if (ribbonId < FIRST_GIFT_RIBBON)
|
||||||
{
|
{
|
||||||
// Print normal ribbon name/description
|
// Print normal ribbon name/description
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, FONT_NORMAL, 0, (i * 16) + 1, color, TEXT_SKIP_DRAW, gRibbonDescriptionPointers[ribbonId][i]);
|
AddTextPrinterParameterized3(menu->ribbonCountWindowId, FONT_NORMAL, 0, (i * 16) + 1, color, TEXT_SKIP_DRAW, gRibbonDescriptionPointers[ribbonId][i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -840,10 +840,10 @@ static void PrintRibbonNameAndDescription(struct PokenavSub14 *structPtr)
|
|||||||
// Print gift ribbon name/description
|
// Print gift ribbon name/description
|
||||||
ribbonId--;
|
ribbonId--;
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
AddTextPrinterParameterized3(structPtr->ribbonCountWindowId, FONT_NORMAL, 0, (i * 16) + 1, color, TEXT_SKIP_DRAW, gGiftRibbonDescriptionPointers[ribbonId][i]);
|
AddTextPrinterParameterized3(menu->ribbonCountWindowId, FONT_NORMAL, 0, (i * 16) + 1, color, TEXT_SKIP_DRAW, gGiftRibbonDescriptionPointers[ribbonId][i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyWindowToVram(structPtr->ribbonCountWindowId, COPYWIN_GFX);
|
CopyWindowToVram(menu->ribbonCountWindowId, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct WindowTemplate sRibbonSummaryMonNameWindowTemplate =
|
static const struct WindowTemplate sRibbonSummaryMonNameWindowTemplate =
|
||||||
@ -857,23 +857,23 @@ static const struct WindowTemplate sRibbonSummaryMonNameWindowTemplate =
|
|||||||
.baseBlock = 0x54,
|
.baseBlock = 0x54,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AddRibbonSummaryMonNameWindow(struct PokenavSub14 *structPtr)
|
static void AddRibbonSummaryMonNameWindow(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
structPtr->nameWindowId = AddWindow(&sRibbonSummaryMonNameWindowTemplate);
|
menu->nameWindowId = AddWindow(&sRibbonSummaryMonNameWindowTemplate);
|
||||||
PutWindowTilemap(structPtr->nameWindowId);
|
PutWindowTilemap(menu->nameWindowId);
|
||||||
PrintRibbbonsSummaryMonInfo(structPtr);
|
PrintRibbbonsSummaryMonInfo(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u8 sMaleIconString[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GRAY}{WHITE}{LIGHT_GRAY}");
|
static const u8 sMaleIconString[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GREEN}♂{COLOR_HIGHLIGHT_SHADOW}{DARK_GRAY}{WHITE}{LIGHT_GRAY}");
|
||||||
static const u8 sFemaleIconString[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GRAY}{WHITE}{LIGHT_GRAY}");
|
static const u8 sFemaleIconString[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GRAY}{WHITE}{LIGHT_GRAY}");
|
||||||
static const u8 sGenderlessIconString[] = _("{UNK_SPACER}");
|
static const u8 sGenderlessIconString[] = _("{UNK_SPACER}");
|
||||||
|
|
||||||
static void PrintRibbbonsSummaryMonInfo(struct PokenavSub14 *structPtr)
|
static void PrintRibbbonsSummaryMonInfo(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
const u8 *genderTxt;
|
const u8 *genderTxt;
|
||||||
u8 *txtPtr;
|
u8 *txtPtr;
|
||||||
u8 level, gender;
|
u8 level, gender;
|
||||||
u16 windowId = structPtr->nameWindowId;
|
u16 windowId = menu->nameWindowId;
|
||||||
|
|
||||||
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
|
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
|
||||||
GetMonNicknameLevelGender(gStringVar3, &level, &gender);
|
GetMonNicknameLevelGender(gStringVar3, &level, &gender);
|
||||||
@ -914,15 +914,15 @@ static const struct WindowTemplate sRibbonMonListIndexWindowTemplate[] =
|
|||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void AddRibbonListIndexWindow(struct PokenavSub14 *structPtr)
|
static void AddRibbonListIndexWindow(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
structPtr->listIdxWindowId = AddWindow(sRibbonMonListIndexWindowTemplate);
|
menu->listIdxWindowId = AddWindow(sRibbonMonListIndexWindowTemplate);
|
||||||
FillWindowPixelBuffer(structPtr->listIdxWindowId, PIXEL_FILL(1));
|
FillWindowPixelBuffer(menu->listIdxWindowId, PIXEL_FILL(1));
|
||||||
PutWindowTilemap(structPtr->listIdxWindowId);
|
PutWindowTilemap(menu->listIdxWindowId);
|
||||||
PrintRibbonsMonListIndex(structPtr);
|
PrintRibbonsMonListIndex(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr)
|
static void PrintRibbonsMonListIndex(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
s32 x;
|
s32 x;
|
||||||
u8 *txtPtr;
|
u8 *txtPtr;
|
||||||
@ -933,24 +933,24 @@ static void PrintRibbonsMonListIndex(struct PokenavSub14 *structPtr)
|
|||||||
*(txtPtr++) = CHAR_SLASH;
|
*(txtPtr++) = CHAR_SLASH;
|
||||||
ConvertIntToDecimalStringN(txtPtr, count, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
ConvertIntToDecimalStringN(txtPtr, count, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||||
x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar1, 56);
|
x = GetStringCenterAlignXOffset(FONT_NORMAL, gStringVar1, 56);
|
||||||
AddTextPrinterParameterized(structPtr->listIdxWindowId, FONT_NORMAL, gStringVar1, x, 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(menu->listIdxWindowId, FONT_NORMAL, gStringVar1, x, 1, TEXT_SKIP_DRAW, NULL);
|
||||||
CopyWindowToVram(structPtr->listIdxWindowId, COPYWIN_GFX);
|
CopyWindowToVram(menu->listIdxWindowId, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetSpritesAndDrawMonFrontPic(struct PokenavSub14 *structPtr)
|
static void ResetSpritesAndDrawMonFrontPic(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
u16 species;
|
u16 species;
|
||||||
u32 personality, otId;
|
u32 personality, otId;
|
||||||
|
|
||||||
GetMonSpeciesPersonalityOtId(&species, &personality, &otId);
|
GetMonSpeciesPersonalityOtId(&species, &personality, &otId);
|
||||||
ResetAllPicSprites();
|
ResetAllPicSprites();
|
||||||
structPtr->monSpriteId = DrawRibbonsMonFrontPic(MON_SPRITE_X_ON, MON_SPRITE_Y);
|
menu->monSpriteId = DrawRibbonsMonFrontPic(MON_SPRITE_X_ON, MON_SPRITE_Y);
|
||||||
PokenavFillPalette(15, 0);
|
PokenavFillPalette(15, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DestroyRibbonsMonFrontPic(struct PokenavSub14 *structPtr)
|
static void DestroyRibbonsMonFrontPic(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
FreeAndDestroyMonPicSprite(structPtr->monSpriteId);
|
FreeAndDestroyMonPicSprite(menu->monSpriteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// x and y arguments are ignored
|
// x and y arguments are ignored
|
||||||
@ -967,25 +967,25 @@ static u16 DrawRibbonsMonFrontPic(s32 x, s32 y)
|
|||||||
return spriteId;
|
return spriteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SlideMonSpriteOff(struct PokenavSub14 *structPtr)
|
static void SlideMonSpriteOff(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
StartMonSpriteSlide(&gSprites[structPtr->monSpriteId], MON_SPRITE_X_ON, MON_SPRITE_X_OFF, 6);
|
StartMonSpriteSlide(&gSprites[menu->monSpriteId], MON_SPRITE_X_ON, MON_SPRITE_X_OFF, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SlideMonSpriteOn(struct PokenavSub14 *structPtr)
|
static void SlideMonSpriteOn(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
// Switch to new mon sprite
|
// Switch to new mon sprite
|
||||||
FreeAndDestroyMonPicSprite(structPtr->monSpriteId);
|
FreeAndDestroyMonPicSprite(menu->monSpriteId);
|
||||||
structPtr->monSpriteId = DrawRibbonsMonFrontPic(MON_SPRITE_X_OFF, MON_SPRITE_Y);
|
menu->monSpriteId = DrawRibbonsMonFrontPic(MON_SPRITE_X_OFF, MON_SPRITE_Y);
|
||||||
|
|
||||||
// Slide on
|
// Slide on
|
||||||
StartMonSpriteSlide(&gSprites[structPtr->monSpriteId], MON_SPRITE_X_OFF, MON_SPRITE_X_ON, 6);
|
StartMonSpriteSlide(&gSprites[menu->monSpriteId], MON_SPRITE_X_OFF, MON_SPRITE_X_ON, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is Pokémon summary sprite still sliding off/on
|
// Is Pokémon summary sprite still sliding off/on
|
||||||
static bool32 IsMonSpriteAnimating(struct PokenavSub14 *structPtr)
|
static bool32 IsMonSpriteAnimating(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
return (gSprites[structPtr->monSpriteId].callback != SpriteCallbackDummy);
|
return (gSprites[menu->monSpriteId].callback != SpriteCallbackDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define sCurrX data[0]
|
#define sCurrX data[0]
|
||||||
@ -1030,7 +1030,7 @@ static void SpriteCB_MonSpriteSlide(struct Sprite *sprite)
|
|||||||
#undef sTime
|
#undef sTime
|
||||||
#undef sDestX
|
#undef sDestX
|
||||||
|
|
||||||
static void DrawAllRibbonsSmall(struct PokenavSub14 *structPtr)
|
static void DrawAllRibbonsSmall(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
u32 *ribbonIds;
|
u32 *ribbonIds;
|
||||||
|
|
||||||
@ -1211,7 +1211,7 @@ static const struct SpriteTemplate sSpriteTemplate_RibbonIconBig =
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create dummy sprite to be used for the zoomed in version of the selected ribbon
|
// Create dummy sprite to be used for the zoomed in version of the selected ribbon
|
||||||
static void CreateBigRibbonSprite(struct PokenavSub14 *structPtr)
|
static void CreateBigRibbonSprite(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
@ -1219,45 +1219,45 @@ static void CreateBigRibbonSprite(struct PokenavSub14 *structPtr)
|
|||||||
Pokenav_AllocAndLoadPalettes(sSpritePalettes_RibbonIcons);
|
Pokenav_AllocAndLoadPalettes(sSpritePalettes_RibbonIcons);
|
||||||
|
|
||||||
spriteId = CreateSprite(&sSpriteTemplate_RibbonIconBig, 0, 0, 0);
|
spriteId = CreateSprite(&sSpriteTemplate_RibbonIconBig, 0, 0, 0);
|
||||||
structPtr->bigRibbonSprite = &gSprites[spriteId];
|
menu->bigRibbonSprite = &gSprites[spriteId];
|
||||||
structPtr->bigRibbonSprite->invisible = TRUE;
|
menu->bigRibbonSprite->invisible = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define sInvisibleWhenDone data[0]
|
#define sInvisibleWhenDone data[0]
|
||||||
|
|
||||||
static void UpdateAndZoomInSelectedRibbon(struct PokenavSub14 *structPtr)
|
static void UpdateAndZoomInSelectedRibbon(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
u32 ribbonId;
|
u32 ribbonId;
|
||||||
s32 position = GetSelectedPosition();
|
s32 position = GetSelectedPosition();
|
||||||
s32 x = (position % RIBBONS_PER_ROW) * 16 + 96;
|
s32 x = (position % RIBBONS_PER_ROW) * 16 + 96;
|
||||||
s32 y = (position / RIBBONS_PER_ROW) * 16 + 40;
|
s32 y = (position / RIBBONS_PER_ROW) * 16 + 40;
|
||||||
|
|
||||||
structPtr->bigRibbonSprite->x = x;
|
menu->bigRibbonSprite->x = x;
|
||||||
structPtr->bigRibbonSprite->y = y;
|
menu->bigRibbonSprite->y = y;
|
||||||
|
|
||||||
// Set new selected ribbon's gfx data
|
// Set new selected ribbon's gfx data
|
||||||
ribbonId = GetRibbonId();
|
ribbonId = GetRibbonId();
|
||||||
structPtr->bigRibbonSprite->oam.tileNum = (sRibbonGfxData[ribbonId].tileNumOffset * 16) + GetSpriteTileStartByTag(GFXTAG_RIBBON_ICONS_BIG);
|
menu->bigRibbonSprite->oam.tileNum = (sRibbonGfxData[ribbonId].tileNumOffset * 16) + GetSpriteTileStartByTag(GFXTAG_RIBBON_ICONS_BIG);
|
||||||
structPtr->bigRibbonSprite->oam.paletteNum = IndexOfSpritePaletteTag(sRibbonGfxData[ribbonId].palNumOffset + PALTAG_RIBBON_ICONS_1);
|
menu->bigRibbonSprite->oam.paletteNum = IndexOfSpritePaletteTag(sRibbonGfxData[ribbonId].palNumOffset + PALTAG_RIBBON_ICONS_1);
|
||||||
|
|
||||||
// Start zoom in animation
|
// Start zoom in animation
|
||||||
StartSpriteAffineAnim(structPtr->bigRibbonSprite, RIBBONANIM_ZOOM_IN);
|
StartSpriteAffineAnim(menu->bigRibbonSprite, RIBBONANIM_ZOOM_IN);
|
||||||
structPtr->bigRibbonSprite->invisible = FALSE;
|
menu->bigRibbonSprite->invisible = FALSE;
|
||||||
structPtr->bigRibbonSprite->sInvisibleWhenDone = FALSE;
|
menu->bigRibbonSprite->sInvisibleWhenDone = FALSE;
|
||||||
structPtr->bigRibbonSprite->callback = SpriteCB_WaitForRibbonAnimation;
|
menu->bigRibbonSprite->callback = SpriteCB_WaitForRibbonAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start animation to zoom out of selected ribbon
|
// Start animation to zoom out of selected ribbon
|
||||||
static void ZoomOutSelectedRibbon(struct PokenavSub14 *structPtr)
|
static void ZoomOutSelectedRibbon(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
structPtr->bigRibbonSprite->sInvisibleWhenDone = TRUE;
|
menu->bigRibbonSprite->sInvisibleWhenDone = TRUE;
|
||||||
StartSpriteAffineAnim(structPtr->bigRibbonSprite, RIBBONANIM_ZOOM_OUT);
|
StartSpriteAffineAnim(menu->bigRibbonSprite, RIBBONANIM_ZOOM_OUT);
|
||||||
structPtr->bigRibbonSprite->callback = SpriteCB_WaitForRibbonAnimation;
|
menu->bigRibbonSprite->callback = SpriteCB_WaitForRibbonAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 IsRibbonAnimating(struct PokenavSub14 *structPtr)
|
static bool32 IsRibbonAnimating(struct Pokenav_RibbonsSummaryMenu *menu)
|
||||||
{
|
{
|
||||||
return (structPtr->bigRibbonSprite->callback != SpriteCallbackDummy);
|
return (menu->bigRibbonSprite->callback != SpriteCallbackDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SpriteCB_WaitForRibbonAnimation(struct Sprite *sprite)
|
static void SpriteCB_WaitForRibbonAnimation(struct Sprite *sprite)
|
@ -51,7 +51,7 @@
|
|||||||
.include "src/mirage_tower.o"
|
.include "src/mirage_tower.o"
|
||||||
.include "src/berry_fix_program.o"
|
.include "src/berry_fix_program.o"
|
||||||
.include "src/pokenav_conditions_2.o"
|
.include "src/pokenav_conditions_2.o"
|
||||||
.include "src/pokenav_ribbons_2.o"
|
.include "src/pokenav_ribbons_summary.o"
|
||||||
.include "src/ereader_helpers.o"
|
.include "src/ereader_helpers.o"
|
||||||
.include "src/faraway_island.o"
|
.include "src/faraway_island.o"
|
||||||
.include "src/m4a_1.o"
|
.include "src/m4a_1.o"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user