-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #280 from lhearachel/list-menu
Document menu.c, list_menu.c
- Loading branch information
Showing
131 changed files
with
3,694 additions
and
3,814 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#ifndef POKEPLATINUM_LIST_MENU_H | ||
#define POKEPLATINUM_LIST_MENU_H | ||
|
||
#include "bg_window.h" | ||
#include "colored_arrow.h" | ||
#include "string_list.h" | ||
|
||
#define LIST_NOTHING_CHOSEN -1 | ||
#define LIST_CANCEL -2 | ||
#define LIST_HEADER -3 | ||
|
||
enum ListMenuPagerMode { | ||
PAGER_MODE_NONE = 0, | ||
PAGER_MODE_LEFT_RIGHT_PAD, | ||
PAGER_MODE_SHOULDER_BUTTONS, | ||
}; | ||
|
||
enum ListMenuAction { | ||
LIST_MENU_ACTION_NONE = 0, | ||
LIST_MENU_ACTION_MOVE_UP, | ||
LIST_MENU_ACTION_MOVE_DOWN, | ||
LIST_MENU_ACTION_PAGE_UP, | ||
LIST_MENU_ACTION_PAGE_DOWN, | ||
}; | ||
|
||
enum ListMenuAttribute { | ||
LIST_MENU_CURSOR_CALLBACK = 0, | ||
LIST_MENU_PRINT_CALLBACK, | ||
LIST_MENU_COUNT, | ||
LIST_MENU_MAX_DISPLAY, | ||
LIST_MENU_UNUSED_4, | ||
LIST_MENU_HEADER_X_OFFSET, | ||
LIST_MENU_TEXT_X_OFFSET, | ||
LIST_MENU_CURSOR_X_OFFSET, | ||
LIST_MENU_Y_OFFSET, | ||
LIST_MENU_LINE_HEIGHT, | ||
LIST_MENU_TEXT_COLOR_FG, | ||
LIST_MENU_TEXT_COLOR_BG, | ||
LIST_MENU_TEXT_COLOR_SHADOW, | ||
LIST_MENU_LETTER_SPACING, | ||
LIST_MENU_LINE_SPACING, | ||
LIST_MENU_PAGER_MODE, | ||
LIST_MENU_FONT_ID, | ||
LIST_MENU_CURSOR_TYPE, | ||
LIST_MENU_WINDOW, | ||
LIST_MENU_TMP, | ||
}; | ||
|
||
typedef struct ListMenu ListMenu; | ||
|
||
typedef void (*CursorCallback)(ListMenu *menu, u32 index, u8 onInit); | ||
typedef void (*PrintCallback)(ListMenu *menu, u32 index, u8 yOffset); | ||
|
||
typedef struct ListMenuTemplate { | ||
const StringList *choices; | ||
CursorCallback cursorCallback; | ||
PrintCallback printCallback; | ||
Window *window; | ||
u16 count; | ||
u16 maxDisplay; | ||
u8 headerXOffset; | ||
u8 textXOffset; | ||
u8 cursorXOffset; | ||
u8 yOffset : 4; | ||
u8 textColorFg : 4; | ||
u8 textColorBg : 4; | ||
u8 textColorShadow : 4; | ||
u16 letterSpacing : 3; | ||
u16 lineSpacing : 4; | ||
u16 pagerMode : 2; | ||
u16 fontID : 6; | ||
u16 cursorType : 1; | ||
void *tmp; | ||
} ListMenuTemplate; | ||
|
||
struct ListMenu { | ||
ListMenuTemplate template; | ||
struct { | ||
u8 textColorFg : 4; | ||
u8 textColorBg : 4; | ||
u8 textColorShadow : 4; | ||
u8 letterSpacing : 6; | ||
u8 dummy : 6; | ||
u8 fontID : 7; | ||
u8 prefer : 1; | ||
} altFont; | ||
ColoredArrow *cursor; | ||
u16 listPos; | ||
u16 cursorPos; | ||
u8 dummy2C; | ||
u8 dummy2D; | ||
u8 dummy2E; | ||
u8 lastAction; | ||
u8 heapID; | ||
}; | ||
|
||
ListMenu *ListMenu_New(const ListMenuTemplate *template, u16 startListPos, u16 startCursorPos, u8 heapID); | ||
u32 ListMenu_ProcessInput(ListMenu *menu); | ||
void ListMenu_Free(ListMenu *menu, u16 *outListPos, u16 *outCursorPos); | ||
void ListMenu_Draw(ListMenu *menu); | ||
void ListMenu_SetTextColors(ListMenu *menu, u8 fg, u8 bg, u8 shadow); | ||
u32 ListMenu_TestInput(ListMenu *menu, ListMenuTemplate *template, u16 listPos, u16 cursorPos, u16 updateCursor, u16 input, u16 *outListPos, u16 *outCursorPos); | ||
void ListMenu_SetAltTextColors(ListMenu *menu, u8 fg, u8 bg, u8 shadow); | ||
void ListMenu_CalcTrueCursorPos(ListMenu *menu, u16 *outPos); | ||
void ListMenu_GetListAndCursorPos(ListMenu *menu, u16 *outListPos, u16 *outCursorPos); | ||
u8 ListMenu_GetLastAction(ListMenu *menu); | ||
u32 ListMenu_GetIndexOfChoice(ListMenu *menu, u16 choice); | ||
u32 ListMenu_GetAttribute(ListMenu *menu, u8 attribute); | ||
void ListMenu_SetChoices(ListMenu *menu, StringList *choices); | ||
|
||
#endif // POKEPLATINUM_LIST_MENU_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ifndef POKEPLATINUM_MENU_H | ||
#define POKEPLATINUM_MENU_H | ||
|
||
#include "bg_window.h" | ||
#include "colored_arrow.h" | ||
#include "string_list.h" | ||
|
||
#define MENU_NOTHING_CHOSEN -1 | ||
#define MENU_CANCELED -2 | ||
#define MENU_DUMMY -3 | ||
|
||
enum MenuAction { | ||
MENU_ACTION_NONE = 0, | ||
MENU_ACTION_MOVE_UP, | ||
MENU_ACTION_MOVE_DOWN, | ||
MENU_ACTION_MOVE_LEFT, | ||
MENU_ACTION_MOVE_RIGHT, | ||
}; | ||
|
||
enum MenuExternalInput { | ||
MENU_INPUT_CONFIRM = 0, | ||
MENU_INPUT_CANCEL, | ||
MENU_INPUT_MOVE_UP, | ||
MENU_INPUT_MOVE_DOWN, | ||
MENU_INPUT_MOVE_LEFT, | ||
MENU_INPUT_MOVE_RIGHT, | ||
}; | ||
|
||
typedef struct MenuTemplate { | ||
StringList *choices; | ||
Window *window; | ||
u8 fontID; | ||
u8 xSize; | ||
u8 ySize; | ||
u8 lineSpacing : 4; | ||
u8 suppressCursor : 2; | ||
u8 loopAround : 2; | ||
} MenuTemplate; | ||
|
||
typedef struct Menu { | ||
MenuTemplate template; | ||
ColoredArrow *cursor; | ||
u32 cancelKeys; | ||
u8 dummy14; | ||
u8 cursorPos; | ||
u8 width; | ||
u8 xOffset; | ||
u8 yOffset; | ||
u8 letterWidth; | ||
u8 lineHeight; | ||
u8 lastAction; | ||
u8 heapID; | ||
} Menu; | ||
|
||
Menu *Menu_New(const MenuTemplate *template, u8 xOffset, u8 yOffset, u8 cursorStart, u8 heapID, u32 cancelKeys); | ||
Menu *Menu_NewAndCopyToVRAM(const MenuTemplate *template, u8 xOffset, u8 yOffset, u8 cursorStart, u8 heapID, u32 cancelKeys); | ||
Menu *Menu_NewSimple(const MenuTemplate *template, u8 cursorStart, u8 heapID); | ||
void Menu_Free(Menu *menu, u8 *outCursorPos); | ||
u32 Menu_ProcessInput(Menu *menu); | ||
u32 Menu_ProcessInputWithSound(Menu *menu, u16 sdatID); | ||
u32 Menu_ProcessExternalInput(Menu *menu, u8 input); | ||
u8 Menu_GetCursorPos(Menu *menu); | ||
u8 Menu_GetLastAction(Menu *menu); | ||
Menu *Menu_MakeYesNoChoiceWithCursorAt(BgConfig *bgConfig, const WindowTemplate *winTemplate, u16 borderTileStart, u8 borderPalette, u8 cursorStart, u32 heapID); | ||
Menu *Menu_MakeYesNoChoice(BgConfig *bgConfig, const WindowTemplate *winTemplate, u16 borderTileStart, u8 borderPalette, u32 heapID); | ||
u32 Menu_ProcessInputAndHandleExit(Menu *menu, u32 heapID); | ||
u32 Menu_ProcessExternalInputAndHandleExit(Menu *menu, u8 input, u32 heapID); | ||
void Menu_DestroyForExit(Menu *menu, u32 heapID); | ||
void Window_DrawMenuCursor(Window *window, u32 x, u32 y); | ||
|
||
#endif // POKEPLATINUM_MENU_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#ifndef POKEPLATINUM_FUNCPTR_OV23_022515D8_H | ||
#define POKEPLATINUM_FUNCPTR_OV23_022515D8_H | ||
|
||
#include "struct_decls/struct_0200112C_decl.h" | ||
#include "list_menu.h" | ||
|
||
typedef void (*UnkFuncPtr_ov23_022515D8)(BmpList *, u32, u8); | ||
typedef void (*UnkFuncPtr_ov23_022515D8)(ListMenu *, u32, u8); | ||
|
||
#endif // POKEPLATINUM_FUNCPTR_OV23_022515D8_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.