2017-09-05 13:01:24 +02:00
|
|
|
#ifndef GUARD_MENU_H
|
|
|
|
#define GUARD_MENU_H
|
|
|
|
|
2018-02-07 07:07:42 +01:00
|
|
|
#include "task.h"
|
2017-11-19 22:48:46 +01:00
|
|
|
#include "text.h"
|
2017-09-29 00:11:42 +02:00
|
|
|
#include "window.h"
|
2017-09-05 13:01:24 +02:00
|
|
|
|
2017-12-16 15:10:29 +01:00
|
|
|
#define MENU_NOTHING_CHOSEN -2
|
|
|
|
#define MENU_B_PRESSED -1
|
|
|
|
|
2020-08-28 19:31:58 +02:00
|
|
|
#define MENU_CURSOR_DELTA_NONE 0
|
|
|
|
#define MENU_CURSOR_DELTA_UP -1
|
|
|
|
#define MENU_CURSOR_DELTA_DOWN 1
|
|
|
|
#define MENU_CURSOR_DELTA_LEFT -1
|
|
|
|
#define MENU_CURSOR_DELTA_RIGHT 1
|
|
|
|
|
2020-10-29 21:34:33 +01:00
|
|
|
#define MENU_INFO_ICON_TYPE (NUMBER_OF_MON_TYPES + 1)
|
|
|
|
#define MENU_INFO_ICON_POWER (NUMBER_OF_MON_TYPES + 2)
|
|
|
|
#define MENU_INFO_ICON_ACCURACY (NUMBER_OF_MON_TYPES + 3)
|
|
|
|
#define MENU_INFO_ICON_PP (NUMBER_OF_MON_TYPES + 4)
|
|
|
|
#define MENU_INFO_ICON_EFFECT (NUMBER_OF_MON_TYPES + 5)
|
|
|
|
#define MENU_INFO_ICON_BALL_RED (NUMBER_OF_MON_TYPES + 6)
|
|
|
|
#define MENU_INFO_ICON_BALL_BLUE (NUMBER_OF_MON_TYPES + 7)
|
|
|
|
|
2020-02-07 18:48:47 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SAVE_MENU_NAME,
|
|
|
|
SAVE_MENU_CAUGHT,
|
|
|
|
SAVE_MENU_PLAY_TIME,
|
|
|
|
SAVE_MENU_LOCATION,
|
|
|
|
SAVE_MENU_BADGES,
|
|
|
|
};
|
|
|
|
|
2017-09-05 13:01:24 +02:00
|
|
|
struct MenuAction
|
|
|
|
{
|
|
|
|
const u8 *text;
|
2017-10-23 00:55:07 +02:00
|
|
|
union {
|
|
|
|
void (*void_u8)(u8);
|
|
|
|
u8 (*u8_void)(void);
|
|
|
|
} func;
|
2017-09-05 13:01:24 +02:00
|
|
|
};
|
|
|
|
|
2021-10-26 22:52:23 +02:00
|
|
|
extern const u16 gStandardMenuPalette[];
|
2018-02-12 01:22:06 +01:00
|
|
|
|
2023-11-11 10:49:46 +01:00
|
|
|
u16 AddWindowParameterized(u8, u8, u8, u8, u8, u8, u16);
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
void FreeAllOverworldWindowBuffers(void);
|
|
|
|
void InitStandardTextBoxWindows(void);
|
2020-06-20 01:58:56 +02:00
|
|
|
void InitTextBoxGfxAndPrinters(void);
|
2018-09-14 19:15:46 +02:00
|
|
|
u16 RunTextPrintersAndIsPrinter0Active(void);
|
2020-02-07 18:48:47 +01:00
|
|
|
void LoadMessageBoxAndBorderGfx(void);
|
2019-08-02 00:41:55 +02:00
|
|
|
void DrawDialogueFrame(u8 windowId, bool8 copyToVram);
|
2019-02-22 07:40:11 +01:00
|
|
|
void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram);
|
2018-11-06 17:44:48 +01:00
|
|
|
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
|
2022-07-29 16:17:58 +02:00
|
|
|
void PrintPlayerNameOnWindow(u8, const u8 *, u16, u16);
|
2019-02-22 07:40:11 +01:00
|
|
|
void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram);
|
2019-03-05 12:06:20 +01:00
|
|
|
void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram);
|
2019-02-27 04:30:40 +01:00
|
|
|
void DisplayYesNoMenuDefaultYes(void);
|
2018-11-07 03:20:56 +01:00
|
|
|
u32 GetPlayerTextSpeed(void);
|
2018-11-06 18:30:21 +01:00
|
|
|
u8 GetPlayerTextSpeedDelay(void);
|
2022-05-21 21:21:50 +02:00
|
|
|
void Menu_LoadStdPalAt(u16 offset);
|
2022-06-01 18:41:57 +02:00
|
|
|
void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(struct TextPrinterTemplate *, u16));
|
|
|
|
void BgDmaFill(u32 bg, u8 value, int offset, int size);
|
2018-09-03 22:55:55 +02:00
|
|
|
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str);
|
2019-02-22 07:40:11 +01:00
|
|
|
void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
|
2022-07-29 17:15:33 +02:00
|
|
|
void SetWindowTemplateFields(struct WindowTemplate *template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
|
2019-02-22 07:40:11 +01:00
|
|
|
void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette);
|
2020-05-14 10:37:09 +02:00
|
|
|
void ScheduleBgCopyTilemapToVram(u8 bgNum);
|
2018-01-28 00:46:32 +01:00
|
|
|
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs);
|
2021-11-03 21:06:58 +01:00
|
|
|
u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 numItems, u8 initialCursorPos);
|
2018-12-16 21:10:01 +01:00
|
|
|
u8 Menu_GetCursorPos(void);
|
2018-11-05 21:45:54 +01:00
|
|
|
s8 Menu_ProcessInput(void);
|
|
|
|
s8 Menu_ProcessInputNoWrap(void);
|
2022-06-01 18:41:57 +02:00
|
|
|
void BlitMenuInfoIcon(u8 windowId, u8 iconId, u16 x, u16 y);
|
2020-05-14 10:37:09 +02:00
|
|
|
void ResetTempTileDataBuffers(void);
|
|
|
|
void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode);
|
|
|
|
bool8 FreeTempTileDataBuffersIfPossible(void);
|
2018-10-13 23:23:33 +02:00
|
|
|
struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock);
|
2017-10-22 05:23:03 +02:00
|
|
|
void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos);
|
2018-12-15 23:58:47 +01:00
|
|
|
void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode);
|
2018-11-05 21:45:54 +01:00
|
|
|
s8 Menu_ProcessInputNoWrapClearOnChoose(void);
|
2018-03-12 09:26:20 +01:00
|
|
|
s8 ProcessMenuInput_other(void);
|
2020-06-20 01:58:56 +02:00
|
|
|
void DoScheduledBgTilemapCopiesToVram(void);
|
|
|
|
void ClearScheduledBgCopiesToVram(void);
|
2018-09-08 23:38:30 +02:00
|
|
|
void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str);
|
2022-06-01 18:41:57 +02:00
|
|
|
void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum);
|
2021-11-04 04:20:59 +01:00
|
|
|
void PrintMenuActionTextsInUpperLeftCorner(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds);
|
2019-02-22 07:40:11 +01:00
|
|
|
void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
|
2018-12-15 23:58:47 +01:00
|
|
|
void *malloc_and_decompress(const void *src, u32 *sizeOut);
|
2018-01-30 00:26:36 +01:00
|
|
|
u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode);
|
2018-02-08 01:06:59 +01:00
|
|
|
void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress);
|
2022-06-01 18:41:57 +02:00
|
|
|
void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds);
|
|
|
|
void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds);
|
2021-04-23 00:49:54 +02:00
|
|
|
u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos);
|
2021-11-04 04:20:59 +01:00
|
|
|
u8 ChangeMenuGridCursorPosition(s8 deltaX, s8 deltaY);
|
2018-03-28 00:33:08 +02:00
|
|
|
u8 GetStartMenuWindowId(void);
|
2022-09-13 02:14:15 +02:00
|
|
|
void ListMenuLoadStdPalAt(u8 palOffset, u8 palId);
|
2018-12-16 21:10:01 +01:00
|
|
|
u8 Menu_MoveCursor(s8 cursorDelta);
|
|
|
|
u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta);
|
2019-02-22 07:40:11 +01:00
|
|
|
void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram);
|
2021-11-03 21:06:58 +01:00
|
|
|
u8 AddStartMenuWindow(u8 numActions);
|
|
|
|
u8 InitMenuNormal(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos);
|
2021-11-04 04:20:59 +01:00
|
|
|
void LoadMessageBoxAndFrameGfx(u8 windowId, bool8 copyToVram);
|
2018-03-28 00:33:08 +02:00
|
|
|
void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress);
|
2018-03-29 02:16:02 +02:00
|
|
|
void RemoveStartMenuWindow(void);
|
2019-02-27 04:30:40 +01:00
|
|
|
void DisplayYesNoMenuWithDefault(u8 initialCursorPos);
|
2020-02-07 18:48:47 +01:00
|
|
|
void BufferSaveMenuText(u8 textId, u8 *dest, u8 color);
|
2018-04-09 09:22:28 +02:00
|
|
|
void RemoveMapNamePopUpWindow(void);
|
|
|
|
u8 GetMapNamePopUpWindowId(void);
|
|
|
|
u8 AddMapNamePopUpWindow(void);
|
2018-11-06 17:44:48 +01:00
|
|
|
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing);
|
2019-10-26 03:55:01 +02:00
|
|
|
void SetBgTilemapPalette(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette);
|
2021-11-04 01:28:43 +01:00
|
|
|
void AddValToTilemapBuffer(void *ptr, int delta, int width, int height, bool32 is8BPP);
|
2021-11-03 21:06:58 +01:00
|
|
|
void EraseFieldMessageBox(bool8 copyToVram);
|
2019-04-02 15:06:44 +02:00
|
|
|
void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs);
|
2021-11-04 04:20:59 +01:00
|
|
|
s8 Menu_ProcessGridInput(void);
|
2018-12-10 08:38:23 +01:00
|
|
|
u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted);
|
|
|
|
s8 Menu_ProcessInputNoWrapAround_other(void);
|
2019-10-18 01:22:03 +02:00
|
|
|
void CopyToBufferFromBgTilemap(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height);
|
2021-11-03 21:06:58 +01:00
|
|
|
u8 HofPCTopBar_AddWindow(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile);
|
|
|
|
void HofPCTopBar_RemoveWindow(void);
|
|
|
|
void HofPCTopBar_Print(const u8 *string, u8 left, bool8 copyToVram);
|
|
|
|
void HofPCTopBar_PrintPair(const u8 *string, const u8 *string2, bool8 noBg, u8 left, bool8 copyToVram);
|
2019-04-07 05:34:30 +02:00
|
|
|
void ResetBgPositions(void);
|
2019-03-27 15:44:49 +01:00
|
|
|
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed);
|
2021-11-03 20:29:18 +01:00
|
|
|
void EraseYesNoWindow(void);
|
2021-11-03 21:06:58 +01:00
|
|
|
void PrintMenuActionTextsAtPos(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs);
|
2021-10-26 22:52:23 +02:00
|
|
|
void Menu_LoadStdPal(void);
|
2017-09-18 17:26:45 +02:00
|
|
|
|
2017-09-05 13:01:24 +02:00
|
|
|
#endif // GUARD_MENU_H
|