mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 11:14:15 +01:00
Finish pokenav conditions doc
This commit is contained in:
parent
7efdc0902b
commit
f5152094a9
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
@ -26,6 +26,11 @@ enum {
|
||||
TAG_CONDITION_MARKINGS_MENU_2, // Used implicitly by CreateMonMarkingsMenuSprites
|
||||
};
|
||||
|
||||
enum {
|
||||
CONDITION_ICON_SELECTED,
|
||||
CONDITION_ICON_UNSELECTED,
|
||||
};
|
||||
|
||||
#define MAX_CONDITION_SPARKLES 10
|
||||
|
||||
// The number of extra sparkles shown on a Pokémon's condition screen.
|
||||
|
@ -65,8 +65,7 @@ enum
|
||||
POKENAV_MODE_FORCE_CALL_EXIT, // Pokenav tutorial after calling Mr. Stone
|
||||
};
|
||||
|
||||
// TODO - refine these names
|
||||
enum Substructures
|
||||
enum
|
||||
{
|
||||
POKENAV_SUBSTRUCT_MAIN_MENU,
|
||||
POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER,
|
||||
@ -76,11 +75,11 @@ enum Substructures
|
||||
POKENAV_SUBSTRUCT_MATCH_CALL_MAIN,
|
||||
POKENAV_SUBSTRUCT_MATCH_CALL_OPEN,
|
||||
POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS,
|
||||
POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST,
|
||||
POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX,
|
||||
POKENAV_SUBSTRUCT_RIBBONS_MON_LIST,
|
||||
POKENAV_SUBSTRUCT_RIBBONS_MON_MENU,
|
||||
POKENAV_SUBSTRUCT_CONDITION_GRAPH,
|
||||
POKENAV_SUBSTRUCT_MON_MARK_MENU,
|
||||
POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU,
|
||||
POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX,
|
||||
POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST,
|
||||
POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU,
|
||||
POKENAV_SUBSTRUCT_15, //unused
|
||||
@ -113,21 +112,21 @@ enum
|
||||
#define POKENAV_MENU_IDS_START 100000
|
||||
enum
|
||||
{
|
||||
POKENAV_MAIN_MENU = POKENAV_MENU_IDS_START,
|
||||
POKENAV_MAIN_MENU = POKENAV_MENU_IDS_START, // The main menu where the player selects Hoenn Map/Condition/Match Call/Ribbons
|
||||
POKENAV_MAIN_MENU_CURSOR_ON_MAP,
|
||||
POKENAV_CONDITION_MENU,
|
||||
POKENAV_CONDITION_SEARCH_MENU,
|
||||
POKENAV_CONDITION_MENU, // The first Condition screen where the player selects Party or Search
|
||||
POKENAV_CONDITION_SEARCH_MENU, // The Condition search menu where the player selects a search parameter
|
||||
POKENAV_MAIN_MENU_CURSOR_ON_MATCH_CALL,
|
||||
POKENAV_MAIN_MENU_CURSOR_ON_RIBBONS,
|
||||
POKENAV_REGION_MAP,
|
||||
POKENAV_CONDITION_PARTY,
|
||||
POKENAV_CONDITION_SEARCH_RESULTS,
|
||||
POKENAV_CONDITION_GRAPH_FROM_SEARCH, // opening condition graph from search list
|
||||
POKENAV_RETURN_CONDITION_SEARCH, //return to search list from condition graph
|
||||
POKENAV_CONDITION_GRAPH_PARTY, // The Condition graph screen when Party has been selected
|
||||
POKENAV_CONDITION_SEARCH_RESULTS, // The list of results from a Condition search
|
||||
POKENAV_CONDITION_GRAPH_SEARCH, // The Condition graph screen when a search result has been selected
|
||||
POKENAV_RETURN_CONDITION_SEARCH, // Exited the graph screen back to the list of Condition search results
|
||||
POKENAV_MATCH_CALL,
|
||||
POKENAV_RIBBONS_MON_LIST,
|
||||
POKENAV_RIBBONS_SUMMARY_SCREEN,
|
||||
POKENAV_RIBBONS_RETURN_TO_MON_LIST,
|
||||
POKENAV_RIBBONS_MON_LIST, // The list of Pokémon with ribbons
|
||||
POKENAV_RIBBONS_SUMMARY_SCREEN, // The ribbon summary screen shown when a Pokémon has been selected
|
||||
POKENAV_RIBBONS_RETURN_TO_MON_LIST, // Exited the summary screen back to the ribbon list
|
||||
};
|
||||
|
||||
enum
|
||||
@ -245,15 +244,15 @@ enum RegionMapFuncIds
|
||||
POKENAV_MENU_FUNC_OPEN_FEATURE,
|
||||
};
|
||||
|
||||
enum PartyConditionFuncIds
|
||||
enum
|
||||
{
|
||||
PARTY_CONDITION_FUNC_NONE,
|
||||
PARTY_CONDITION_FUNC_SLIDE_MON_IN,
|
||||
PARTY_CONDITION_FUNC_RETURN,
|
||||
PARTY_CONDITION_FUNC_NO_TRANSITION,
|
||||
PARTY_CONDITION_FUNC_SLIDE_MON_OUT,
|
||||
PARTY_CONDITION_FUNC_ADD_MARKINGS,
|
||||
PARTY_CONDITION_FUNC_CLOSE_MARKINGS,
|
||||
CONDITION_FUNC_NONE,
|
||||
CONDITION_FUNC_SLIDE_MON_IN,
|
||||
CONDITION_FUNC_RETURN,
|
||||
CONDITION_FUNC_NO_TRANSITION,
|
||||
CONDITION_FUNC_SLIDE_MON_OUT,
|
||||
CONDITION_FUNC_ADD_MARKINGS,
|
||||
CONDITION_FUNC_CLOSE_MARKINGS,
|
||||
};
|
||||
|
||||
enum
|
||||
@ -264,6 +263,13 @@ enum
|
||||
NUM_CONDITION_MONS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CONDITION_LOAD_MON_INFO,
|
||||
CONDITION_LOAD_GRAPH,
|
||||
CONDITION_LOAD_MON_PIC,
|
||||
};
|
||||
|
||||
#define POKENAV_MENU_FUNC_EXIT -1
|
||||
|
||||
enum
|
||||
@ -431,17 +437,17 @@ void FreeRegionMapSubstruct1(void);
|
||||
void FreeRegionMapSubstruct2(void);
|
||||
|
||||
// pokenav_conditions_1.c
|
||||
u32 PokenavCallback_Init_PartyCondition(void);
|
||||
u32 PokenavCallback_Init_ConditionGraphFromSearch(void);
|
||||
u32 GetPartyConditionCallback(void);
|
||||
void FreePartyConditionSubstruct1(void);
|
||||
bool32 LoadPartyConditionMenuGfx(void);
|
||||
u32 PokenavCallback_Init_ConditionGraph_Party(void);
|
||||
u32 PokenavCallback_Init_ConditionGraph_Search(void);
|
||||
u32 GetConditionGraphMenuCallback(void);
|
||||
void FreeConditionGraphMenuSubstruct1(void);
|
||||
bool32 LoadConditionGraphMenuGfx(void);
|
||||
bool32 IsConditionMenuSearchMode(void);
|
||||
struct ConditionGraph *GetConditionGraphPtr(void);
|
||||
u16 GetConditionGraphCurrentMonIndex(void);
|
||||
u16 GetConditionGraphCurrentListIndex(void);
|
||||
u16 GetMonListCount(void);
|
||||
u8 GetNumConditionMonSparkles(void);
|
||||
bool32 SetConditionGraphData(u8 mode);
|
||||
bool32 LoadNextConditionMenuMonData(u8 mode);
|
||||
u8 TryGetMonMarkId(void);
|
||||
u8 *GetConditionMonNameText(u8 id);
|
||||
u8 *GetConditionMonLocationText(u8 id);
|
||||
@ -450,10 +456,10 @@ void *GetConditionMonPicGfx(u8 id);
|
||||
void *GetConditionMonPal(u8 id);
|
||||
|
||||
// pokenav_conditions_2.c
|
||||
bool32 OpenPartyConditionMenu(void);
|
||||
void CreatePartyConditionLoopedTask(s32);
|
||||
u32 IsPartyConditionLoopedTaskActive(void);
|
||||
void FreePartyConditionSubstruct2(void);
|
||||
bool32 OpenConditionGraphMenu(void);
|
||||
void CreateConditionGraphMenuLoopedTask(s32);
|
||||
u32 IsConditionGraphMenuLoopedTaskActive(void);
|
||||
void FreeConditionGraphMenuSubstruct2(void);
|
||||
u8 GetMonMarkingsData(void);
|
||||
|
||||
// pokenav_conditions_3.c
|
||||
|
@ -2974,8 +2974,8 @@ extern const u8 gText_FindToughPokemon[];
|
||||
extern const u8 gText_ReturnToConditionMenu[];
|
||||
extern const u8 gText_NoRibbonWinners[];
|
||||
|
||||
// Pokenav Ribbons
|
||||
extern const u8 gText_NumberF700[];
|
||||
// Pokenav
|
||||
extern const u8 gText_NumberIndex[];
|
||||
extern const u8 gText_RibbonsF700[];
|
||||
|
||||
// use_pokeblock
|
||||
|
@ -318,7 +318,7 @@ void MailboxMenu_Free(void)
|
||||
// filled with the graph color.
|
||||
//---------------------------------------
|
||||
|
||||
#define UNK_VAL(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1))
|
||||
#define SHIFT_RIGHT_ADJUSTED(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1))
|
||||
|
||||
void ConditionGraph_Init(struct ConditionGraph *graph)
|
||||
{
|
||||
@ -360,7 +360,7 @@ void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords
|
||||
increment = ((new[i].x - old[i].x) << 8) / CONDITION_GRAPH_UPDATE_STEPS;
|
||||
for (j = 0; j < CONDITION_GRAPH_UPDATE_STEPS - 1; j++)
|
||||
{
|
||||
graph->newPositions[j][i].x = UNK_VAL(coord, 8);
|
||||
graph->newPositions[j][i].x = SHIFT_RIGHT_ADJUSTED(coord, 8);
|
||||
coord += increment;
|
||||
}
|
||||
graph->newPositions[j][i].x = new[i].x;
|
||||
@ -369,7 +369,7 @@ void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords
|
||||
increment = ((new[i].y - old[i].y) << 8) / CONDITION_GRAPH_UPDATE_STEPS;
|
||||
for (j = 0; j < CONDITION_GRAPH_UPDATE_STEPS - 1; j++)
|
||||
{
|
||||
graph->newPositions[j][i].y = UNK_VAL(coord, 8);
|
||||
graph->newPositions[j][i].y = SHIFT_RIGHT_ADJUSTED(coord, 8);
|
||||
coord += increment;
|
||||
}
|
||||
graph->newPositions[j][i].y = new[i].y;
|
||||
@ -500,7 +500,7 @@ static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline,
|
||||
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
scanline[dir] = UNK_VAL(x, 10) + dir;
|
||||
scanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
||||
x += xIncrement;
|
||||
scanline += 2;
|
||||
}
|
||||
@ -511,7 +511,7 @@ static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline,
|
||||
{
|
||||
overflowScanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||
// Less readable than the other loops, but it has to be written this way to match.
|
||||
for (i = 0; i < height; overflowScanline[dir] = UNK_VAL(x, 10) + dir, x += xIncrement, overflowScanline += 2, i++)
|
||||
for (i = 0; i < height; overflowScanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir, x += xIncrement, overflowScanline += 2, i++)
|
||||
{
|
||||
if (x >= (CONDITION_GRAPH_CENTER_X << 10))
|
||||
break;
|
||||
@ -521,7 +521,7 @@ static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline,
|
||||
scanline += (graph->bottom - CONDITION_GRAPH_TOP_Y) * 2;
|
||||
for (; i < height; i++)
|
||||
{
|
||||
scanline[dir] = UNK_VAL(x, 10) + dir;
|
||||
scanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
||||
x += xIncrement;
|
||||
scanline += 2;
|
||||
}
|
||||
@ -533,7 +533,7 @@ static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline,
|
||||
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
scanline[dir] = UNK_VAL(x, 10) + dir;
|
||||
scanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
||||
if (x < (CONDITION_GRAPH_CENTER_X << 10))
|
||||
{
|
||||
scanline[dir] = CONDITION_GRAPH_CENTER_X;
|
||||
@ -547,7 +547,7 @@ static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline,
|
||||
overflowScanline += (graph->bottom - CONDITION_GRAPH_TOP_Y) * 2;
|
||||
for (; i < height; i++)
|
||||
{
|
||||
overflowScanline[dir] = UNK_VAL(x, 10) + dir;
|
||||
overflowScanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
||||
x += xIncrement;
|
||||
overflowScanline += 2;
|
||||
}
|
||||
@ -1167,8 +1167,8 @@ static const union AnimCmd sAnim_ConditionSelectionIcon_Unselected[] =
|
||||
|
||||
static const union AnimCmd *const sAnims_ConditionSelectionIcon[] =
|
||||
{
|
||||
sAnim_ConditionSelectionIcon_Selected,
|
||||
sAnim_ConditionSelectionIcon_Unselected
|
||||
[CONDITION_ICON_SELECTED] = sAnim_ConditionSelectionIcon_Selected,
|
||||
[CONDITION_ICON_UNSELECTED] = sAnim_ConditionSelectionIcon_Unselected
|
||||
};
|
||||
|
||||
// Just loads the generic data, up to the caller to load the actual sheet/pal for the specific mon
|
||||
|
@ -122,15 +122,15 @@ const struct PokenavCallbacks PokenavMenuCallbacks[15] =
|
||||
.free1 = FreeRegionMapSubstruct1,
|
||||
.free2 = FreeRegionMapSubstruct2,
|
||||
},
|
||||
[POKENAV_CONDITION_PARTY - POKENAV_MENU_IDS_START] =
|
||||
[POKENAV_CONDITION_GRAPH_PARTY - POKENAV_MENU_IDS_START] =
|
||||
{
|
||||
.init = PokenavCallback_Init_PartyCondition,
|
||||
.callback = GetPartyConditionCallback,
|
||||
.open = OpenPartyConditionMenu,
|
||||
.createLoopTask = CreatePartyConditionLoopedTask,
|
||||
.isLoopTaskActive = IsPartyConditionLoopedTaskActive,
|
||||
.free1 = FreePartyConditionSubstruct1,
|
||||
.free2 = FreePartyConditionSubstruct2,
|
||||
.init = PokenavCallback_Init_ConditionGraph_Party,
|
||||
.callback = GetConditionGraphMenuCallback,
|
||||
.open = OpenConditionGraphMenu,
|
||||
.createLoopTask = CreateConditionGraphMenuLoopedTask,
|
||||
.isLoopTaskActive = IsConditionGraphMenuLoopedTaskActive,
|
||||
.free1 = FreeConditionGraphMenuSubstruct1,
|
||||
.free2 = FreeConditionGraphMenuSubstruct2,
|
||||
},
|
||||
[POKENAV_CONDITION_SEARCH_RESULTS - POKENAV_MENU_IDS_START] =
|
||||
{
|
||||
@ -142,15 +142,15 @@ const struct PokenavCallbacks PokenavMenuCallbacks[15] =
|
||||
.free1 = FreeSearchResultSubstruct1,
|
||||
.free2 = FreeSearchResultSubstruct2,
|
||||
},
|
||||
[POKENAV_CONDITION_GRAPH_FROM_SEARCH - POKENAV_MENU_IDS_START] =
|
||||
[POKENAV_CONDITION_GRAPH_SEARCH - POKENAV_MENU_IDS_START] =
|
||||
{
|
||||
.init = PokenavCallback_Init_ConditionGraphFromSearch,
|
||||
.callback = GetPartyConditionCallback,
|
||||
.open = OpenPartyConditionMenu,
|
||||
.createLoopTask = CreatePartyConditionLoopedTask,
|
||||
.isLoopTaskActive = IsPartyConditionLoopedTaskActive,
|
||||
.free1 = FreePartyConditionSubstruct1,
|
||||
.free2 = FreePartyConditionSubstruct2,
|
||||
.init = PokenavCallback_Init_ConditionGraph_Search,
|
||||
.callback = GetConditionGraphMenuCallback,
|
||||
.open = OpenConditionGraphMenu,
|
||||
.createLoopTask = CreateConditionGraphMenuLoopedTask,
|
||||
.isLoopTaskActive = IsConditionGraphMenuLoopedTaskActive,
|
||||
.free1 = FreeConditionGraphMenuSubstruct1,
|
||||
.free2 = FreeConditionGraphMenuSubstruct2,
|
||||
},
|
||||
[POKENAV_RETURN_CONDITION_SEARCH - POKENAV_MENU_IDS_START] =
|
||||
{
|
||||
|
@ -13,102 +13,105 @@
|
||||
#include "text.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
struct PokenavSub11
|
||||
struct Pokenav_ConditionMenu
|
||||
{
|
||||
u32 monPal[NUM_CONDITION_MONS][0x20];
|
||||
u8 fill[0x180];
|
||||
u32 monPicGfx[NUM_CONDITION_MONS][MON_PIC_SIZE];
|
||||
u8 searchMode;
|
||||
s16 monIndex;
|
||||
u32 (*callback)(struct PokenavSub11 *);
|
||||
u8 fill2[0x6320 - 0x6308];
|
||||
bool8 inSearchMode;
|
||||
s16 toLoadListIndex;
|
||||
u32 (*callback)(struct Pokenav_ConditionMenu *);
|
||||
u8 fill2[0x18];
|
||||
u8 locationText[NUM_CONDITION_MONS][24];
|
||||
u8 nameText[NUM_CONDITION_MONS][64];
|
||||
struct ConditionGraph graph;
|
||||
u8 numSparkles[NUM_CONDITION_MONS];
|
||||
u8 monMarks[NUM_CONDITION_MONS];
|
||||
s8 mark;
|
||||
s8 unk6787;
|
||||
s8 unk6788;
|
||||
s8 unk6789;
|
||||
s8 loadId;
|
||||
s8 nextLoadIdDown;
|
||||
s8 nextLoadIdUp;
|
||||
s8 toLoadId;
|
||||
u8 state;
|
||||
};
|
||||
|
||||
static void InitPartyConditionListParameters(void);
|
||||
static void InitSearchResultsConditionList(void);
|
||||
static u32 HandlePartyConditionInput(struct PokenavSub11 *);
|
||||
static u32 GetConditionReturnCallback(struct PokenavSub11 *);
|
||||
static u32 ConditionMenu_OpenMarkingsMenu(struct PokenavSub11 *);
|
||||
static u8 ConditionGraphHandleDpadInput(struct PokenavSub11 *);
|
||||
static u32 HandleConditionMenuInput(struct Pokenav_ConditionMenu *);
|
||||
static u32 GetConditionReturnCallback(struct Pokenav_ConditionMenu *);
|
||||
static u32 OpenMarkingsMenu(struct Pokenav_ConditionMenu *);
|
||||
static u8 ConditionGraphHandleDpadInput(struct Pokenav_ConditionMenu *);
|
||||
static u8 SwitchConditionSummaryIndex(bool8);
|
||||
static void CopyMonNameGenderLocation(s16, u8);
|
||||
static void GetMonConditionGraphData(s16, u8);
|
||||
static void ConditionGraphDrawMonPic(s16, u8);
|
||||
|
||||
bool32 PokenavCallback_Init_PartyCondition(void)
|
||||
bool32 PokenavCallback_Init_ConditionGraph_Party(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH, sizeof(struct PokenavSub11));
|
||||
struct Pokenav_ConditionMenu *menu = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU, sizeof(struct Pokenav_ConditionMenu));
|
||||
|
||||
if (structPtr == NULL)
|
||||
if (menu == NULL)
|
||||
return FALSE;
|
||||
|
||||
ConditionGraph_Init(&structPtr->graph);
|
||||
ConditionGraph_Init(&menu->graph);
|
||||
InitPartyConditionListParameters();
|
||||
gKeyRepeatStartDelay = 20;
|
||||
structPtr->callback = HandlePartyConditionInput;
|
||||
menu->callback = HandleConditionMenuInput;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 PokenavCallback_Init_ConditionGraphFromSearch(void)
|
||||
bool32 PokenavCallback_Init_ConditionGraph_Search(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH, sizeof(struct PokenavSub11));
|
||||
struct Pokenav_ConditionMenu *menu = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU, sizeof(struct Pokenav_ConditionMenu));
|
||||
|
||||
if (structPtr == NULL)
|
||||
if (menu == NULL)
|
||||
return FALSE;
|
||||
|
||||
ConditionGraph_Init(&structPtr->graph);
|
||||
ConditionGraph_Init(&menu->graph);
|
||||
InitSearchResultsConditionList();
|
||||
gKeyRepeatStartDelay = 20;
|
||||
structPtr->callback = HandlePartyConditionInput;
|
||||
menu->callback = HandleConditionMenuInput;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 GetPartyConditionCallback(void)
|
||||
u32 GetConditionGraphMenuCallback(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
|
||||
return structPtr->callback(structPtr);
|
||||
return menu->callback(menu);
|
||||
}
|
||||
|
||||
static u32 HandlePartyConditionInput(struct PokenavSub11 *structPtr)
|
||||
static u32 HandleConditionMenuInput(struct Pokenav_ConditionMenu *menu)
|
||||
{
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
u32 ret = ConditionGraphHandleDpadInput(structPtr);
|
||||
u32 ret = ConditionGraphHandleDpadInput(menu);
|
||||
|
||||
if (ret == PARTY_CONDITION_FUNC_NONE)
|
||||
if (ret == CONDITION_FUNC_NONE)
|
||||
{
|
||||
if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
structPtr->callback = GetConditionReturnCallback;
|
||||
ret = PARTY_CONDITION_FUNC_RETURN;
|
||||
menu->callback = GetConditionReturnCallback;
|
||||
ret = CONDITION_FUNC_RETURN;
|
||||
}
|
||||
else if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
if (structPtr->searchMode == 0)
|
||||
if (!menu->inSearchMode)
|
||||
{
|
||||
// In Party mode, pressing A only applies to the Cancel button
|
||||
if (monListPtr->currIndex == monListPtr->listCount - 1)
|
||||
{
|
||||
// Cancel
|
||||
PlaySE(SE_SELECT);
|
||||
structPtr->callback = GetConditionReturnCallback;
|
||||
ret = PARTY_CONDITION_FUNC_RETURN;
|
||||
menu->callback = GetConditionReturnCallback;
|
||||
ret = CONDITION_FUNC_RETURN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// In Search mode pressing A brings up the markings menu
|
||||
PlaySE(SE_SELECT);
|
||||
ret = PARTY_CONDITION_FUNC_ADD_MARKINGS;
|
||||
structPtr->callback = ConditionMenu_OpenMarkingsMenu;
|
||||
ret = CONDITION_FUNC_ADD_MARKINGS;
|
||||
menu->callback = OpenMarkingsMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,57 +119,58 @@ static u32 HandlePartyConditionInput(struct PokenavSub11 *structPtr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32 ConditionMenu_OpenMarkingsMenu(struct PokenavSub11 *structPtr)
|
||||
static u32 OpenMarkingsMenu(struct Pokenav_ConditionMenu *menu)
|
||||
{
|
||||
struct PokenavSub18 *monListPtr;
|
||||
u8 markings;
|
||||
u32 ret = PARTY_CONDITION_FUNC_NONE, boxId, monId;
|
||||
u32 ret = CONDITION_FUNC_NONE, boxId, monId;
|
||||
|
||||
if (!HandleMonMarkingsMenuInput())
|
||||
{
|
||||
structPtr->monMarks[structPtr->mark] = GetMonMarkingsData();
|
||||
menu->monMarks[menu->loadId] = GetMonMarkingsData();
|
||||
monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
boxId = monListPtr->monData[monListPtr->currIndex].boxId;
|
||||
monId = monListPtr->monData[monListPtr->currIndex].monId;
|
||||
markings = structPtr->monMarks[structPtr->mark];
|
||||
markings = menu->monMarks[menu->loadId];
|
||||
|
||||
if (boxId == TOTAL_BOXES_COUNT)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MARKINGS, &markings);
|
||||
else
|
||||
SetBoxMonDataAt(boxId, monId, MON_DATA_MARKINGS, &markings);
|
||||
|
||||
structPtr->callback = HandlePartyConditionInput;
|
||||
ret = PARTY_CONDITION_FUNC_CLOSE_MARKINGS;
|
||||
menu->callback = HandleConditionMenuInput;
|
||||
ret = CONDITION_FUNC_CLOSE_MARKINGS;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32 GetConditionReturnCallback(struct PokenavSub11 *structPtr)
|
||||
static u32 GetConditionReturnCallback(struct Pokenav_ConditionMenu *menu)
|
||||
{
|
||||
if (structPtr->searchMode == 0)
|
||||
if (!menu->inSearchMode)
|
||||
return POKENAV_CONDITION_MENU;
|
||||
else
|
||||
return POKENAV_RETURN_CONDITION_SEARCH;
|
||||
}
|
||||
|
||||
void FreePartyConditionSubstruct1(void)
|
||||
void FreeConditionGraphMenuSubstruct1(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
if (structPtr->searchMode == 0)
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
if (!menu->inSearchMode)
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
}
|
||||
|
||||
static u8 ConditionGraphHandleDpadInput(struct PokenavSub11 *structPtr)
|
||||
static u8 ConditionGraphHandleDpadInput(struct Pokenav_ConditionMenu *menu)
|
||||
{
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
u8 ret = 0;
|
||||
u8 ret = CONDITION_FUNC_NONE;
|
||||
|
||||
if (JOY_HELD(DPAD_UP))
|
||||
{
|
||||
if (structPtr->searchMode == 0 || monListPtr->currIndex != 0)
|
||||
// Prevent input wrapping in search mode
|
||||
if (!menu->inSearchMode || monListPtr->currIndex != 0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ret = SwitchConditionSummaryIndex(TRUE);
|
||||
@ -174,7 +178,8 @@ static u8 ConditionGraphHandleDpadInput(struct PokenavSub11 *structPtr)
|
||||
}
|
||||
else if (JOY_HELD(DPAD_DOWN))
|
||||
{
|
||||
if (structPtr->searchMode == 0 || monListPtr->currIndex < monListPtr->listCount - 1)
|
||||
// Prevent input wrapping in search mode
|
||||
if (!menu->inSearchMode || monListPtr->currIndex < monListPtr->listCount - 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ret = SwitchConditionSummaryIndex(FALSE);
|
||||
@ -186,52 +191,52 @@ static u8 ConditionGraphHandleDpadInput(struct PokenavSub11 *structPtr)
|
||||
|
||||
static u8 SwitchConditionSummaryIndex(u8 moveUp)
|
||||
{
|
||||
u16 r7;
|
||||
u16 newLoadId;
|
||||
bool8 wasNotLastMon, isNotLastMon;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
|
||||
r7 = (moveUp) ? structPtr->unk6788 : structPtr->unk6787;
|
||||
ConditionGraph_SetNewPositions(&structPtr->graph, structPtr->graph.savedPositions[structPtr->mark], structPtr->graph.savedPositions[r7]);
|
||||
wasNotLastMon = (monListPtr->currIndex != ((IsConditionMenuSearchMode() != 0) ? monListPtr->listCount : monListPtr->listCount - 1));
|
||||
newLoadId = (moveUp) ? menu->nextLoadIdUp : menu->nextLoadIdDown;
|
||||
ConditionGraph_SetNewPositions(&menu->graph, menu->graph.savedPositions[menu->loadId], menu->graph.savedPositions[newLoadId]);
|
||||
wasNotLastMon = (monListPtr->currIndex != (IsConditionMenuSearchMode() ? monListPtr->listCount : monListPtr->listCount - 1));
|
||||
if (moveUp)
|
||||
{
|
||||
structPtr->unk6788 = structPtr->unk6787;
|
||||
structPtr->unk6787 = structPtr->mark;
|
||||
structPtr->mark = r7;
|
||||
structPtr->unk6789 = structPtr->unk6788;
|
||||
menu->nextLoadIdUp = menu->nextLoadIdDown;
|
||||
menu->nextLoadIdDown = menu->loadId;
|
||||
menu->loadId = newLoadId;
|
||||
menu->toLoadId = menu->nextLoadIdUp;
|
||||
|
||||
monListPtr->currIndex = (monListPtr->currIndex == 0) ? monListPtr->listCount - 1 : monListPtr->currIndex - 1;
|
||||
structPtr->monIndex = (monListPtr->currIndex != 0) ? monListPtr->currIndex - 1 : monListPtr->listCount - 1;
|
||||
menu->toLoadListIndex = (monListPtr->currIndex != 0) ? monListPtr->currIndex - 1 : monListPtr->listCount - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk6787 = structPtr->unk6788;
|
||||
structPtr->unk6788 = structPtr->mark;
|
||||
structPtr->mark = r7;
|
||||
structPtr->unk6789 = structPtr->unk6787;
|
||||
menu->nextLoadIdDown = menu->nextLoadIdUp;
|
||||
menu->nextLoadIdUp = menu->loadId;
|
||||
menu->loadId = newLoadId;
|
||||
menu->toLoadId = menu->nextLoadIdDown;
|
||||
|
||||
monListPtr->currIndex = (monListPtr->currIndex < monListPtr->listCount - 1) ? monListPtr->currIndex + 1 : 0;
|
||||
structPtr->monIndex = (monListPtr->currIndex < monListPtr->listCount - 1) ? monListPtr->currIndex + 1 : 0;
|
||||
menu->toLoadListIndex = (monListPtr->currIndex < monListPtr->listCount - 1) ? monListPtr->currIndex + 1 : 0;
|
||||
}
|
||||
|
||||
isNotLastMon = (monListPtr->currIndex != ((IsConditionMenuSearchMode() != 0) ? monListPtr->listCount : monListPtr->listCount - 1));
|
||||
isNotLastMon = (monListPtr->currIndex != (IsConditionMenuSearchMode() ? monListPtr->listCount : monListPtr->listCount - 1));
|
||||
|
||||
if (!wasNotLastMon)
|
||||
return PARTY_CONDITION_FUNC_NO_TRANSITION;
|
||||
return CONDITION_FUNC_NO_TRANSITION;
|
||||
else if (!isNotLastMon)
|
||||
return PARTY_CONDITION_FUNC_SLIDE_MON_OUT;
|
||||
return CONDITION_FUNC_SLIDE_MON_OUT;
|
||||
else
|
||||
return PARTY_CONDITION_FUNC_SLIDE_MON_IN;
|
||||
return CONDITION_FUNC_SLIDE_MON_IN;
|
||||
}
|
||||
|
||||
bool32 LoadPartyConditionMenuGfx(void)
|
||||
bool32 LoadConditionGraphMenuGfx(void)
|
||||
{
|
||||
s32 var;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
|
||||
switch (structPtr->state)
|
||||
switch (menu->state)
|
||||
{
|
||||
case 0:
|
||||
CopyMonNameGenderLocation(monListPtr->currIndex, CONDITION_MON_0);
|
||||
@ -245,17 +250,17 @@ bool32 LoadPartyConditionMenuGfx(void)
|
||||
case 3:
|
||||
if (monListPtr->listCount == 1)
|
||||
{
|
||||
structPtr->mark = CONDITION_MON_0;
|
||||
structPtr->unk6787 = CONDITION_MON_0;
|
||||
structPtr->unk6788 = CONDITION_MON_0;
|
||||
structPtr->state = 0;
|
||||
menu->loadId = CONDITION_MON_0;
|
||||
menu->nextLoadIdDown = CONDITION_MON_0;
|
||||
menu->nextLoadIdUp = CONDITION_MON_0;
|
||||
menu->state = 0;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->mark = CONDITION_MON_0;
|
||||
structPtr->unk6787 = CONDITION_MON_1;
|
||||
structPtr->unk6788 = CONDITION_MON_2;
|
||||
menu->loadId = CONDITION_MON_0;
|
||||
menu->nextLoadIdDown = CONDITION_MON_1;
|
||||
menu->nextLoadIdUp = CONDITION_MON_2;
|
||||
}
|
||||
break;
|
||||
// These were probably ternaries just like cases 7-9, but couldn't match it any other way.
|
||||
@ -285,28 +290,28 @@ bool32 LoadPartyConditionMenuGfx(void)
|
||||
break;
|
||||
case 9:
|
||||
ConditionGraphDrawMonPic((monListPtr->currIndex - 1 >= 0) ? monListPtr->currIndex - 1 : monListPtr->listCount - 1, CONDITION_MON_2);
|
||||
structPtr->state = 0;
|
||||
menu->state = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
structPtr->state++;
|
||||
menu->state++;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 SetConditionGraphData(u8 mode)
|
||||
bool32 LoadNextConditionMenuMonData(u8 mode)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
CopyMonNameGenderLocation(structPtr->monIndex, structPtr->unk6789);
|
||||
case CONDITION_LOAD_MON_INFO:
|
||||
CopyMonNameGenderLocation(menu->toLoadListIndex, menu->toLoadId);
|
||||
break;
|
||||
case 1:
|
||||
GetMonConditionGraphData(structPtr->monIndex, structPtr->unk6789);
|
||||
case CONDITION_LOAD_GRAPH:
|
||||
GetMonConditionGraphData(menu->toLoadListIndex, menu->toLoadId);
|
||||
break;
|
||||
case 2:
|
||||
ConditionGraphDrawMonPic(structPtr->monIndex, structPtr->unk6789);
|
||||
case CONDITION_LOAD_MON_PIC:
|
||||
ConditionGraphDrawMonPic(menu->toLoadListIndex, menu->toLoadId);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -419,42 +424,42 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 arg3)
|
||||
static void CopyMonNameGenderLocation(s16 listId, u8 loadId)
|
||||
{
|
||||
u16 boxId, i;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
|
||||
if (listId != (IsConditionMenuSearchMode() != 0 ? monListPtr->listCount : monListPtr->listCount - 1))
|
||||
if (listId != (IsConditionMenuSearchMode() ? monListPtr->listCount : monListPtr->listCount - 1))
|
||||
{
|
||||
CopyConditionMonNameGender(structPtr->nameText[loadId], listId, FALSE);
|
||||
CopyConditionMonNameGender(menu->nameText[loadId], listId, FALSE);
|
||||
boxId = monListPtr->monData[listId].boxId;
|
||||
structPtr->locationText[loadId][0] = EXT_CTRL_CODE_BEGIN;
|
||||
structPtr->locationText[loadId][1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
|
||||
structPtr->locationText[loadId][2] = TEXT_COLOR_BLUE;
|
||||
structPtr->locationText[loadId][3] = TEXT_COLOR_TRANSPARENT;
|
||||
structPtr->locationText[loadId][4] = TEXT_COLOR_LIGHT_BLUE;
|
||||
menu->locationText[loadId][0] = EXT_CTRL_CODE_BEGIN;
|
||||
menu->locationText[loadId][1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
|
||||
menu->locationText[loadId][2] = TEXT_COLOR_BLUE;
|
||||
menu->locationText[loadId][3] = TEXT_COLOR_TRANSPARENT;
|
||||
menu->locationText[loadId][4] = TEXT_COLOR_LIGHT_BLUE;
|
||||
if (boxId == TOTAL_BOXES_COUNT)
|
||||
CopyStringLeftAlignedToConditionData(&structPtr->locationText[loadId][5], gText_InParty, BOX_NAME_LENGTH);
|
||||
CopyStringLeftAlignedToConditionData(&menu->locationText[loadId][5], gText_InParty, BOX_NAME_LENGTH);
|
||||
else
|
||||
CopyStringLeftAlignedToConditionData(&structPtr->locationText[loadId][5], GetBoxNamePtr(boxId), BOX_NAME_LENGTH);
|
||||
CopyStringLeftAlignedToConditionData(&menu->locationText[loadId][5], GetBoxNamePtr(boxId), BOX_NAME_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 12; i++)
|
||||
structPtr->nameText[loadId][i] = CHAR_SPACE;
|
||||
structPtr->nameText[loadId][i] = EOS;
|
||||
menu->nameText[loadId][i] = CHAR_SPACE;
|
||||
menu->nameText[loadId][i] = EOS;
|
||||
|
||||
for (i = 0; i < BOX_NAME_LENGTH; i++)
|
||||
structPtr->locationText[loadId][i] = CHAR_SPACE;
|
||||
structPtr->locationText[loadId][i] = EOS;
|
||||
menu->locationText[loadId][i] = CHAR_SPACE;
|
||||
menu->locationText[loadId][i] = EOS;
|
||||
}
|
||||
}
|
||||
|
||||
static void InitPartyConditionListParameters(void)
|
||||
{
|
||||
u16 i, count;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
struct PokenavSub18 *monListPtr = AllocSubstruct(POKENAV_SUBSTRUCT_MON_LIST, sizeof(struct PokenavSub18));
|
||||
|
||||
structPtr->searchMode = 0;
|
||||
menu->inSearchMode = FALSE;
|
||||
for (i = 0, count = 0; i < CalculatePlayerPartyCount(); i++)
|
||||
{
|
||||
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
|
||||
@ -471,42 +476,43 @@ static void InitPartyConditionListParameters(void)
|
||||
monListPtr->monData[count].data = 0;
|
||||
monListPtr->currIndex = 0;
|
||||
monListPtr->listCount = count + 1;
|
||||
structPtr->state = 0;
|
||||
menu->state = 0;
|
||||
}
|
||||
|
||||
static void InitSearchResultsConditionList(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
structPtr->searchMode = 1;
|
||||
structPtr->state = 0;
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
menu->inSearchMode = TRUE;
|
||||
menu->state = 0;
|
||||
}
|
||||
|
||||
static void GetMonConditionGraphData(s16 listId, u8 loadId)
|
||||
{
|
||||
u16 boxId, monId, i;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
|
||||
if (listId != (IsConditionMenuSearchMode() != 0 ? monListPtr->listCount : monListPtr->listCount - 1))
|
||||
if (listId != (IsConditionMenuSearchMode() ? monListPtr->listCount : monListPtr->listCount - 1))
|
||||
{
|
||||
boxId = monListPtr->monData[listId].boxId;
|
||||
monId = monListPtr->monData[listId].monId;
|
||||
structPtr->graph.conditions[loadId][CONDITION_COOL] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
|
||||
structPtr->graph.conditions[loadId][CONDITION_TOUGH] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
|
||||
structPtr->graph.conditions[loadId][CONDITION_SMART] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
|
||||
structPtr->graph.conditions[loadId][CONDITION_CUTE] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
|
||||
structPtr->graph.conditions[loadId][CONDITION_BEAUTY] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
|
||||
structPtr->numSparkles[loadId] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
||||
structPtr->monMarks[loadId] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_MARKINGS, NULL);
|
||||
ConditionGraph_CalcPositions(structPtr->graph.conditions[loadId], structPtr->graph.savedPositions[loadId]);
|
||||
menu->graph.conditions[loadId][CONDITION_COOL] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
|
||||
menu->graph.conditions[loadId][CONDITION_TOUGH] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
|
||||
menu->graph.conditions[loadId][CONDITION_SMART] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
|
||||
menu->graph.conditions[loadId][CONDITION_CUTE] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
|
||||
menu->graph.conditions[loadId][CONDITION_BEAUTY] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
|
||||
menu->numSparkles[loadId] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
||||
menu->monMarks[loadId] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_MARKINGS, NULL);
|
||||
ConditionGraph_CalcPositions(menu->graph.conditions[loadId], menu->graph.savedPositions[loadId]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set empty graph point
|
||||
for (i = 0; i < CONDITION_COUNT; i++)
|
||||
{
|
||||
structPtr->graph.conditions[loadId][i] = 0;
|
||||
structPtr->graph.savedPositions[loadId][i].x = CONDITION_GRAPH_CENTER_X;
|
||||
structPtr->graph.savedPositions[loadId][i].y = CONDITION_GRAPH_CENTER_Y;
|
||||
menu->graph.conditions[loadId][i] = 0;
|
||||
menu->graph.savedPositions[loadId][i].x = CONDITION_GRAPH_CENTER_X;
|
||||
menu->graph.savedPositions[loadId][i].y = CONDITION_GRAPH_CENTER_Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -515,10 +521,10 @@ static void ConditionGraphDrawMonPic(s16 listId, u8 loadId)
|
||||
{
|
||||
u16 boxId, monId, species;
|
||||
u32 personality, tid;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
|
||||
if (listId == (IsConditionMenuSearchMode() != 0 ? monListPtr->listCount : monListPtr->listCount - 1))
|
||||
if (listId == (IsConditionMenuSearchMode() ? monListPtr->listCount : monListPtr->listCount - 1))
|
||||
return;
|
||||
|
||||
boxId = monListPtr->monData[listId].boxId;
|
||||
@ -526,8 +532,8 @@ static void ConditionGraphDrawMonPic(s16 listId, u8 loadId)
|
||||
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
|
||||
tid = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
|
||||
personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
|
||||
LoadSpecialPokePic(&gMonFrontPicTable[species], structPtr->monPicGfx[loadId], species, personality, TRUE);
|
||||
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, tid, personality), structPtr->monPal[loadId]);
|
||||
LoadSpecialPokePic(&gMonFrontPicTable[species], menu->monPicGfx[loadId], species, personality, TRUE);
|
||||
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, tid, personality), menu->monPal[loadId]);
|
||||
}
|
||||
|
||||
u16 GetMonListCount(void)
|
||||
@ -536,7 +542,7 @@ u16 GetMonListCount(void)
|
||||
return monListPtr->listCount;
|
||||
}
|
||||
|
||||
u16 GetConditionGraphCurrentMonIndex(void)
|
||||
u16 GetConditionGraphCurrentListIndex(void)
|
||||
{
|
||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
return monListPtr->currIndex;
|
||||
@ -544,50 +550,50 @@ u16 GetConditionGraphCurrentMonIndex(void)
|
||||
|
||||
struct ConditionGraph *GetConditionGraphPtr(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return &structPtr->graph;
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return &menu->graph;
|
||||
}
|
||||
|
||||
u8 GetMonMarkIndex(void)
|
||||
u8 GetConditionGraphMenuCurrentLoadIndex(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->mark;
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->loadId;
|
||||
}
|
||||
|
||||
u8 sub_81CDC9C(void)
|
||||
u8 GetConditionGraphMenuToLoadListIndex(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->monIndex;
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->toLoadListIndex;
|
||||
}
|
||||
|
||||
void *GetConditionMonPicGfx(u8 loadId)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->monPicGfx[loadId];
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->monPicGfx[loadId];
|
||||
}
|
||||
|
||||
void *GetConditionMonPal(u8 loadId)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->monPal[loadId];
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->monPal[loadId];
|
||||
}
|
||||
|
||||
u8 sub_81CDCEC(void)
|
||||
u8 GetConditionGraphMenuToLoadId(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->unk6789;
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->toLoadId;
|
||||
}
|
||||
|
||||
u8 *GetConditionMonNameText(u8 loadId)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->nameText[loadId];
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->nameText[loadId];
|
||||
}
|
||||
|
||||
u8 *GetConditionMonLocationText(u8 loadId)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->locationText[loadId];
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->locationText[loadId];
|
||||
}
|
||||
|
||||
u16 GetConditionMonDataBuffer(void)
|
||||
@ -598,24 +604,25 @@ u16 GetConditionMonDataBuffer(void)
|
||||
|
||||
bool32 IsConditionMenuSearchMode(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
if (structPtr->searchMode == 1)
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
if (menu->inSearchMode == TRUE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Markings are only shown in search mode
|
||||
u8 TryGetMonMarkId(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
if (structPtr->searchMode == 1)
|
||||
return structPtr->monMarks[structPtr->mark];
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
if (menu->inSearchMode == TRUE)
|
||||
return menu->monMarks[menu->loadId];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 GetNumConditionMonSparkles(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||
return structPtr->numSparkles[structPtr->mark];
|
||||
struct Pokenav_ConditionMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU);
|
||||
return menu->numSparkles[menu->loadId];
|
||||
}
|
||||
|
@ -16,21 +16,21 @@
|
||||
#include "text.h"
|
||||
|
||||
static u32 LoopedTask_TransitionMons(s32);
|
||||
static u32 LoopedTask_ExitPartyConditionMenu(s32);
|
||||
static u32 LoopedTask_ExitConditionGraphMenu(s32);
|
||||
static u32 LoopedTask_MoveCursorNoTransition(s32);
|
||||
static u32 LoopedTask_SlideMonOut(s32);
|
||||
static u32 LoopedTask_OpenMonMarkingsWindow(s32);
|
||||
static u32 LoopedTask_CloseMonMarkingsWindow(s32);
|
||||
|
||||
static u8 sUnknown_030012BC;
|
||||
static u8 sInitialLoadId; // Never read
|
||||
|
||||
const u16 gConditionGraphData_Pal[] = INCBIN_U16("graphics/pokenav/condition/graph_data.gbapal");
|
||||
const u16 gConditionText_Pal[] = INCBIN_U16("graphics/pokenav/condition/text.gbapal");
|
||||
static const u32 sUnknown_08623228[] = INCBIN_U32("graphics/pokenav/condition/graph_data.4bpp.lz");
|
||||
static const u32 sConditionGraph_Tilemap[] = INCBIN_U32("graphics/pokenav/862323C.bin.lz");
|
||||
static const u16 sConditionGraphMonMarkingsPal[] = INCBIN_U16("graphics/pokenav/8623338.gbapal");
|
||||
static const u32 sConditionGraphData_Gfx[] = INCBIN_U32("graphics/pokenav/condition/graph_data.4bpp.lz");
|
||||
static const u32 sConditionGraphData_Tilemap[] = INCBIN_U32("graphics/pokenav/condition/graph_data.bin.lz");
|
||||
static const u16 sMonMarkings_Pal[] = INCBIN_U16("graphics/pokenav/condition/mon_markings.gbapal");
|
||||
|
||||
static const struct BgTemplate sPartyConditionBgTemplates[3] =
|
||||
static const struct BgTemplate sMenuBgTemplates[3] =
|
||||
{
|
||||
{
|
||||
.bg = 1,
|
||||
@ -72,7 +72,7 @@ static const struct WindowTemplate sMonNameGenderWindowTemplate =
|
||||
.baseBlock = 2
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sConditionGraphListIdWindowTemplate =
|
||||
static const struct WindowTemplate sListIndexWindowTemplate =
|
||||
{
|
||||
.bg = 1,
|
||||
.tilemapLeft = 1,
|
||||
@ -105,29 +105,29 @@ static const struct WindowTemplate sUnusedWindowTemplate2 =
|
||||
.baseBlock = 0x44
|
||||
};
|
||||
|
||||
static const LoopedTask sPartyConditionLoopedTaskFuncs[] =
|
||||
static const LoopedTask sLoopedTaskFuncs[] =
|
||||
{
|
||||
[PARTY_CONDITION_FUNC_NONE] = NULL,
|
||||
[PARTY_CONDITION_FUNC_SLIDE_MON_IN] = LoopedTask_TransitionMons,
|
||||
[PARTY_CONDITION_FUNC_RETURN] = LoopedTask_ExitPartyConditionMenu,
|
||||
[PARTY_CONDITION_FUNC_NO_TRANSITION] = LoopedTask_MoveCursorNoTransition,
|
||||
[PARTY_CONDITION_FUNC_SLIDE_MON_OUT] = LoopedTask_SlideMonOut,
|
||||
[PARTY_CONDITION_FUNC_ADD_MARKINGS] = LoopedTask_OpenMonMarkingsWindow,
|
||||
[PARTY_CONDITION_FUNC_CLOSE_MARKINGS] = LoopedTask_CloseMonMarkingsWindow
|
||||
[CONDITION_FUNC_NONE] = NULL,
|
||||
[CONDITION_FUNC_SLIDE_MON_IN] = LoopedTask_TransitionMons,
|
||||
[CONDITION_FUNC_RETURN] = LoopedTask_ExitConditionGraphMenu,
|
||||
[CONDITION_FUNC_NO_TRANSITION] = LoopedTask_MoveCursorNoTransition,
|
||||
[CONDITION_FUNC_SLIDE_MON_OUT] = LoopedTask_SlideMonOut,
|
||||
[CONDITION_FUNC_ADD_MARKINGS] = LoopedTask_OpenMonMarkingsWindow,
|
||||
[CONDITION_FUNC_CLOSE_MARKINGS] = LoopedTask_CloseMonMarkingsWindow
|
||||
};
|
||||
|
||||
struct Pokenav7Struct
|
||||
struct Pokenav_ConditionMenuGfx
|
||||
{
|
||||
u32 loopedTaskId;
|
||||
u8 tilemapBuffers[3][BG_SCREEN_SIZE];
|
||||
u8 filler[2];
|
||||
u8 partyPokeballSpriteIds[10];
|
||||
u8 partyPokeballSpriteIds[PARTY_SIZE + 1];
|
||||
u32 (*callback)(void);
|
||||
s16 monTransitionX;
|
||||
u8 monPicSpriteId;
|
||||
u16 monPalIndex;
|
||||
u16 monGfxTileStart;
|
||||
void *unk181C;
|
||||
void *monGfxPtr;
|
||||
u8 nameGenderWindowId;
|
||||
u8 listIndexWindowId;
|
||||
u8 unusedWindowId1;
|
||||
@ -139,66 +139,65 @@ struct Pokenav7Struct
|
||||
u8 filler2[0xFA3];
|
||||
};
|
||||
|
||||
extern s8 GetMonMarkIndex(void); // This function's declaration here is s8 vs. u8 in pokenav_conditions_1.c
|
||||
extern s8 GetConditionGraphMenuCurrentLoadIndex(void); // This function's declaration here is s8 vs. u8 in pokenav_conditions_1.c
|
||||
|
||||
static u32 LoopedTask_OpenPartyConditionGraph(s32 state);
|
||||
static u32 GetPartyConditionLoopedTaskActive(void);
|
||||
static void CreateConditionMonPic(u8 var);
|
||||
static u32 LoopedTask_OpenConditionGraphMenu(s32);
|
||||
static u32 GetConditionGraphMenuLoopedTaskActive(void);
|
||||
static void CreateConditionMonPic(u8);
|
||||
static void CreateMonMarkingsOrPokeballIndicators(void);
|
||||
static void CopyUnusedConditionWindowsToVram(void);
|
||||
static bool32 UpdateConditionGraphWindows(u8 a0, u16 a1, bool8 a2);
|
||||
static bool32 UpdateConditionGraphMenuWindows(u8, u16, bool8);
|
||||
static void VBlankCB_PokenavConditionGraph(void);
|
||||
static void DoConditionGraphTransition(void);
|
||||
static void sub_81CEEC8(void);
|
||||
static void sub_81CEE68(void);
|
||||
static void ToggleGraphData(bool8 showBg);
|
||||
static void DoConditionGraphEnterTransition(void);
|
||||
static void DoConditionGraphExitTransition(void);
|
||||
static void SetExitVBlank(void);
|
||||
static void ToggleGraphData(bool8);
|
||||
|
||||
// code
|
||||
bool32 OpenPartyConditionMenu(void)
|
||||
bool32 OpenConditionGraphMenu(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_MON_MARK_MENU, sizeof(struct Pokenav7Struct));
|
||||
struct Pokenav_ConditionMenuGfx *menu = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX, sizeof(struct Pokenav_ConditionMenuGfx));
|
||||
|
||||
if (structPtr == NULL)
|
||||
if (menu == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->monPicSpriteId = SPRITE_NONE;
|
||||
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_OpenPartyConditionGraph, 1);
|
||||
structPtr->callback = GetPartyConditionLoopedTaskActive;
|
||||
structPtr->windowModeState = 0;
|
||||
menu->monPicSpriteId = SPRITE_NONE;
|
||||
menu->loopedTaskId = CreateLoopedTask(LoopedTask_OpenConditionGraphMenu, 1);
|
||||
menu->callback = GetConditionGraphMenuLoopedTaskActive;
|
||||
menu->windowModeState = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CreatePartyConditionLoopedTask(s32 id)
|
||||
void CreateConditionGraphMenuLoopedTask(s32 id)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
structPtr->loopedTaskId = CreateLoopedTask(sPartyConditionLoopedTaskFuncs[id], 1);
|
||||
structPtr->callback = GetPartyConditionLoopedTaskActive;
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
menu->loopedTaskId = CreateLoopedTask(sLoopedTaskFuncs[id], 1);
|
||||
menu->callback = GetConditionGraphMenuLoopedTaskActive;
|
||||
}
|
||||
|
||||
u32 IsPartyConditionLoopedTaskActive(void)
|
||||
u32 IsConditionGraphMenuLoopedTaskActive(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
return structPtr->callback();
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
return menu->callback();
|
||||
}
|
||||
|
||||
static u32 GetPartyConditionLoopedTaskActive(void)
|
||||
static u32 GetConditionGraphMenuLoopedTaskActive(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
return IsLoopedTaskActive(structPtr->loopedTaskId);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
return IsLoopedTaskActive(menu->loopedTaskId);
|
||||
}
|
||||
|
||||
static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
static u32 LoopedTask_OpenConditionGraphMenu(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
if (LoadPartyConditionMenuGfx() != TRUE)
|
||||
if (LoadConditionGraphMenuGfx() != TRUE)
|
||||
return LT_PAUSE;
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 1:
|
||||
InitBgTemplates(sPartyConditionBgTemplates, ARRAY_COUNT(sPartyConditionBgTemplates));
|
||||
InitBgTemplates(sMenuBgTemplates, ARRAY_COUNT(sMenuBgTemplates));
|
||||
ChangeBgX(1, 0, BG_COORD_SET);
|
||||
ChangeBgY(1, 0, BG_COORD_SET);
|
||||
ChangeBgX(2, 0, BG_COORD_SET);
|
||||
@ -213,28 +212,28 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
case 2:
|
||||
if (FreeTempTileDataBuffersIfPossible())
|
||||
return LT_PAUSE;
|
||||
DecompressAndCopyTileDataToVram(2, sUnknown_08623228, 0, 0, 0);
|
||||
DecompressAndCopyTileDataToVram(2, sConditionGraphData_Gfx, 0, 0, 0);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (FreeTempTileDataBuffersIfPossible())
|
||||
return LT_PAUSE;
|
||||
|
||||
LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]);
|
||||
SetBgTilemapBuffer(3, structPtr->tilemapBuffers[0]);
|
||||
LZ77UnCompVram(gPokenavCondition_Tilemap, menu->tilemapBuffers[0]);
|
||||
SetBgTilemapBuffer(3, menu->tilemapBuffers[0]);
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
CopyToBgTilemapBufferRect(3, gPokenavOptions_Tilemap, 0, 5, 9, 4);
|
||||
|
||||
CopyBgTilemapBufferToVram(3);
|
||||
CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20);
|
||||
CopyPaletteIntoBufferUnfaded(gConditionText_Pal, 0xF0, 0x20);
|
||||
structPtr->monTransitionX = -80;
|
||||
menu->monTransitionX = -80;
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 4:
|
||||
if (FreeTempTileDataBuffersIfPossible())
|
||||
return LT_PAUSE;
|
||||
|
||||
LZ77UnCompVram(sConditionGraph_Tilemap, structPtr->tilemapBuffers[2]);
|
||||
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]);
|
||||
LZ77UnCompVram(sConditionGraphData_Tilemap, menu->tilemapBuffers[2]);
|
||||
SetBgTilemapBuffer(2, menu->tilemapBuffers[2]);
|
||||
CopyBgTilemapBufferToVram(2);
|
||||
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, 0x30, 0x20);
|
||||
ConditionGraph_InitWindow(2);
|
||||
@ -242,19 +241,19 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
case 5:
|
||||
BgDmaFill(1, 0, 0, 1);
|
||||
BgDmaFill(1, 17, 1, 1);
|
||||
CpuFill32(0, structPtr->tilemapBuffers[1], BG_SCREEN_SIZE);
|
||||
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
|
||||
CpuFill32(0, menu->tilemapBuffers[1], BG_SCREEN_SIZE);
|
||||
SetBgTilemapBuffer(1, menu->tilemapBuffers[1]);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 6:
|
||||
if (FreeTempTileDataBuffersIfPossible())
|
||||
return LT_PAUSE;
|
||||
|
||||
structPtr->nameGenderWindowId = AddWindow(&sMonNameGenderWindowTemplate);
|
||||
menu->nameGenderWindowId = AddWindow(&sMonNameGenderWindowTemplate);
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
structPtr->listIndexWindowId = AddWindow(&sConditionGraphListIdWindowTemplate);
|
||||
structPtr->unusedWindowId1 = AddWindow(&sUnusedWindowTemplate1);
|
||||
structPtr->unusedWindowId2 = AddWindow(&sUnusedWindowTemplate2);
|
||||
menu->listIndexWindowId = AddWindow(&sListIndexWindowTemplate);
|
||||
menu->unusedWindowId1 = AddWindow(&sUnusedWindowTemplate1);
|
||||
menu->unusedWindowId2 = AddWindow(&sUnusedWindowTemplate2);
|
||||
}
|
||||
DeactivateAllTextPrinters();
|
||||
return LT_INC_AND_PAUSE;
|
||||
@ -269,23 +268,23 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
CopyUnusedConditionWindowsToVram();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 10:
|
||||
UpdateConditionGraphWindows(0, GetMonMarkIndex(), TRUE);
|
||||
UpdateConditionGraphMenuWindows(0, GetConditionGraphMenuCurrentLoadIndex(), TRUE);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 11:
|
||||
UpdateConditionGraphWindows(1, GetMonMarkIndex(), TRUE);
|
||||
UpdateConditionGraphMenuWindows(1, GetConditionGraphMenuCurrentLoadIndex(), TRUE);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 12:
|
||||
UpdateConditionGraphWindows(2, GetMonMarkIndex(), TRUE);
|
||||
UpdateConditionGraphMenuWindows(2, GetConditionGraphMenuCurrentLoadIndex(), TRUE);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 13:
|
||||
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), TRUE) != TRUE)
|
||||
if (UpdateConditionGraphMenuWindows(3, GetConditionGraphMenuCurrentLoadIndex(), TRUE) != TRUE)
|
||||
return LT_PAUSE;
|
||||
PutWindowTilemap(structPtr->nameGenderWindowId);
|
||||
PutWindowTilemap(menu->nameGenderWindowId);
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
PutWindowTilemap(structPtr->listIndexWindowId);
|
||||
PutWindowTilemap(structPtr->unusedWindowId1);
|
||||
PutWindowTilemap(structPtr->unusedWindowId2);
|
||||
PutWindowTilemap(menu->listIndexWindowId);
|
||||
PutWindowTilemap(menu->unusedWindowId1);
|
||||
PutWindowTilemap(menu->unusedWindowId2);
|
||||
}
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 14:
|
||||
@ -312,7 +311,7 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
SetVBlankCallback_(VBlankCB_PokenavConditionGraph);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 17:
|
||||
DoConditionGraphTransition();
|
||||
DoConditionGraphEnterTransition();
|
||||
ConditionGraph_InitResetScanline(GetConditionGraphPtr());
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 18:
|
||||
@ -323,11 +322,11 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
ToggleGraphData(TRUE);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 20:
|
||||
if (!ConditionMenu_UpdateMonEnter(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||
if (!ConditionMenu_UpdateMonEnter(GetConditionGraphPtr(), &menu->monTransitionX))
|
||||
{
|
||||
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||
if (IsConditionMenuSearchMode() == TRUE || GetConditionGraphCurrentMonIndex() != GetMonListCount())
|
||||
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetNumConditionMonSparkles());
|
||||
ResetConditionSparkleSprites(menu->conditionSparkleSprites);
|
||||
if (IsConditionMenuSearchMode() == TRUE || GetConditionGraphCurrentListIndex() != GetMonListCount())
|
||||
CreateConditionSparkleSprites(menu->conditionSparkleSprites, menu->monPicSpriteId, GetNumConditionMonSparkles());
|
||||
|
||||
return LT_FINISH;
|
||||
}
|
||||
@ -337,18 +336,18 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static u32 LoopedTask_ExitPartyConditionMenu(s32 state)
|
||||
static u32 LoopedTask_ExitConditionGraphMenu(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_81CEEC8();
|
||||
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||
DoConditionGraphExitTransition();
|
||||
DestroyConditionSparkleSprites(menu->conditionSparkleSprites);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 1:
|
||||
if (ConditionMenu_UpdateMonExit(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||
if (ConditionMenu_UpdateMonExit(GetConditionGraphPtr(), &menu->monTransitionX))
|
||||
return 2;
|
||||
ToggleGraphData(FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
@ -360,7 +359,7 @@ static u32 LoopedTask_ExitPartyConditionMenu(s32 state)
|
||||
case 3:
|
||||
if (IsPaletteFadeActive() || MainMenuLoopedTaskIsBusy())
|
||||
return LT_PAUSE;
|
||||
FreeConditionSparkles(structPtr->conditionSparkleSprites);
|
||||
FreeConditionSparkles(menu->conditionSparkleSprites);
|
||||
HideBg(1);
|
||||
HideBg(2);
|
||||
HideBg(3);
|
||||
@ -372,53 +371,53 @@ static u32 LoopedTask_ExitPartyConditionMenu(s32 state)
|
||||
|
||||
static u32 LoopedTask_TransitionMons(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
SetConditionGraphData(0);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_MON_INFO);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 1:
|
||||
SetConditionGraphData(1);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_GRAPH);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 2:
|
||||
SetConditionGraphData(2);
|
||||
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_MON_PIC);
|
||||
DestroyConditionSparkleSprites(menu->conditionSparkleSprites);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 3:
|
||||
ConditionGraph_TryUpdate(graph);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 4:
|
||||
if (!MoveConditionMonOffscreen(&structPtr->monTransitionX))
|
||||
if (!MoveConditionMonOffscreen(&menu->monTransitionX))
|
||||
{
|
||||
CreateConditionMonPic(GetMonMarkIndex());
|
||||
CreateConditionMonPic(GetConditionGraphMenuCurrentLoadIndex());
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
return LT_PAUSE;
|
||||
case 5:
|
||||
UpdateConditionGraphWindows(0, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(0, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 6:
|
||||
UpdateConditionGraphWindows(1, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(1, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 7:
|
||||
UpdateConditionGraphWindows(2, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(2, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 8:
|
||||
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), FALSE) == TRUE)
|
||||
if (UpdateConditionGraphMenuWindows(3, GetConditionGraphMenuCurrentLoadIndex(), FALSE) == TRUE)
|
||||
return LT_INC_AND_CONTINUE;
|
||||
return LT_PAUSE;
|
||||
case 9:
|
||||
graph = GetConditionGraphPtr();
|
||||
if (!ConditionMenu_UpdateMonEnter(graph, &structPtr->monTransitionX))
|
||||
if (!ConditionMenu_UpdateMonEnter(graph, &menu->monTransitionX))
|
||||
{
|
||||
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||
if (IsConditionMenuSearchMode() != TRUE && GetConditionGraphCurrentMonIndex() == GetMonListCount())
|
||||
ResetConditionSparkleSprites(menu->conditionSparkleSprites);
|
||||
if (IsConditionMenuSearchMode() != TRUE && GetConditionGraphCurrentListIndex() == GetMonListCount())
|
||||
return LT_INC_AND_CONTINUE;
|
||||
|
||||
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetNumConditionMonSparkles());
|
||||
CreateConditionSparkleSprites(menu->conditionSparkleSprites, menu->monPicSpriteId, GetNumConditionMonSparkles());
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
return LT_PAUSE;
|
||||
@ -429,40 +428,40 @@ static u32 LoopedTask_TransitionMons(s32 state)
|
||||
|
||||
static u32 LoopedTask_MoveCursorNoTransition(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
SetConditionGraphData(0);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_MON_INFO);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 1:
|
||||
SetConditionGraphData(1);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_GRAPH);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 2:
|
||||
SetConditionGraphData(2);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_MON_PIC);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 3:
|
||||
CreateConditionMonPic(GetMonMarkIndex());
|
||||
CreateConditionMonPic(GetConditionGraphMenuCurrentLoadIndex());
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 4:
|
||||
UpdateConditionGraphWindows(0, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(0, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 5:
|
||||
UpdateConditionGraphWindows(1, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(1, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 6:
|
||||
UpdateConditionGraphWindows(2, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(2, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 7:
|
||||
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), FALSE) == TRUE)
|
||||
if (UpdateConditionGraphMenuWindows(3, GetConditionGraphMenuCurrentLoadIndex(), FALSE) == TRUE)
|
||||
return LT_INC_AND_CONTINUE;
|
||||
return LT_PAUSE;
|
||||
case 8:
|
||||
if (!ConditionMenu_UpdateMonEnter(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||
if (!ConditionMenu_UpdateMonEnter(GetConditionGraphPtr(), &menu->monTransitionX))
|
||||
{
|
||||
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetNumConditionMonSparkles());
|
||||
ResetConditionSparkleSprites(menu->conditionSparkleSprites);
|
||||
CreateConditionSparkleSprites(menu->conditionSparkleSprites, menu->monPicSpriteId, GetNumConditionMonSparkles());
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
return LT_PAUSE;
|
||||
@ -473,35 +472,35 @@ static u32 LoopedTask_MoveCursorNoTransition(s32 state)
|
||||
|
||||
static u32 LoopedTask_SlideMonOut(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
SetConditionGraphData(0);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_MON_INFO);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 1:
|
||||
SetConditionGraphData(1);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_GRAPH);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 2:
|
||||
SetConditionGraphData(2);
|
||||
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||
LoadNextConditionMenuMonData(CONDITION_LOAD_MON_PIC);
|
||||
DestroyConditionSparkleSprites(menu->conditionSparkleSprites);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 3:
|
||||
if (!ConditionMenu_UpdateMonExit(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||
if (!ConditionMenu_UpdateMonExit(GetConditionGraphPtr(), &menu->monTransitionX))
|
||||
return LT_INC_AND_CONTINUE;
|
||||
return LT_PAUSE;
|
||||
case 4:
|
||||
UpdateConditionGraphWindows(0, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(0, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 5:
|
||||
UpdateConditionGraphWindows(1, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(1, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 6:
|
||||
UpdateConditionGraphWindows(2, GetMonMarkIndex(), FALSE);
|
||||
UpdateConditionGraphMenuWindows(2, GetConditionGraphMenuCurrentLoadIndex(), FALSE);
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 7:
|
||||
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), FALSE) == TRUE)
|
||||
if (UpdateConditionGraphMenuWindows(3, GetConditionGraphMenuCurrentLoadIndex(), FALSE) == TRUE)
|
||||
return LT_INC_AND_CONTINUE;
|
||||
return LT_PAUSE;
|
||||
}
|
||||
@ -555,68 +554,68 @@ static u8 *UnusedPrintNumberString(u8 *dst, u16 num)
|
||||
return txtPtr;
|
||||
}
|
||||
|
||||
static bool32 UpdateConditionGraphWindows(u8 mode, u16 bufferIndex, bool8 winMode)
|
||||
static bool32 UpdateConditionGraphMenuWindows(u8 mode, u16 bufferIndex, bool8 winMode)
|
||||
{
|
||||
u8 text[32];
|
||||
const u8 *str;
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
FillWindowPixelBuffer(structPtr->nameGenderWindowId, 0);
|
||||
FillWindowPixelBuffer(menu->nameGenderWindowId, 0);
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
FillWindowPixelBuffer(structPtr->listIndexWindowId, 0);
|
||||
FillWindowPixelBuffer(menu->listIndexWindowId, 0);
|
||||
break;
|
||||
case 1:
|
||||
if (GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1 || IsConditionMenuSearchMode() == TRUE)
|
||||
if (GetConditionGraphCurrentListIndex() != GetMonListCount() - 1 || IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
str = GetConditionMonNameText(bufferIndex);
|
||||
AddTextPrinterParameterized(structPtr->nameGenderWindowId, FONT_NORMAL, str, 0, 1, 0, NULL);
|
||||
AddTextPrinterParameterized(menu->nameGenderWindowId, FONT_NORMAL, str, 0, 1, 0, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
str = GetConditionMonLocationText(bufferIndex);
|
||||
AddTextPrinterParameterized(structPtr->nameGenderWindowId, FONT_NORMAL, str, 0, 17, 0, NULL);
|
||||
AddTextPrinterParameterized(menu->nameGenderWindowId, FONT_NORMAL, str, 0, 17, 0, NULL);
|
||||
text[0] = EXT_CTRL_CODE_BEGIN;
|
||||
text[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
|
||||
text[2] = TEXT_COLOR_BLUE;
|
||||
text[3] = TEXT_COLOR_TRANSPARENT;
|
||||
text[4] = TEXT_COLOR_LIGHT_BLUE;
|
||||
StringCopy(&text[5], gText_Number2);
|
||||
AddTextPrinterParameterized(structPtr->listIndexWindowId, FONT_NORMAL, text, 4, 1, 0, NULL);
|
||||
AddTextPrinterParameterized(menu->listIndexWindowId, FONT_NORMAL, text, 4, 1, 0, NULL);
|
||||
ConvertIntToDecimalStringN(&text[5], GetConditionMonDataBuffer(), STR_CONV_MODE_RIGHT_ALIGN, 4);
|
||||
AddTextPrinterParameterized(structPtr->listIndexWindowId, FONT_NORMAL, text, 28, 1, 0, NULL);
|
||||
AddTextPrinterParameterized(menu->listIndexWindowId, FONT_NORMAL, text, 28, 1, 0, NULL);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (structPtr->windowModeState)
|
||||
switch (menu->windowModeState)
|
||||
{
|
||||
case 0:
|
||||
if (winMode)
|
||||
CopyWindowToVram(structPtr->nameGenderWindowId, COPYWIN_FULL);
|
||||
CopyWindowToVram(menu->nameGenderWindowId, COPYWIN_FULL);
|
||||
else
|
||||
CopyWindowToVram(structPtr->nameGenderWindowId, COPYWIN_GFX);
|
||||
CopyWindowToVram(menu->nameGenderWindowId, COPYWIN_GFX);
|
||||
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
structPtr->windowModeState++;
|
||||
menu->windowModeState++;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->windowModeState = 0;
|
||||
menu->windowModeState = 0;
|
||||
return TRUE;
|
||||
}
|
||||
case 1:
|
||||
if (winMode)
|
||||
CopyWindowToVram(structPtr->listIndexWindowId, COPYWIN_FULL);
|
||||
CopyWindowToVram(menu->listIndexWindowId, COPYWIN_FULL);
|
||||
else
|
||||
CopyWindowToVram(structPtr->listIndexWindowId, COPYWIN_GFX);
|
||||
CopyWindowToVram(menu->listIndexWindowId, COPYWIN_GFX);
|
||||
|
||||
structPtr->windowModeState = 0;
|
||||
menu->windowModeState = 0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -626,23 +625,23 @@ static bool32 UpdateConditionGraphWindows(u8 mode, u16 bufferIndex, bool8 winMod
|
||||
|
||||
static void CopyUnusedConditionWindowsToVram(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
CopyWindowToVram(structPtr->unusedWindowId1, COPYWIN_FULL);
|
||||
CopyWindowToVram(structPtr->unusedWindowId2, COPYWIN_FULL);
|
||||
CopyWindowToVram(menu->unusedWindowId1, COPYWIN_FULL);
|
||||
CopyWindowToVram(menu->unusedWindowId2, COPYWIN_FULL);
|
||||
}
|
||||
|
||||
void sub_81CE964(struct Sprite *sprite)
|
||||
static void SpriteCB_PartyPokeball(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[0] == GetConditionGraphCurrentMonIndex())
|
||||
StartSpriteAnim(sprite, 0);
|
||||
if (sprite->data[0] == GetConditionGraphCurrentListIndex())
|
||||
StartSpriteAnim(sprite, CONDITION_ICON_SELECTED);
|
||||
else
|
||||
StartSpriteAnim(sprite, 1);
|
||||
StartSpriteAnim(sprite, CONDITION_ICON_UNSELECTED);
|
||||
}
|
||||
|
||||
void HighlightCurrentPartyIndexPokeball(struct Sprite *sprite)
|
||||
{
|
||||
if (GetConditionGraphCurrentMonIndex() == GetMonListCount() - 1)
|
||||
if (GetConditionGraphCurrentListIndex() == GetMonListCount() - 1)
|
||||
sprite->oam.paletteNum = IndexOfSpritePaletteTag(TAG_CONDITION_BALL);
|
||||
else
|
||||
sprite->oam.paletteNum = IndexOfSpritePaletteTag(TAG_CONDITION_CANCEL);
|
||||
@ -661,71 +660,76 @@ static void CreateMonMarkingsOrPokeballIndicators(void)
|
||||
struct SpriteSheet sprSheet;
|
||||
struct Sprite *sprite;
|
||||
u16 i, spriteId;
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
LoadConditionSelectionIcons(sprSheets, &sprTemplate, sprPals);
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
structPtr->marksMenu.baseTileTag = TAG_CONDITION_MARKINGS_MENU;
|
||||
structPtr->marksMenu.basePaletteTag = TAG_CONDITION_MARKINGS_MENU;
|
||||
InitMonMarkingsMenu(&structPtr->marksMenu);
|
||||
// Search Mode, load markings menu
|
||||
menu->marksMenu.baseTileTag = TAG_CONDITION_MARKINGS_MENU;
|
||||
menu->marksMenu.basePaletteTag = TAG_CONDITION_MARKINGS_MENU;
|
||||
InitMonMarkingsMenu(&menu->marksMenu);
|
||||
BufferMonMarkingsMenuTiles();
|
||||
sprite = CreateMonMarkingAllCombosSprite(TAG_CONDITION_MON_MARKINGS, TAG_CONDITION_MON_MARKINGS, sConditionGraphMonMarkingsPal);
|
||||
sprite = CreateMonMarkingAllCombosSprite(TAG_CONDITION_MON_MARKINGS, TAG_CONDITION_MON_MARKINGS, sMonMarkings_Pal);
|
||||
sprite->oam.priority = 3;
|
||||
sprite->x = 192;
|
||||
sprite->y = 32;
|
||||
sprite->callback = MonMarkingsCallback;
|
||||
structPtr->monMarksSprite = sprite;
|
||||
menu->monMarksSprite = sprite;
|
||||
PokenavFillPalette(IndexOfSpritePaletteTag(TAG_CONDITION_MON_MARKINGS), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// party mode -> add pokeballs on right hand side
|
||||
// Party Mode, load Pokéball selection icons
|
||||
LoadSpriteSheets(sprSheets);
|
||||
Pokenav_AllocAndLoadPalettes(sprPals);
|
||||
|
||||
// Add icons for occupied slots
|
||||
for (i = 0; i < GetMonListCount() - 1; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&sprTemplate, 226, (i * 20) + 8, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
structPtr->partyPokeballSpriteIds[i] = spriteId;
|
||||
menu->partyPokeballSpriteIds[i] = spriteId;
|
||||
gSprites[spriteId].data[0] = i;
|
||||
gSprites[spriteId].callback = sub_81CE964;
|
||||
gSprites[spriteId].callback = SpriteCB_PartyPokeball;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
|
||||
menu->partyPokeballSpriteIds[i] = SPRITE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add icons for empty slots
|
||||
sprTemplate.tileTag = TAG_CONDITION_BALL_PLACEHOLDER;
|
||||
sprTemplate.callback = SpriteCallbackDummy;
|
||||
for (; i < 6; i++)
|
||||
for (; i < PARTY_SIZE; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&sprTemplate, 230, (i * 20) + 8, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
structPtr->partyPokeballSpriteIds[i] = spriteId;
|
||||
menu->partyPokeballSpriteIds[i] = spriteId;
|
||||
gSprites[spriteId].oam.size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
|
||||
menu->partyPokeballSpriteIds[i] = SPRITE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add cancel icon
|
||||
sprTemplate.tileTag = TAG_CONDITION_CANCEL;
|
||||
sprTemplate.callback = HighlightCurrentPartyIndexPokeball;
|
||||
spriteId = CreateSprite(&sprTemplate, 222, (i * 20) + 8, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
structPtr->partyPokeballSpriteIds[i] = spriteId;
|
||||
menu->partyPokeballSpriteIds[i] = spriteId;
|
||||
gSprites[spriteId].oam.shape = SPRITE_SHAPE(32x16);
|
||||
gSprites[spriteId].oam.size = SPRITE_SIZE(32x16);
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
|
||||
menu->partyPokeballSpriteIds[i] = SPRITE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,13 +739,13 @@ static void CreateMonMarkingsOrPokeballIndicators(void)
|
||||
Pokenav_AllocAndLoadPalettes(sprPals);
|
||||
}
|
||||
|
||||
void sub_81CEBF4(struct Pokenav7Struct *structPtr)
|
||||
static void FreeConditionMenuGfx(struct Pokenav_ConditionMenuGfx *menu)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
DestroySprite(structPtr->monMarksSprite);
|
||||
DestroySprite(menu->monMarksSprite);
|
||||
FreeSpriteTilesByTag(TAG_CONDITION_MARKINGS_MENU);
|
||||
FreeSpriteTilesByTag(TAG_CONDITION_MON_MARKINGS);
|
||||
FreeSpritePaletteByTag(TAG_CONDITION_MARKINGS_MENU);
|
||||
@ -749,8 +753,8 @@ void sub_81CEBF4(struct Pokenav7Struct *structPtr)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 7; i++)
|
||||
DestroySprite(&gSprites[structPtr->partyPokeballSpriteIds[i]]);
|
||||
for (i = 0; i < PARTY_SIZE + 1; i++)
|
||||
DestroySprite(&gSprites[menu->partyPokeballSpriteIds[i]]);
|
||||
|
||||
FreeSpriteTilesByTag(TAG_CONDITION_BALL);
|
||||
FreeSpriteTilesByTag(TAG_CONDITION_CANCEL);
|
||||
@ -759,24 +763,24 @@ void sub_81CEBF4(struct Pokenav7Struct *structPtr)
|
||||
FreeSpritePaletteByTag(TAG_CONDITION_CANCEL);
|
||||
}
|
||||
|
||||
if (structPtr->monPicSpriteId != SPRITE_NONE)
|
||||
if (menu->monPicSpriteId != SPRITE_NONE)
|
||||
{
|
||||
DestroySprite(&gSprites[structPtr->monPicSpriteId]);
|
||||
DestroySprite(&gSprites[menu->monPicSpriteId]);
|
||||
FreeSpriteTilesByTag(TAG_CONDITION_MON);
|
||||
FreeSpritePaletteByTag(TAG_CONDITION_MON);
|
||||
}
|
||||
}
|
||||
|
||||
void FreePartyConditionSubstruct2(void)
|
||||
void FreeConditionGraphMenuSubstruct2(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
RemoveWindow(structPtr->nameGenderWindowId);
|
||||
RemoveWindow(menu->nameGenderWindowId);
|
||||
if (IsConditionMenuSearchMode() == TRUE)
|
||||
{
|
||||
RemoveWindow(structPtr->listIndexWindowId);
|
||||
RemoveWindow(structPtr->unusedWindowId1);
|
||||
RemoveWindow(structPtr->unusedWindowId2);
|
||||
RemoveWindow(menu->listIndexWindowId);
|
||||
RemoveWindow(menu->unusedWindowId1);
|
||||
RemoveWindow(menu->unusedWindowId2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -784,15 +788,15 @@ void FreePartyConditionSubstruct2(void)
|
||||
}
|
||||
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
|
||||
sub_81CEBF4(structPtr);
|
||||
sub_81CEE68();
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
FreeConditionMenuGfx(menu);
|
||||
SetExitVBlank();
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
}
|
||||
|
||||
void MonPicGfxSpriteCallback(struct Sprite *sprite)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
sprite->x = structPtr->monTransitionX + 38;
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
sprite->x = menu->monTransitionX + 38;
|
||||
}
|
||||
|
||||
static void CreateConditionMonPic(u8 id)
|
||||
@ -801,35 +805,35 @@ static void CreateConditionMonPic(u8 id)
|
||||
struct SpriteSheet sprSheet;
|
||||
struct SpritePalette sprPal;
|
||||
u8 spriteId;
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
if (structPtr->monPicSpriteId == SPRITE_NONE)
|
||||
if (menu->monPicSpriteId == SPRITE_NONE)
|
||||
{
|
||||
LoadConditionMonPicTemplate(&sprSheet, &sprTemplate, &sprPal);
|
||||
sprSheet.data = GetConditionMonPicGfx(id);
|
||||
sprPal.data = GetConditionMonPal(id);
|
||||
structPtr->monPalIndex = LoadSpritePalette(&sprPal);
|
||||
structPtr->monGfxTileStart = LoadSpriteSheet(&sprSheet);
|
||||
menu->monPalIndex = LoadSpritePalette(&sprPal);
|
||||
menu->monGfxTileStart = LoadSpriteSheet(&sprSheet);
|
||||
spriteId = CreateSprite(&sprTemplate, 38, 104, 0);
|
||||
structPtr->monPicSpriteId = spriteId;
|
||||
menu->monPicSpriteId = spriteId;
|
||||
if (spriteId == MAX_SPRITES)
|
||||
{
|
||||
FreeSpriteTilesByTag(TAG_CONDITION_MON);
|
||||
FreeSpritePaletteByTag(TAG_CONDITION_MON);
|
||||
structPtr->monPicSpriteId = SPRITE_NONE;
|
||||
menu->monPicSpriteId = SPRITE_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->monPicSpriteId = spriteId;
|
||||
gSprites[structPtr->monPicSpriteId].callback = MonPicGfxSpriteCallback;
|
||||
structPtr->unk181C = (void*)VRAM + BG_VRAM_SIZE + (structPtr->monGfxTileStart * 32);
|
||||
structPtr->monPalIndex = (structPtr->monPalIndex * 16) + 0x100;
|
||||
menu->monPicSpriteId = spriteId;
|
||||
gSprites[menu->monPicSpriteId].callback = MonPicGfxSpriteCallback;
|
||||
menu->monGfxPtr = (void*)VRAM + BG_VRAM_SIZE + (menu->monGfxTileStart * 32);
|
||||
menu->monPalIndex = (menu->monPalIndex * 16) + 0x100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DmaCopy16Defvars(3, GetConditionMonPicGfx(id), structPtr->unk181C, MON_PIC_SIZE);
|
||||
LoadPalette(GetConditionMonPal(id), structPtr->monPalIndex, 0x20);
|
||||
DmaCopy16Defvars(3, GetConditionMonPicGfx(id), menu->monGfxPtr, MON_PIC_SIZE);
|
||||
LoadPalette(GetConditionMonPal(id), menu->monPalIndex, 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,7 +847,7 @@ static void VBlankCB_PokenavConditionGraph(void)
|
||||
ScanlineEffect_InitHBlankDmaTransfer();
|
||||
}
|
||||
|
||||
static void sub_81CEE68(void)
|
||||
static void SetExitVBlank(void)
|
||||
{
|
||||
SetPokenavVBlankCallback();
|
||||
}
|
||||
@ -856,30 +860,33 @@ static void ToggleGraphData(bool8 showBg)
|
||||
HideBg(2);
|
||||
}
|
||||
|
||||
static void DoConditionGraphTransition(void)
|
||||
static void DoConditionGraphEnterTransition(void)
|
||||
{
|
||||
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||
u8 id = GetMonMarkIndex();
|
||||
u8 id = GetConditionGraphMenuCurrentLoadIndex();
|
||||
|
||||
sUnknown_030012BC = id;
|
||||
sInitialLoadId = id;
|
||||
ConditionGraph_SetNewPositions(graph, graph->savedPositions[CONDITION_GRAPH_LOAD_MAX - 1], graph->savedPositions[id]);
|
||||
ConditionGraph_TryUpdate(graph);
|
||||
}
|
||||
|
||||
static void sub_81CEEC8(void)
|
||||
// Transition the graph back to empty before exiting.
|
||||
// This is skipped if the player is in party mode and the cursor
|
||||
// is on Cancel, in which case the graph is already empty.
|
||||
static void DoConditionGraphExitTransition(void)
|
||||
{
|
||||
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||
|
||||
if (IsConditionMenuSearchMode() || GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1)
|
||||
ConditionGraph_SetNewPositions(graph, graph->savedPositions[GetMonMarkIndex()], graph->savedPositions[CONDITION_GRAPH_LOAD_MAX - 1]);
|
||||
if (IsConditionMenuSearchMode() || GetConditionGraphCurrentListIndex() != GetMonListCount() - 1)
|
||||
ConditionGraph_SetNewPositions(graph, graph->savedPositions[GetConditionGraphMenuCurrentLoadIndex()], graph->savedPositions[CONDITION_GRAPH_LOAD_MAX - 1]);
|
||||
}
|
||||
|
||||
u8 GetMonMarkingsData(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||
struct Pokenav_ConditionMenuGfx *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH_MENU_GFX);
|
||||
|
||||
if (IsConditionMenuSearchMode() == 1)
|
||||
return structPtr->marksMenu.markings;
|
||||
return menu->marksMenu.markings;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -21,48 +21,48 @@ enum
|
||||
CONDITION_SEARCH_FUNC_SELECT_MON,
|
||||
};
|
||||
|
||||
struct PokenavSub7
|
||||
struct Pokenav_SearchResults
|
||||
{
|
||||
u32 (*callback)(struct PokenavSub7 *);
|
||||
u32 (*callback)(struct Pokenav_SearchResults *);
|
||||
u32 loopedTaskId;
|
||||
u8 fill1[4];
|
||||
s32 boxId;
|
||||
s32 monId;
|
||||
u32 conditionDataId;
|
||||
u32 returnFromGraph;
|
||||
u32 isPartyCondition;
|
||||
bool32 returnFromGraph;
|
||||
bool32 saveResultsList;
|
||||
struct PokenavSub18 *monList;
|
||||
};
|
||||
|
||||
struct PokenavSub8
|
||||
struct Pokenav_SearchResultsGfx
|
||||
{
|
||||
bool32 (*callback)(void);
|
||||
u32 ltid; //looped task Id
|
||||
u32 loopedTaskId;
|
||||
u16 winid;
|
||||
bool32 fromGraph;
|
||||
u8 buff[BG_SCREEN_SIZE];
|
||||
}; // size: 0x810
|
||||
|
||||
static u32 HandleConditionSearchInput_WaitSetup(struct PokenavSub7 *structPtr);
|
||||
static u32 HandleConditionSearchInput(struct PokenavSub7 *structPtr);
|
||||
static u32 OpenConditionGraphFromSearchList(struct PokenavSub7 *structPtr);
|
||||
static u32 ReturnToConditionSearchList(struct PokenavSub7 *structPtr);
|
||||
static u32 GetConditionSearchLoopedTask(s32 state);
|
||||
static u32 BuildPartyMonSearchResults(s32 state);
|
||||
static u32 InitBoxMonSearchResults(s32 state);
|
||||
static u32 BuildBoxMonSearchResults(s32 state);
|
||||
static u32 sub_81CF278(s32 state);
|
||||
static u32 LoopedTask_MoveSearchListCursorUp(s32 state);
|
||||
static u32 LoopedTask_MoveSearchListCursorDown(s32 state);
|
||||
static u32 LoopedTask_MoveSearchListPageUp(s32 state);
|
||||
static u32 LoopedTask_MoveSearchListPageDown(s32 state);
|
||||
static u32 LoopedTask_ExitConditionSearchMenu(s32 state);
|
||||
static u32 LoopedTask_SelectSearchResult(s32 state);
|
||||
static void sub_81CF2C4(struct PokenavSub7 *structPtr, struct PokenavMonList *item);
|
||||
static u32 HandleConditionSearchInput_WaitSetup(struct Pokenav_SearchResults *);
|
||||
static u32 HandleConditionSearchInput(struct Pokenav_SearchResults *);
|
||||
static u32 OpenConditionGraphFromSearchList(struct Pokenav_SearchResults *);
|
||||
static u32 ReturnToConditionSearchList(struct Pokenav_SearchResults *);
|
||||
static u32 GetConditionSearchLoopedTask(s32);
|
||||
static u32 BuildPartyMonSearchResults(s32);
|
||||
static u32 InitBoxMonSearchResults(s32);
|
||||
static u32 BuildBoxMonSearchResults(s32);
|
||||
static u32 ConvertConditionsToListRanks(s32);
|
||||
static u32 LoopedTask_MoveSearchListCursorUp(s32);
|
||||
static u32 LoopedTask_MoveSearchListCursorDown(s32);
|
||||
static u32 LoopedTask_MoveSearchListPageUp(s32);
|
||||
static u32 LoopedTask_MoveSearchListPageDown(s32);
|
||||
static u32 LoopedTask_ExitConditionSearchMenu(s32);
|
||||
static u32 LoopedTask_SelectSearchResult(s32);
|
||||
static void InsertMonListItem(struct Pokenav_SearchResults *, struct PokenavMonList *);
|
||||
static bool32 GetSearchResultCurrentLoopedTaskActive(void);
|
||||
static u32 LoopedTask_OpenConditionSearchResults(s32 state);
|
||||
static void AddSearchResultListMenuWindow(struct PokenavSub8 *);
|
||||
static void PrintSearchResultListMenuItems(struct PokenavSub8 *);
|
||||
static u32 LoopedTask_OpenConditionSearchResults(s32);
|
||||
static void AddSearchResultListMenuWindow(struct Pokenav_SearchResultsGfx *);
|
||||
static void PrintSearchResultListMenuItems(struct Pokenav_SearchResultsGfx *);
|
||||
static void InitConditionSearchListMenuTemplate(void);
|
||||
static void PrintSearchMonListItem(struct PokenavMonList *, u8 *);
|
||||
|
||||
@ -73,13 +73,13 @@ static const LoopedTask sConditionSearchLoopedTaskFuncs[] =
|
||||
BuildPartyMonSearchResults,
|
||||
InitBoxMonSearchResults,
|
||||
BuildBoxMonSearchResults,
|
||||
sub_81CF278
|
||||
ConvertConditionsToListRanks
|
||||
};
|
||||
|
||||
static const u16 sConditionSearchResultFramePal[] = INCBIN_U16("graphics/pokenav/condition_search2.gbapal");
|
||||
static const u32 sConditionSearchResultTiles[] = INCBIN_U32("graphics/pokenav/condition_search2.4bpp.lz");
|
||||
static const u32 sConditionSearchResultTilemap[] = INCBIN_U32("graphics/pokenav/condition_search2.bin.lz");
|
||||
static const u16 gUnknown_08623570[] = INCBIN_U16("graphics/pokenav/8623570.gbapal");
|
||||
static const u16 sConditionSearchResultFramePal[] = INCBIN_U16("graphics/pokenav/condition/search_results.gbapal");
|
||||
static const u32 sConditionSearchResultTiles[] = INCBIN_U32("graphics/pokenav/condition/search_results.4bpp.lz");
|
||||
static const u32 sConditionSearchResultTilemap[] = INCBIN_U32("graphics/pokenav/condition/search_results.bin.lz");
|
||||
static const u16 sListBg_Pal[] = INCBIN_U16("graphics/pokenav/condition/search_results_list.gbapal");
|
||||
|
||||
static const struct BgTemplate sConditionSearchResultBgTemplates[] =
|
||||
{
|
||||
@ -130,57 +130,57 @@ static const u8 sText_NoGenderSymbol[] = _("{UNK_SPACER}");
|
||||
|
||||
bool32 PokenavCallback_Init_ConditionSearch(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7));
|
||||
if (structPtr == NULL)
|
||||
struct Pokenav_SearchResults *menu = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS, sizeof(struct Pokenav_SearchResults));
|
||||
if (menu == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->monList = AllocSubstruct(POKENAV_SUBSTRUCT_MON_LIST, sizeof(struct PokenavSub18));
|
||||
if (structPtr->monList == NULL)
|
||||
menu->monList = AllocSubstruct(POKENAV_SUBSTRUCT_MON_LIST, sizeof(struct PokenavSub18));
|
||||
if (menu->monList == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->callback = HandleConditionSearchInput_WaitSetup;
|
||||
structPtr->loopedTaskId = CreateLoopedTask(GetConditionSearchLoopedTask, 1);
|
||||
structPtr->returnFromGraph = 0;
|
||||
structPtr->conditionDataId = sSearchMonDataIds[GetSelectedConditionSearch()];
|
||||
menu->callback = HandleConditionSearchInput_WaitSetup;
|
||||
menu->loopedTaskId = CreateLoopedTask(GetConditionSearchLoopedTask, 1);
|
||||
menu->returnFromGraph = FALSE;
|
||||
menu->conditionDataId = sSearchMonDataIds[GetSelectedConditionSearch()];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// return to search results from condition graph
|
||||
bool32 PokenavCallback_Init_ReturnToMonSearchList(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS, sizeof(struct PokenavSub7));
|
||||
if (structPtr == NULL)
|
||||
struct Pokenav_SearchResults *menu = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS, sizeof(struct Pokenav_SearchResults));
|
||||
if (menu == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->monList = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
structPtr->callback = HandleConditionSearchInput;
|
||||
structPtr->returnFromGraph = 1;
|
||||
structPtr->conditionDataId = sSearchMonDataIds[GetSelectedConditionSearch()];
|
||||
menu->monList = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
menu->callback = HandleConditionSearchInput;
|
||||
menu->returnFromGraph = TRUE;
|
||||
menu->conditionDataId = sSearchMonDataIds[GetSelectedConditionSearch()];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 GetConditionSearchResultsCallback(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return structPtr->callback(structPtr);
|
||||
struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return menu->callback(menu);
|
||||
}
|
||||
|
||||
void FreeSearchResultSubstruct1(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
if (structPtr->isPartyCondition == 0)
|
||||
struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
if (!menu->saveResultsList)
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MON_LIST);
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
}
|
||||
|
||||
static bool32 HandleConditionSearchInput_WaitSetup(struct PokenavSub7 *structPtr)
|
||||
static bool32 HandleConditionSearchInput_WaitSetup(struct Pokenav_SearchResults *menu)
|
||||
{
|
||||
if (!IsLoopedTaskActive(structPtr->loopedTaskId))
|
||||
structPtr->callback = HandleConditionSearchInput;
|
||||
if (!IsLoopedTaskActive(menu->loopedTaskId))
|
||||
menu->callback = HandleConditionSearchInput;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u32 HandleConditionSearchInput(struct PokenavSub7 *structPtr)
|
||||
static u32 HandleConditionSearchInput(struct Pokenav_SearchResults *menu)
|
||||
{
|
||||
if (JOY_REPEAT(DPAD_UP))
|
||||
return CONDITION_SEARCH_FUNC_MOVE_UP;
|
||||
@ -192,60 +192,63 @@ static u32 HandleConditionSearchInput(struct PokenavSub7 *structPtr)
|
||||
return CONDITION_SEARCH_FUNC_PAGE_DOWN;
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
structPtr->isPartyCondition = 0;
|
||||
structPtr->callback = ReturnToConditionSearchList;
|
||||
// Exiting back to main search menu
|
||||
menu->saveResultsList = FALSE;
|
||||
menu->callback = ReturnToConditionSearchList;
|
||||
return CONDITION_SEARCH_FUNC_EXIT;
|
||||
}
|
||||
else if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
structPtr->monList->currIndex = GetSelectedPokenavListIndex();
|
||||
structPtr->isPartyCondition = 1;
|
||||
structPtr->callback = OpenConditionGraphFromSearchList;
|
||||
// Entering graph menu
|
||||
menu->monList->currIndex = GetSelectedPokenavListIndex();
|
||||
menu->saveResultsList = TRUE;
|
||||
menu->callback = OpenConditionGraphFromSearchList;
|
||||
return CONDITION_SEARCH_FUNC_SELECT_MON;
|
||||
}
|
||||
else
|
||||
return CONDITION_SEARCH_FUNC_NONE;
|
||||
}
|
||||
|
||||
static u32 ReturnToConditionSearchList(struct PokenavSub7 *structPtr)
|
||||
static u32 ReturnToConditionSearchList(struct Pokenav_SearchResults *menu)
|
||||
{
|
||||
return POKENAV_CONDITION_SEARCH_MENU;
|
||||
}
|
||||
|
||||
static u32 OpenConditionGraphFromSearchList(struct PokenavSub7 *structPtr)
|
||||
static u32 OpenConditionGraphFromSearchList(struct Pokenav_SearchResults *menu)
|
||||
{
|
||||
return POKENAV_CONDITION_GRAPH_FROM_SEARCH;
|
||||
return POKENAV_CONDITION_GRAPH_SEARCH;
|
||||
}
|
||||
|
||||
static u32 sub_81CF0C0(void)
|
||||
static u32 GetReturningFromGraph(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return structPtr->returnFromGraph;
|
||||
struct Pokenav_SearchResults *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return menu->returnFromGraph;
|
||||
}
|
||||
|
||||
static struct PokenavMonList * GetSearchResultsMonDataList(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return ptr->monList->monData;
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return menu->monList->monData;
|
||||
}
|
||||
|
||||
static u16 GetSearchResultsMonListCount(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return ptr->monList->listCount;
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return menu->monList->listCount;
|
||||
}
|
||||
|
||||
static s32 GetSearchResultsSelectedMonData(void)
|
||||
// data below has been set by ConvertConditionsToListRanks
|
||||
static s32 GetSearchResultsSelectedMonRank(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
s32 i = GetSelectedPokenavListIndex();
|
||||
return ptr->monList->monData[i].data;
|
||||
return menu->monList->monData[i].data;
|
||||
}
|
||||
|
||||
static u16 sub_81CF10C(void)
|
||||
static u16 GetSearchResultsCurrentListIndex(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return ptr->monList->currIndex;
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
return menu->monList->currIndex;
|
||||
}
|
||||
|
||||
static u32 GetConditionSearchLoopedTask(s32 state)
|
||||
@ -257,11 +260,11 @@ static u32 BuildPartyMonSearchResults(s32 state)
|
||||
{
|
||||
s32 i;
|
||||
struct PokenavMonList item;
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
|
||||
ptr->monList->listCount = 0;
|
||||
ptr->monList->currIndex = 0;
|
||||
item.boxId = 14;
|
||||
menu->monList->listCount = 0;
|
||||
menu->monList->currIndex = 0;
|
||||
item.boxId = TOTAL_BOXES_COUNT;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
struct Pokemon * pokemon = &gPlayerParty[i];
|
||||
@ -270,8 +273,8 @@ static u32 BuildPartyMonSearchResults(s32 state)
|
||||
if (!GetMonData(pokemon, MON_DATA_SANITY_IS_EGG))
|
||||
{
|
||||
item.monId = i;
|
||||
item.data = GetMonData(pokemon, ptr->conditionDataId);
|
||||
sub_81CF2C4(ptr, &item);
|
||||
item.data = GetMonData(pokemon, menu->conditionDataId);
|
||||
InsertMonListItem(menu, &item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,17 +283,17 @@ static u32 BuildPartyMonSearchResults(s32 state)
|
||||
|
||||
static u32 InitBoxMonSearchResults(s32 state)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
ptr->monId = 0;
|
||||
ptr->boxId = 0;
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
menu->monId = 0;
|
||||
menu->boxId = 0;
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
|
||||
static u32 BuildBoxMonSearchResults(s32 state)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
s32 boxId = ptr->boxId;
|
||||
s32 monId = ptr->monId;
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
s32 boxId = menu->boxId;
|
||||
s32 monId = menu->monId;
|
||||
s32 boxCount = 0;
|
||||
struct PokenavMonList item;
|
||||
|
||||
@ -302,15 +305,15 @@ static u32 BuildBoxMonSearchResults(s32 state)
|
||||
{
|
||||
item.boxId = boxId;
|
||||
item.monId = monId;
|
||||
item.data = GetBoxMonDataAt(boxId, monId, ptr->conditionDataId);
|
||||
sub_81CF2C4(ptr, &item);
|
||||
item.data = GetBoxMonDataAt(boxId, monId, menu->conditionDataId);
|
||||
InsertMonListItem(menu, &item);
|
||||
}
|
||||
boxCount++;
|
||||
monId++;
|
||||
if (boxCount > 14)
|
||||
if (boxCount > TOTAL_BOXES_COUNT)
|
||||
{
|
||||
ptr->boxId = boxId;
|
||||
ptr->monId = monId;
|
||||
menu->boxId = boxId;
|
||||
menu->monId = monId;
|
||||
return LT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@ -321,107 +324,111 @@ static u32 BuildBoxMonSearchResults(s32 state)
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
|
||||
static u32 sub_81CF278(s32 state)
|
||||
// Data below is initially set by BuildPartyMonSearchResults / BuildBoxMonSearchResults, and
|
||||
// is the Pokémon's condition value for the condition they are sorted by.
|
||||
// The condition value in data is then overwritten with their ranking.
|
||||
static u32 ConvertConditionsToListRanks(s32 state)
|
||||
{
|
||||
struct PokenavSub7 * ptr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
s32 r6 = ptr->monList->listCount;
|
||||
s32 r4 = ptr->monList->monData[0].data;
|
||||
struct Pokenav_SearchResults * menu = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS);
|
||||
s32 listCount = menu->monList->listCount;
|
||||
s32 prevCondition = menu->monList->monData[0].data;
|
||||
s32 i;
|
||||
ptr->monList->monData[0].data = 1;
|
||||
for (i = 1; i < r6; i++)
|
||||
menu->monList->monData[0].data = 1;
|
||||
for (i = 1; i < listCount; i++)
|
||||
{
|
||||
if (ptr->monList->monData[i].data == r4)
|
||||
if (menu->monList->monData[i].data == prevCondition)
|
||||
{
|
||||
ptr->monList->monData[i].data = ptr->monList->monData[i - 1].data;
|
||||
// Same condition value as prev, share rank
|
||||
menu->monList->monData[i].data = menu->monList->monData[i - 1].data;
|
||||
}
|
||||
else
|
||||
{
|
||||
r4 = ptr->monList->monData[i].data;
|
||||
ptr->monList->monData[i].data = i + 1;
|
||||
prevCondition = menu->monList->monData[i].data;
|
||||
menu->monList->monData[i].data = i + 1;
|
||||
}
|
||||
}
|
||||
ptr->returnFromGraph = 1;
|
||||
menu->returnFromGraph = TRUE;
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static void sub_81CF2C4(struct PokenavSub7 *structPtr, struct PokenavMonList *item)
|
||||
static void InsertMonListItem(struct Pokenav_SearchResults *menu, struct PokenavMonList *item)
|
||||
{
|
||||
u32 left = 0;
|
||||
u32 right = structPtr->monList->listCount;
|
||||
u32 right = menu->monList->listCount;
|
||||
u32 insertionIdx = left + (right - left) / 2;
|
||||
|
||||
while (right != insertionIdx)
|
||||
{
|
||||
if (item->data > structPtr->monList->monData[insertionIdx].data)
|
||||
if (item->data > menu->monList->monData[insertionIdx].data)
|
||||
right = insertionIdx;
|
||||
else
|
||||
left = insertionIdx + 1;
|
||||
insertionIdx = left + (right - left) / 2;
|
||||
}
|
||||
for (right = structPtr->monList->listCount; right > insertionIdx; right--)
|
||||
structPtr->monList->monData[right] = structPtr->monList->monData[right - 1];
|
||||
structPtr->monList->monData[insertionIdx] = *item;
|
||||
structPtr->monList->listCount++;
|
||||
for (right = menu->monList->listCount; right > insertionIdx; right--)
|
||||
menu->monList->monData[right] = menu->monList->monData[right - 1];
|
||||
menu->monList->monData[insertionIdx] = *item;
|
||||
menu->monList->listCount++;
|
||||
}
|
||||
|
||||
bool32 OpenConditionSearchResults(void)
|
||||
{
|
||||
struct PokenavSub8 *searchList = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST, sizeof(struct PokenavSub8));
|
||||
if (searchList == NULL)
|
||||
struct Pokenav_SearchResultsGfx *gfx = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX, sizeof(struct Pokenav_SearchResultsGfx));
|
||||
if (gfx == NULL)
|
||||
return FALSE;
|
||||
searchList->ltid = CreateLoopedTask(LoopedTask_OpenConditionSearchResults, 1);
|
||||
searchList->callback = GetSearchResultCurrentLoopedTaskActive;
|
||||
searchList->fromGraph = FALSE;
|
||||
gfx->loopedTaskId = CreateLoopedTask(LoopedTask_OpenConditionSearchResults, 1);
|
||||
gfx->callback = GetSearchResultCurrentLoopedTaskActive;
|
||||
gfx->fromGraph = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 OpenConditionSearchListFromGraph(void)
|
||||
{
|
||||
struct PokenavSub8 *searchList = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST, sizeof(struct PokenavSub8));
|
||||
if (searchList == NULL)
|
||||
struct Pokenav_SearchResultsGfx *gfx = AllocSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX, sizeof(struct Pokenav_SearchResultsGfx));
|
||||
if (gfx == NULL)
|
||||
return FALSE;
|
||||
searchList->ltid = CreateLoopedTask(LoopedTask_OpenConditionSearchResults, 1);
|
||||
searchList->callback = GetSearchResultCurrentLoopedTaskActive;
|
||||
searchList->fromGraph = TRUE;
|
||||
gfx->loopedTaskId = CreateLoopedTask(LoopedTask_OpenConditionSearchResults, 1);
|
||||
gfx->callback = GetSearchResultCurrentLoopedTaskActive;
|
||||
gfx->fromGraph = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CreateSearchResultsLoopedTask(s32 idx)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
searchList->ltid = CreateLoopedTask(sSearchResultLoopTaskFuncs[idx], 1);
|
||||
searchList->callback = GetSearchResultCurrentLoopedTaskActive;
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
gfx->loopedTaskId = CreateLoopedTask(sSearchResultLoopTaskFuncs[idx], 1);
|
||||
gfx->callback = GetSearchResultCurrentLoopedTaskActive;
|
||||
}
|
||||
|
||||
bool32 IsSearchResultLoopedTaskActive(void)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
return searchList->callback();
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
return gfx->callback();
|
||||
}
|
||||
|
||||
bool32 GetSearchResultCurrentLoopedTaskActive(void)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
return IsLoopedTaskActive(searchList->ltid);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
return IsLoopedTaskActive(gfx->loopedTaskId);
|
||||
}
|
||||
|
||||
void FreeSearchResultSubstruct2(void)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
sub_81C8234();
|
||||
RemoveWindow(searchList->winid);
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
RemoveWindow(gfx->winid);
|
||||
FreePokenavSubstruct(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
}
|
||||
|
||||
static u32 LoopedTask_OpenConditionSearchResults(s32 state)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
InitBgTemplates(sConditionSearchResultBgTemplates, ARRAY_COUNT(sConditionSearchResultBgTemplates));
|
||||
DecompressAndCopyTileDataToVram(1, sConditionSearchResultTiles, 0, 0, 0);
|
||||
SetBgTilemapBuffer(1, searchList->buff);
|
||||
SetBgTilemapBuffer(1, gfx->buff);
|
||||
CopyToBgTilemapBuffer(1, sConditionSearchResultTilemap, 0, 0);
|
||||
CopyBgTilemapBufferToVram(1);
|
||||
CopyPaletteIntoBufferUnfaded(sConditionSearchResultFramePal, 0x10, 0x20);
|
||||
@ -430,19 +437,19 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
|
||||
case 1:
|
||||
if (FreeTempTileDataBuffersIfPossible())
|
||||
return LT_PAUSE;
|
||||
if (!sub_81CF0C0())
|
||||
if (!GetReturningFromGraph())
|
||||
return LT_PAUSE;
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 2:
|
||||
if (FreeTempTileDataBuffersIfPossible())
|
||||
return LT_PAUSE;
|
||||
CopyPaletteIntoBufferUnfaded(gUnknown_08623570, 0x20, 32);
|
||||
CopyPaletteIntoBufferUnfaded(sListBg_Pal, 0x20, 32);
|
||||
InitConditionSearchListMenuTemplate();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (sub_81C8224())
|
||||
return LT_PAUSE;
|
||||
AddSearchResultListMenuWindow(searchList);
|
||||
AddSearchResultListMenuWindow(gfx);
|
||||
PrintHelpBarText(HELPBAR_CONDITION_MON_LIST);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 4:
|
||||
@ -453,7 +460,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
|
||||
ShowBg(1);
|
||||
ShowBg(2);
|
||||
HideBg(3);
|
||||
if (!searchList->fromGraph)
|
||||
if (!gfx->fromGraph)
|
||||
{
|
||||
u8 searchGfxId = GetSelectedConditionSearch() + POKENAV_MENUITEM_CONDITION_SEARCH_COOL;
|
||||
LoadLeftHeaderGfxForIndex(searchGfxId);
|
||||
@ -474,7 +481,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
|
||||
|
||||
static u32 LoopedTask_MoveSearchListCursorUp(s32 state)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
@ -495,7 +502,7 @@ static u32 LoopedTask_MoveSearchListCursorUp(s32 state)
|
||||
return LT_PAUSE;
|
||||
// fallthrough
|
||||
case 2:
|
||||
PrintSearchResultListMenuItems(searchList);
|
||||
PrintSearchResultListMenuItems(gfx);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
@ -507,7 +514,7 @@ static u32 LoopedTask_MoveSearchListCursorUp(s32 state)
|
||||
|
||||
static u32 LoopedTask_MoveSearchListCursorDown(s32 state)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
@ -528,7 +535,7 @@ static u32 LoopedTask_MoveSearchListCursorDown(s32 state)
|
||||
return LT_PAUSE;
|
||||
// fallthrough
|
||||
case 2:
|
||||
PrintSearchResultListMenuItems(searchList);
|
||||
PrintSearchResultListMenuItems(gfx);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
@ -540,7 +547,7 @@ static u32 LoopedTask_MoveSearchListCursorDown(s32 state)
|
||||
|
||||
static u32 LoopedTask_MoveSearchListPageUp(s32 state)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
@ -561,7 +568,7 @@ static u32 LoopedTask_MoveSearchListPageUp(s32 state)
|
||||
return LT_PAUSE;
|
||||
// fallthrough
|
||||
case 2:
|
||||
PrintSearchResultListMenuItems(searchList);
|
||||
PrintSearchResultListMenuItems(gfx);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
@ -573,7 +580,7 @@ static u32 LoopedTask_MoveSearchListPageUp(s32 state)
|
||||
|
||||
static u32 LoopedTask_MoveSearchListPageDown(s32 state)
|
||||
{
|
||||
struct PokenavSub8 *searchList = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST);
|
||||
struct Pokenav_SearchResultsGfx *gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS_GFX);
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
@ -594,7 +601,7 @@ static u32 LoopedTask_MoveSearchListPageDown(s32 state)
|
||||
return LT_PAUSE;
|
||||
// fallthrough
|
||||
case 2:
|
||||
PrintSearchResultListMenuItems(searchList);
|
||||
PrintSearchResultListMenuItems(gfx);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
@ -640,25 +647,25 @@ static u32 LoopedTask_SelectSearchResult(s32 state)
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
static void AddSearchResultListMenuWindow(struct PokenavSub8 *searchList)
|
||||
static void AddSearchResultListMenuWindow(struct Pokenav_SearchResultsGfx *gfx)
|
||||
{
|
||||
searchList->winid = AddWindow(&sSearchResultListMenuWindowTemplate);
|
||||
PutWindowTilemap(searchList->winid);
|
||||
CopyWindowToVram(searchList->winid, COPYWIN_MAP);
|
||||
PrintSearchResultListMenuItems(searchList);
|
||||
gfx->winid = AddWindow(&sSearchResultListMenuWindowTemplate);
|
||||
PutWindowTilemap(gfx->winid);
|
||||
CopyWindowToVram(gfx->winid, COPYWIN_MAP);
|
||||
PrintSearchResultListMenuItems(gfx);
|
||||
}
|
||||
|
||||
static void PrintSearchResultListMenuItems(struct PokenavSub8 *searchList)
|
||||
static void PrintSearchResultListMenuItems(struct Pokenav_SearchResultsGfx *gfx)
|
||||
{
|
||||
s32 r7 = GetSearchResultsSelectedMonData();
|
||||
s32 rank = GetSearchResultsSelectedMonRank();
|
||||
DynamicPlaceholderTextUtil_Reset();
|
||||
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
|
||||
*gStringVar1 = EOS;
|
||||
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar2, gText_NumberF700);
|
||||
AddTextPrinterParameterized(searchList->winid, FONT_NORMAL, gStringVar2, 4, 1, TEXT_SKIP_DRAW, NULL);
|
||||
ConvertIntToDecimalStringN(gStringVar1, r7, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
AddTextPrinterParameterized(searchList->winid, FONT_NORMAL, gStringVar1, 34, 1, TEXT_SKIP_DRAW, NULL);
|
||||
CopyWindowToVram(searchList->winid, COPYWIN_GFX);
|
||||
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar2, gText_NumberIndex);
|
||||
AddTextPrinterParameterized(gfx->winid, FONT_NORMAL, gStringVar2, 4, 1, TEXT_SKIP_DRAW, NULL);
|
||||
ConvertIntToDecimalStringN(gStringVar1, rank, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
AddTextPrinterParameterized(gfx->winid, FONT_NORMAL, gStringVar1, 34, 1, TEXT_SKIP_DRAW, NULL);
|
||||
CopyWindowToVram(gfx->winid, COPYWIN_GFX);
|
||||
}
|
||||
|
||||
static void InitConditionSearchListMenuTemplate(void)
|
||||
@ -668,7 +675,7 @@ static void InitConditionSearchListMenuTemplate(void)
|
||||
template.list.monList = GetSearchResultsMonDataList();
|
||||
template.count = GetSearchResultsMonListCount();
|
||||
template.unk8 = 4;
|
||||
template.unk6 = sub_81CF10C();
|
||||
template.unk6 = GetSearchResultsCurrentListIndex();
|
||||
template.item_X = 13;
|
||||
template.windowWidth = 17;
|
||||
template.listTop = 1;
|
||||
|
@ -355,7 +355,7 @@ static u32 HandleConditionMenuInput(struct Pokenav1Struct *state)
|
||||
return POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH;
|
||||
case POKENAV_MENUITEM_CONDITION_PARTY:
|
||||
state->helpBarIndex = 0;
|
||||
SetMenuIdAndCB(state, POKENAV_CONDITION_PARTY);
|
||||
SetMenuIdAndCB(state, POKENAV_CONDITION_GRAPH_PARTY);
|
||||
return POKENAV_MENU_FUNC_OPEN_FEATURE;
|
||||
case POKENAV_MENUITEM_CONDITION_CANCEL:
|
||||
PlaySE(SE_SELECT);
|
||||
|
@ -359,7 +359,7 @@ bool32 OpenPokenavMenuNotInitial(void)
|
||||
|
||||
static struct Pokenav2Struct * OpenPokenavMenu(void)
|
||||
{
|
||||
struct Pokenav2Struct * state = AllocSubstruct(2, sizeof(struct Pokenav2Struct));
|
||||
struct Pokenav2Struct * state = AllocSubstruct(POKENAV_SUBSTRUCT_MENU_ICONS, sizeof(struct Pokenav2Struct));
|
||||
|
||||
if (state != NULL)
|
||||
{
|
||||
|
@ -990,7 +990,7 @@ const u8 gText_Unknown[] = _("UNKNOWN");
|
||||
const u8 gText_Call[] = _("CALL");
|
||||
const u8 gText_Check[] = _("CHECK");
|
||||
const u8 gText_Cancel6[] = _("CANCEL");
|
||||
const u8 gText_NumberF700[] = _("No. {DYNAMIC 0}");
|
||||
const u8 gText_NumberIndex[] = _("No. {DYNAMIC 0}");
|
||||
const u8 gText_RibbonsF700[] = _("RIBBONS {DYNAMIC 0}");
|
||||
const u8 gText_PokemonMaleLv2[] = _("{DYNAMIC 0}{COLOR_HIGHLIGHT_SHADOW LIGHT_RED WHITE GREEN}♂{COLOR_HIGHLIGHT_SHADOW DARK_GRAY WHITE LIGHT_GRAY}/{LV}{DYNAMIC 1}{DYNAMIC 2}"); // Unused
|
||||
const u8 gText_PokemonFemaleLv2[] = _("{DYNAMIC 0}{COLOR_HIGHLIGHT_SHADOW LIGHT_GREEN WHITE BLUE}♀{COLOR_HIGHLIGHT_SHADOW DARK_GRAY WHITE LIGHT_GRAY}/{LV}{DYNAMIC 1}{DYNAMIC 2}"); // Unused
|
||||
|
@ -1577,9 +1577,9 @@ static void SpriteCB_MonPic(struct Sprite *sprite)
|
||||
static void SpriteCB_SelectionIconPokeball(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[0] == sMenu->info.curSelection)
|
||||
StartSpriteAnim(sprite, 0);
|
||||
StartSpriteAnim(sprite, CONDITION_ICON_SELECTED);
|
||||
else
|
||||
StartSpriteAnim(sprite, 1);
|
||||
StartSpriteAnim(sprite, CONDITION_ICON_UNSELECTED);
|
||||
}
|
||||
|
||||
static void SpriteCB_SelectionIconCancel(struct Sprite *sprite)
|
||||
|
Loading…
Reference in New Issue
Block a user