mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 03:04:15 +01:00
Add list menu cursor constants
This commit is contained in:
parent
b3e75138da
commit
1d1c2d41bb
@ -7,12 +7,20 @@
|
||||
#define LIST_CANCEL -2
|
||||
#define LIST_HEADER -3
|
||||
|
||||
#define LIST_NO_MULTIPLE_SCROLL 0
|
||||
#define LIST_MULTIPLE_SCROLL_DPAD 1
|
||||
#define LIST_MULTIPLE_SCROLL_L_R 2
|
||||
enum {
|
||||
LIST_NO_MULTIPLE_SCROLL,
|
||||
LIST_MULTIPLE_SCROLL_DPAD,
|
||||
LIST_MULTIPLE_SCROLL_L_R,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
CURSOR_BLACK_ARROW,
|
||||
CURSOR_INVISIBLE,
|
||||
CURSOR_RED_OUTLINE,
|
||||
CURSOR_RED_ARROW,
|
||||
};
|
||||
|
||||
enum {
|
||||
SCROLL_ARROW_LEFT,
|
||||
SCROLL_ARROW_RIGHT,
|
||||
SCROLL_ARROW_UP,
|
||||
|
@ -160,7 +160,7 @@ static const struct ListMenuTemplate sListMenuTemplate =
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NARROW,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -719,7 +719,7 @@ static const struct ListMenuTemplate sListMenuTemplate_PossibleGroupMembers = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 1
|
||||
.cursorKind = CURSOR_INVISIBLE
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sWindowTemplate_GroupList = {
|
||||
@ -779,7 +779,7 @@ static const struct ListMenuTemplate sListMenuTemplate_UnionRoomGroups = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sWindowTemplate_InviteToActivity = {
|
||||
@ -817,7 +817,7 @@ static const struct ListMenuTemplate sListMenuTemplate_InviteToActivity = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sWindowTemplate_RegisterForTrade = {
|
||||
@ -854,7 +854,7 @@ static const struct ListMenuTemplate sListMenuTemplate_RegisterForTrade = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sWindowTemplate_TradingBoardRequestType = {
|
||||
@ -906,7 +906,7 @@ static const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sWindowTemplate_TradingBoardHeader = {
|
||||
@ -960,7 +960,7 @@ static const struct ListMenuTemplate sTradeBoardListMenuTemplate = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
// Unused
|
||||
@ -1012,7 +1012,7 @@ static const struct ListMenuTemplate sEmptyListMenuTemplate = {
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct RfuPlayerData sUnionRoomPlayer_DummyRfu = {0};
|
||||
|
@ -78,7 +78,7 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate =
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const u8 *const sCompatibilityMessages[] =
|
||||
|
@ -2536,9 +2536,9 @@ static void InitScrollableMultichoice(void)
|
||||
gScrollableMultichoice_ListMenuTemplate.cursorShadowPal = 3;
|
||||
gScrollableMultichoice_ListMenuTemplate.lettersSpacing = 0;
|
||||
gScrollableMultichoice_ListMenuTemplate.itemVerticalPadding = 0;
|
||||
gScrollableMultichoice_ListMenuTemplate.scrollMultiple = 0;
|
||||
gScrollableMultichoice_ListMenuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
|
||||
gScrollableMultichoice_ListMenuTemplate.fontId = FONT_NORMAL;
|
||||
gScrollableMultichoice_ListMenuTemplate.cursorKind = 0;
|
||||
gScrollableMultichoice_ListMenuTemplate.cursorKind = CURSOR_BLACK_ARROW;
|
||||
}
|
||||
|
||||
static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
||||
|
@ -259,9 +259,9 @@ static const struct ListMenuTemplate sItemListMenu =
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NARROW,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct MenuAction sItemMenuActions[] = {
|
||||
|
@ -13,6 +13,10 @@
|
||||
#include "sound.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
// Cursors after this point are created using a sprite with their own task.
|
||||
// This allows them to have idle animations. Cursors prior to this are simply printed text.
|
||||
#define CURSOR_OBJECT_START CURSOR_RED_OUTLINE
|
||||
|
||||
struct UnkIndicatorsStruct
|
||||
{
|
||||
u8 field_0;
|
||||
@ -70,7 +74,7 @@ static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAn
|
||||
static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count);
|
||||
static void ListMenuDrawCursor(struct ListMenu *list);
|
||||
static void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 onInit);
|
||||
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind);
|
||||
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorObjId);
|
||||
static void Task_ScrollIndicatorArrowPair(u8 taskId);
|
||||
static u8 ListMenuAddRedOutlineCursorObject(struct CursorStruct *cursor);
|
||||
static u8 ListMenuAddRedArrowCursorObject(struct CursorStruct *cursor);
|
||||
@ -78,9 +82,9 @@ static void ListMenuUpdateRedOutlineCursorObject(u8 taskId, u16 x, u16 y);
|
||||
static void ListMenuUpdateRedArrowCursorObject(u8 taskId, u16 x, u16 y);
|
||||
static void ListMenuRemoveRedOutlineCursorObject(u8 taskId);
|
||||
static void ListMenuRemoveRedArrowCursorObject(u8 taskId);
|
||||
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorKind);
|
||||
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorKind);
|
||||
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind);
|
||||
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorObjId);
|
||||
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorObjId);
|
||||
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorObjId);
|
||||
static void SpriteCallback_ScrollIndicatorArrow(struct Sprite *sprite);
|
||||
static void SpriteCallback_RedArrowCursor(struct Sprite *sprite);
|
||||
|
||||
@ -477,7 +481,7 @@ void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
|
||||
*selectedRow = list->selectedRow;
|
||||
|
||||
if (list->taskId != TASK_NONE)
|
||||
ListMenuRemoveCursorObject(list->taskId, list->template.cursorKind - 2);
|
||||
ListMenuRemoveCursorObject(list->taskId, list->template.cursorKind - CURSOR_OBJECT_START);
|
||||
|
||||
DestroyTask(listTaskId);
|
||||
}
|
||||
@ -650,31 +654,33 @@ static void ListMenuDrawCursor(struct ListMenu *list)
|
||||
u8 y = list->selectedRow * yMultiplier + list->template.upText_Y;
|
||||
switch (list->template.cursorKind)
|
||||
{
|
||||
case 0:
|
||||
case CURSOR_BLACK_ARROW:
|
||||
ListMenuPrint(list, gText_SelectorArrow2, x, y);
|
||||
break;
|
||||
case 1:
|
||||
case CURSOR_INVISIBLE:
|
||||
break;
|
||||
case 2:
|
||||
case CURSOR_RED_OUTLINE:
|
||||
if (list->taskId == TASK_NONE)
|
||||
list->taskId = ListMenuAddCursorObject(list, 0);
|
||||
list->taskId = ListMenuAddCursorObject(list, CURSOR_RED_OUTLINE - CURSOR_OBJECT_START);
|
||||
ListMenuUpdateCursorObject(list->taskId,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 - 1,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1, 0);
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1,
|
||||
CURSOR_RED_OUTLINE - CURSOR_OBJECT_START);
|
||||
break;
|
||||
case 3:
|
||||
case CURSOR_RED_ARROW:
|
||||
if (list->taskId == TASK_NONE)
|
||||
list->taskId = ListMenuAddCursorObject(list, 1);
|
||||
list->taskId = ListMenuAddCursorObject(list, CURSOR_RED_ARROW - CURSOR_OBJECT_START);
|
||||
ListMenuUpdateCursorObject(list->taskId,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 + x,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y, 1);
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y,
|
||||
CURSOR_RED_ARROW - CURSOR_OBJECT_START);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#undef TASK_NONE
|
||||
|
||||
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
|
||||
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorObjId)
|
||||
{
|
||||
struct CursorStruct cursor;
|
||||
|
||||
@ -686,13 +692,13 @@ static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
|
||||
cursor.palTag = TAG_NONE;
|
||||
cursor.palNum = 15;
|
||||
|
||||
return ListMenuAddCursorObjectInternal(&cursor, cursorKind);
|
||||
return ListMenuAddCursorObjectInternal(&cursor, cursorObjId);
|
||||
}
|
||||
|
||||
static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow)
|
||||
{
|
||||
u8 cursorKind = list->template.cursorKind;
|
||||
if (cursorKind == 0)
|
||||
if (cursorKind == CURSOR_BLACK_ARROW)
|
||||
{
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, FONTATTR_MAX_LETTER_HEIGHT) + list->template.itemVerticalPadding;
|
||||
u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0);
|
||||
@ -1190,39 +1196,39 @@ void RemoveScrollIndicatorArrowPair(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorKind)
|
||||
static u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorObjId)
|
||||
{
|
||||
switch (cursorKind)
|
||||
switch (cursorObjId)
|
||||
{
|
||||
case 0:
|
||||
case CURSOR_RED_OUTLINE - CURSOR_OBJECT_START:
|
||||
default:
|
||||
return ListMenuAddRedOutlineCursorObject(cursor);
|
||||
case 1:
|
||||
case CURSOR_RED_ARROW - CURSOR_OBJECT_START:
|
||||
return ListMenuAddRedArrowCursorObject(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorKind)
|
||||
static void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorObjId)
|
||||
{
|
||||
switch (cursorKind)
|
||||
switch (cursorObjId)
|
||||
{
|
||||
case 0:
|
||||
case CURSOR_RED_OUTLINE - CURSOR_OBJECT_START:
|
||||
ListMenuUpdateRedOutlineCursorObject(taskId, x, y);
|
||||
break;
|
||||
case 1:
|
||||
case CURSOR_RED_ARROW - CURSOR_OBJECT_START:
|
||||
ListMenuUpdateRedArrowCursorObject(taskId, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind)
|
||||
static void ListMenuRemoveCursorObject(u8 taskId, u32 cursorObjId)
|
||||
{
|
||||
switch (cursorKind)
|
||||
switch (cursorObjId)
|
||||
{
|
||||
case 0:
|
||||
case CURSOR_RED_OUTLINE - CURSOR_OBJECT_START:
|
||||
ListMenuRemoveRedOutlineCursorObject(taskId);
|
||||
break;
|
||||
case 1:
|
||||
case CURSOR_RED_ARROW - CURSOR_OBJECT_START:
|
||||
ListMenuRemoveRedArrowCursorObject(taskId);
|
||||
break;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
//--------------
|
||||
@ -284,7 +284,7 @@ u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page)
|
||||
gMultiuseListMenuTemplate.moveCursorFunc = MailboxMenu_MoveCursorFunc;
|
||||
gMultiuseListMenuTemplate.itemPrintFunc = MailboxMenu_ItemPrintFunc;
|
||||
gMultiuseListMenuTemplate.fontId = FONT_NORMAL;
|
||||
gMultiuseListMenuTemplate.cursorKind = 0;
|
||||
gMultiuseListMenuTemplate.cursorKind = CURSOR_BLACK_ARROW;
|
||||
gMultiuseListMenuTemplate.lettersSpacing = 0;
|
||||
gMultiuseListMenuTemplate.itemVerticalPadding = 0;
|
||||
gMultiuseListMenuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
|
||||
|
@ -234,9 +234,9 @@ static const struct ListMenuTemplate sListMenuTemplate_ThreeOptions = {
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct ListMenuItem sListMenuItems_ReceiveSendToss[] = {
|
||||
@ -279,9 +279,9 @@ static const struct ListMenuTemplate sListMenu_ReceiveSendToss = {
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct ListMenuTemplate sListMenu_ReceiveToss = {
|
||||
@ -300,9 +300,9 @@ static const struct ListMenuTemplate sListMenu_ReceiveToss = {
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct ListMenuTemplate sListMenu_ReceiveSend = {
|
||||
@ -321,9 +321,9 @@ static const struct ListMenuTemplate sListMenu_ReceiveSend = {
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct ListMenuTemplate sListMenu_Receive = {
|
||||
@ -342,9 +342,9 @@ static const struct ListMenuTemplate sListMenu_Receive = {
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 0,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const u8 *const sUnusedMenuTexts[] = {
|
||||
|
@ -440,7 +440,7 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate =
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 1
|
||||
.cursorKind = CURSOR_INVISIBLE
|
||||
};
|
||||
|
||||
void OpenPokeblockCase(u8 caseId, void (*callback)(void))
|
||||
|
@ -214,7 +214,7 @@ static const struct ListMenuTemplate sRegistryListMenuTemplate =
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NORMAL,
|
||||
.cursorKind = 0,
|
||||
.cursorKind = CURSOR_BLACK_ARROW,
|
||||
};
|
||||
|
||||
static void ClearSecretBase(struct SecretBase *secretBase)
|
||||
|
@ -216,7 +216,7 @@ static const struct ListMenuTemplate sShopBuyMenuListTemplate =
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = FONT_NARROW,
|
||||
.cursorKind = 0
|
||||
.cursorKind = CURSOR_BLACK_ARROW
|
||||
};
|
||||
|
||||
static const struct BgTemplate sShopBuyMenuBgTemplates[] =
|
||||
|
Loading…
Reference in New Issue
Block a user