From 99c37023c8041cbf37c9f3f1152fd0db1f5370f0 Mon Sep 17 00:00:00 2001 From: Slawter666 <38655737+Slawter666@users.noreply.github.com> Date: Wed, 2 Jan 2019 01:11:02 +0000 Subject: [PATCH] Minor labelling of menu.c --- src/menu.c | 472 ++++++++++++++++++++++++++--------------------------- 1 file changed, 236 insertions(+), 236 deletions(-) diff --git a/src/menu.c b/src/menu.c index f1b35b42e..ae589dff4 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,24 +1,24 @@ #include "global.h" -#include "bg.h" -#include "window.h" -#include "palette.h" -#include "menu.h" -#include "constants/songs.h" -#include "main.h" -#include "sound.h" -#include "menu_helpers.h" #include "alloc.h" -#include "task.h" +#include "bg.h" #include "dma3.h" -#include "string_util.h" -#include "pokemon_icon.h" -#include "constants/flags.h" #include "event_data.h" -#include "pokedex.h" -#include "region_map.h" -#include "text_window.h" -#include "strings.h" #include "graphics.h" +#include "main.h" +#include "menu.h" +#include "menu_helpers.h" +#include "palette.h" +#include "pokedex.h" +#include "pokemon_icon.h" +#include "region_map.h" +#include "sound.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text_window.h" +#include "window.h" +#include "constants/flags.h" +#include "constants/songs.h" #define DLG_WINDOW_PALETTE_NUM 15 #define DLG_WINDOW_BASE_TILE_NUM 0x200 @@ -50,11 +50,11 @@ struct Menu static EWRAM_DATA u8 sStartMenuWindowId = 0; static EWRAM_DATA u8 sMapNamePopupWindowId = 0; -static EWRAM_DATA struct Menu gUnknown_0203CD90 = {0}; -static EWRAM_DATA u16 gUnknown_0203CD9C = 0; -static EWRAM_DATA u8 gUnknown_0203CD9E = 0; -static EWRAM_DATA u8 gUnknown_0203CD9F = 0; -static EWRAM_DATA u8 gUnknown_0203CDA0 = 0; +static EWRAM_DATA struct Menu sMenu = {0}; +static EWRAM_DATA u16 sTileNum = 0; +static EWRAM_DATA u8 sPaletteNum = 0; +static EWRAM_DATA u8 sYesNoWindowId = 0; +static EWRAM_DATA u8 sWindowId = 0; static EWRAM_DATA u16 sFiller = 0; // needed to align static EWRAM_DATA bool8 gUnknown_0203CDA4[4] = {FALSE}; static EWRAM_DATA u16 gUnknown_0203CDA8 = 0; @@ -549,10 +549,10 @@ void sub_8197AE8(bool8 copyToVram) CopyBgTilemapBufferToVram(0); } -void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a3, u8 a4) +void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum) { - gUnknown_0203CD9C = a3; - gUnknown_0203CD9E = a4; + sTileNum = tileNum; + sPaletteNum = paletteNum; CallWindowFunction(windowId, sub_8197BB4); FillWindowPixelBuffer(windowId, 0x11); PutWindowTilemap(windowId); @@ -560,10 +560,10 @@ void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a3, u8 a4) CopyWindowToVram(windowId, 3); } -void sub_8197B64(u8 windowId, bool8 copyToVram, u16 a3) +void sub_8197B64(u8 windowId, bool8 copyToVram, u16 tileNum) { - gUnknown_0203CD9C = a3; - gUnknown_0203CD9E = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); + sTileNum = tileNum; + sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); CallWindowFunction(windowId, sub_8197BB4); FillWindowPixelBuffer(windowId, 0x11); PutWindowTilemap(windowId); @@ -574,96 +574,96 @@ void sub_8197B64(u8 windowId, bool8 copyToVram, u16 a3) void sub_8197BB4(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 1, + sTileNum + 1, tilemapLeft - 2, tilemapTop - 1, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 3, + sTileNum + 3, tilemapLeft - 1, tilemapTop - 1, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 4, + sTileNum + 4, tilemapLeft, tilemapTop - 1, width - 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 5, + sTileNum + 5, tilemapLeft + width - 1, tilemapTop - 1, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 6, + sTileNum + 6, tilemapLeft + width, tilemapTop - 1, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 7, + sTileNum + 7, tilemapLeft - 2, tilemapTop, 1, 5, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 9, + sTileNum + 9, tilemapLeft - 1, tilemapTop, width + 1, 5, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 10, + sTileNum + 10, tilemapLeft + width, tilemapTop, 1, 5, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(gUnknown_0203CD9C + 1), + BG_TILE_V_FLIP(sTileNum + 1), tilemapLeft - 2, tilemapTop + height, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(gUnknown_0203CD9C + 3), + BG_TILE_V_FLIP(sTileNum + 3), tilemapLeft - 1, tilemapTop + height, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(gUnknown_0203CD9C + 4), + BG_TILE_V_FLIP(sTileNum + 4), tilemapLeft, tilemapTop + height, width - 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(gUnknown_0203CD9C + 5), + BG_TILE_V_FLIP(sTileNum + 5), tilemapLeft + width - 1, tilemapTop + height, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - BG_TILE_V_FLIP(gUnknown_0203CD9C + 6), + BG_TILE_V_FLIP(sTileNum + 6), tilemapLeft + width, tilemapTop + height, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); } void sub_8197DF8(u8 windowId, bool8 copyToVram) @@ -682,8 +682,8 @@ void sub_8197E30(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 p void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum) { - gUnknown_0203CD9C = baseTileNum; - gUnknown_0203CD9E = paletteNum; + sTileNum = baseTileNum; + sPaletteNum = paletteNum; CallWindowFunction(windowId, DrawWindowBorder); FillWindowPixelBuffer(windowId, 0x11); PutWindowTilemap(windowId); @@ -693,8 +693,8 @@ void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 pal void sub_8197EC8(u8 windowId, bool8 copyToVram, u16 baseTileNum) { - gUnknown_0203CD9C = baseTileNum; - gUnknown_0203CD9E = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); + sTileNum = baseTileNum; + sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM); CallWindowFunction(windowId, DrawWindowBorder); FillWindowPixelBuffer(windowId, 0x11); PutWindowTilemap(windowId); @@ -705,61 +705,61 @@ void sub_8197EC8(u8 windowId, bool8 copyToVram, u16 baseTileNum) void DrawWindowBorder(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) { FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 0, + sTileNum + 0, tilemapLeft - 1, tilemapTop - 1, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 1, + sTileNum + 1, tilemapLeft, tilemapTop - 1, width, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 2, + sTileNum + 2, tilemapLeft + width, tilemapTop - 1, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 3, + sTileNum + 3, tilemapLeft - 1, tilemapTop, 1, height, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 5, + sTileNum + 5, tilemapLeft + width, tilemapTop, 1, height, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 6, + sTileNum + 6, tilemapLeft - 1, tilemapTop + height, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 7, + sTileNum + 7, tilemapLeft, tilemapTop + height, width, 1, - gUnknown_0203CD9E); + sPaletteNum); FillBgTilemapBufferRect(bg, - gUnknown_0203CD9C + 8, + sTileNum + 8, tilemapLeft + width, tilemapTop + height, 1, 1, - gUnknown_0203CD9E); + sPaletteNum); } void sub_8198070(u8 windowId, bool8 copyToVram) @@ -793,7 +793,7 @@ u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile) window.paletteNum = palette; window.baseBlock = baseTile; - gUnknown_0203CDA0 = AddWindow(&window); + sWindowId = AddWindow(&window); if (palette > 15) palette = 15 * 16; @@ -801,27 +801,27 @@ u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile) palette *= 16; LoadPalette(gUnknown_0860F0B0, palette, sizeof(gUnknown_0860F0B0)); - return gUnknown_0203CDA0; + return sWindowId; } void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram) { u16 width = 0; - if (gUnknown_0203CDA0 != 0xFF) + if (sWindowId != 0xFF) { - PutWindowTilemap(gUnknown_0203CDA0); - FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); + PutWindowTilemap(sWindowId); + FillWindowPixelBuffer(sWindowId, 0xFF); width = GetStringWidth(0, string, 0); - AddTextPrinterParameterized3(gUnknown_0203CDA0, + AddTextPrinterParameterized3(sWindowId, 0, - 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a2 - width, + 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a2 - width, 1, gUnknown_0860F0D0, 0, string); if (copyToVram) - CopyWindowToVram(gUnknown_0203CDA0, 3); + CopyWindowToVram(sWindowId, 3); } } @@ -830,7 +830,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo u8 color[3]; u16 width = 0; - if (gUnknown_0203CDA0 != 0xFF) + if (sWindowId != 0xFF) { if (a3 != 0) { @@ -844,49 +844,49 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo color[1] = 1; color[2] = 2; } - PutWindowTilemap(gUnknown_0203CDA0); - FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); + PutWindowTilemap(sWindowId); + FillWindowPixelBuffer(sWindowId, 0xFF); if (string2 != NULL) { width = GetStringWidth(0, string2, 0); - AddTextPrinterParameterized3(gUnknown_0203CDA0, + AddTextPrinterParameterized3(sWindowId, 0, - 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a4 - width, + 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a4 - width, 1, color, 0, string2); } - AddTextPrinterParameterized4(gUnknown_0203CDA0, 1, 4, 1, 0, 0, color, 0, string); + AddTextPrinterParameterized4(sWindowId, 1, 4, 1, 0, 0, color, 0, string); if (copyToVram) - CopyWindowToVram(gUnknown_0203CDA0, 3); + CopyWindowToVram(sWindowId, 3); } } void sub_81982D8(void) { - if (gUnknown_0203CDA0 != 0xFF) - CopyWindowToVram(gUnknown_0203CDA0, 3); + if (sWindowId != 0xFF) + CopyWindowToVram(sWindowId, 3); } void sub_81982F0(void) { - if (gUnknown_0203CDA0 != 0xFF) + if (sWindowId != 0xFF) { - FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF); - CopyWindowToVram(gUnknown_0203CDA0, 3); + FillWindowPixelBuffer(sWindowId, 0xFF); + CopyWindowToVram(sWindowId, 3); } } void sub_8198314(void) { - if (gUnknown_0203CDA0 != 0xFF) + if (sWindowId != 0xFF) { - FillWindowPixelBuffer(gUnknown_0203CDA0, 0); - ClearWindowTilemap(gUnknown_0203CDA0); - CopyWindowToVram(gUnknown_0203CDA0, 3); - RemoveWindow(gUnknown_0203CDA0); - gUnknown_0203CDA0 = 0xFF; + FillWindowPixelBuffer(sWindowId, 0); + ClearWindowTilemap(sWindowId); + CopyWindowToVram(sWindowId, 3); + RemoveWindow(sWindowId); + sWindowId = 0xFF; } } @@ -894,24 +894,24 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC { s32 pos; - gUnknown_0203CD90.left = left; - gUnknown_0203CD90.top = top; - gUnknown_0203CD90.minCursorPos = 0; - gUnknown_0203CD90.maxCursorPos = numChoices - 1; - gUnknown_0203CD90.windowId = windowId; - gUnknown_0203CD90.fontId = fontId; - gUnknown_0203CD90.optionHeight = cursorHeight; - gUnknown_0203CD90.APressMuted = a7; + sMenu.left = left; + sMenu.top = top; + sMenu.minCursorPos = 0; + sMenu.maxCursorPos = numChoices - 1; + sMenu.windowId = windowId; + sMenu.fontId = fontId; + sMenu.optionHeight = cursorHeight; + sMenu.APressMuted = a7; pos = initialCursorPos; - if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos) - gUnknown_0203CD90.cursorPos = 0; + if (pos < 0 || pos > sMenu.maxCursorPos) + sMenu.cursorPos = 0; else - gUnknown_0203CD90.cursorPos = pos; + sMenu.cursorPos = pos; Menu_MoveCursor(0); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos) @@ -929,56 +929,56 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos) { u8 width, height; - width = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0); - height = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1); - FillWindowPixelRect(gUnknown_0203CD90.windowId, 0x11, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * oldPos + gUnknown_0203CD90.top, width, height); - AddTextPrinterParameterized(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0); + width = GetMenuCursorDimensionByFont(sMenu.fontId, 0); + height = GetMenuCursorDimensionByFont(sMenu.fontId, 1); + FillWindowPixelRect(sMenu.windowId, 0x11, sMenu.left, sMenu.optionHeight * oldPos + sMenu.top, width, height); + AddTextPrinterParameterized(sMenu.windowId, sMenu.fontId, gText_SelectorArrow3, sMenu.left, sMenu.optionHeight * newPos + sMenu.top, 0, 0); } u8 Menu_MoveCursor(s8 cursorDelta) { - u8 oldPos = gUnknown_0203CD90.cursorPos; - int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; + u8 oldPos = sMenu.cursorPos; + int newPos = sMenu.cursorPos + cursorDelta; - if (newPos < gUnknown_0203CD90.minCursorPos) - gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.maxCursorPos; - else if (newPos > gUnknown_0203CD90.maxCursorPos) - gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.minCursorPos; + if (newPos < sMenu.minCursorPos) + sMenu.cursorPos = sMenu.maxCursorPos; + else if (newPos > sMenu.maxCursorPos) + sMenu.cursorPos = sMenu.minCursorPos; else - gUnknown_0203CD90.cursorPos += cursorDelta; + sMenu.cursorPos += cursorDelta; - RedrawMenuCursor(oldPos, gUnknown_0203CD90.cursorPos); - return gUnknown_0203CD90.cursorPos; + RedrawMenuCursor(oldPos, sMenu.cursorPos); + return sMenu.cursorPos; } u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta) { - u8 oldPos = gUnknown_0203CD90.cursorPos; - int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; + u8 oldPos = sMenu.cursorPos; + int newPos = sMenu.cursorPos + cursorDelta; - if (newPos < gUnknown_0203CD90.minCursorPos) - gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.minCursorPos; - else if (newPos > gUnknown_0203CD90.maxCursorPos) - gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.maxCursorPos; + if (newPos < sMenu.minCursorPos) + sMenu.cursorPos = sMenu.minCursorPos; + else if (newPos > sMenu.maxCursorPos) + sMenu.cursorPos = sMenu.maxCursorPos; else - gUnknown_0203CD90.cursorPos += cursorDelta; + sMenu.cursorPos += cursorDelta; - RedrawMenuCursor(oldPos, gUnknown_0203CD90.cursorPos); - return gUnknown_0203CD90.cursorPos; + RedrawMenuCursor(oldPos, sMenu.cursorPos); + return sMenu.cursorPos; } u8 Menu_GetCursorPos(void) { - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } s8 Menu_ProcessInput(void) { if (gMain.newKeys & A_BUTTON) { - if (!gUnknown_0203CD90.APressMuted) + if (!sMenu.APressMuted) PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1002,13 +1002,13 @@ s8 Menu_ProcessInput(void) s8 Menu_ProcessInputNoWrap(void) { - u8 oldPos = gUnknown_0203CD90.cursorPos; + u8 oldPos = sMenu.cursorPos; if (gMain.newKeys & A_BUTTON) { - if (!gUnknown_0203CD90.APressMuted) + if (!sMenu.APressMuted) PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1034,9 +1034,9 @@ s8 ProcessMenuInput_other(void) { if (gMain.newKeys & A_BUTTON) { - if (!gUnknown_0203CD90.APressMuted) + if (!sMenu.APressMuted) PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1060,13 +1060,13 @@ s8 ProcessMenuInput_other(void) s8 Menu_ProcessInputNoWrapAround_other(void) { - u8 oldPos = gUnknown_0203CD90.cursorPos; + u8 oldPos = sMenu.cursorPos; if (gMain.newKeys & A_BUTTON) { - if (!gUnknown_0203CD90.APressMuted) + if (!sMenu.APressMuted) PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1174,11 +1174,11 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top { struct TextPrinterTemplate printer; - gUnknown_0203CD9F = AddWindow(window); - SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum); + sYesNoWindowId = AddWindow(window); + SetWindowBorderStyle(sYesNoWindowId, TRUE, baseTileNum, paletteNum); printer.currentChar = gText_YesNo; - printer.windowId = gUnknown_0203CD9F; + printer.windowId = sYesNoWindowId; printer.fontId = fontId; printer.x = GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH) + left; printer.y = top; @@ -1193,7 +1193,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top AddTextPrinter(&printer, 0xFF, NULL); - sub_81983AC(gUnknown_0203CD9F, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos); + sub_81983AC(sYesNoWindowId, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos); } void sub_8198C34(const struct WindowTemplate *window, u8 fontId, u16 baseTileNum, u8 paletteNum) @@ -1211,8 +1211,8 @@ s8 Menu_ProcessInputNoWrapClearOnChoose(void) void sub_8198C78(void) { - sub_8198070(gUnknown_0203CD9F, TRUE); - RemoveWindow(gUnknown_0203CD9F); + sub_8198070(sYesNoWindowId, TRUE); + RemoveWindow(sYesNoWindowId); } void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7, const struct MenuAction *strs) @@ -1274,26 +1274,26 @@ u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight, { s32 pos; - gUnknown_0203CD90.left = left; - gUnknown_0203CD90.top = top; - gUnknown_0203CD90.minCursorPos = 0; - gUnknown_0203CD90.maxCursorPos = numChoices - 1; - gUnknown_0203CD90.windowId = windowId; - gUnknown_0203CD90.fontId = fontId; - gUnknown_0203CD90.optionWidth = a4; - gUnknown_0203CD90.optionHeight = cursorHeight; - gUnknown_0203CD90.horizontalCount = a6; - gUnknown_0203CD90.verticalCount = a7; + sMenu.left = left; + sMenu.top = top; + sMenu.minCursorPos = 0; + sMenu.maxCursorPos = numChoices - 1; + sMenu.windowId = windowId; + sMenu.fontId = fontId; + sMenu.optionWidth = a4; + sMenu.optionHeight = cursorHeight; + sMenu.horizontalCount = a6; + sMenu.verticalCount = a7; pos = a9; - if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos) - gUnknown_0203CD90.cursorPos = 0; + if (pos < 0 || pos > sMenu.maxCursorPos) + sMenu.cursorPos = 0; else - gUnknown_0203CD90.cursorPos = pos; + sMenu.cursorPos = pos; sub_8199134(0, 0); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } u8 sub_8198FD4(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7) @@ -1305,20 +1305,20 @@ u8 sub_8198FD4(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 void sub_8199060(u8 oldCursorPos, u8 newCursorPos) { - u8 cursorWidth = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0); - u8 cursorHeight = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1); - u8 xPos = (oldCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left; - u8 yPos = (oldCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top; - FillWindowPixelRect(gUnknown_0203CD90.windowId, + u8 cursorWidth = GetMenuCursorDimensionByFont(sMenu.fontId, 0); + u8 cursorHeight = GetMenuCursorDimensionByFont(sMenu.fontId, 1); + u8 xPos = (oldCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left; + u8 yPos = (oldCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top; + FillWindowPixelRect(sMenu.windowId, 0x11, xPos, yPos, cursorWidth, cursorHeight); - xPos = (newCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left; - yPos = (newCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top; - AddTextPrinterParameterized(gUnknown_0203CD90.windowId, - gUnknown_0203CD90.fontId, + xPos = (newCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left; + yPos = (newCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top; + AddTextPrinterParameterized(sMenu.windowId, + sMenu.fontId, gText_SelectorArrow3, xPos, yPos, @@ -1328,83 +1328,83 @@ void sub_8199060(u8 oldCursorPos, u8 newCursorPos) u8 sub_8199134(s8 deltaX, s8 deltaY) { - u8 oldPos = gUnknown_0203CD90.cursorPos; + u8 oldPos = sMenu.cursorPos; if (deltaX != 0) { - if ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX < 0) + if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < 0) { - gUnknown_0203CD90.cursorPos += gUnknown_0203CD90.horizontalCount - 1; + sMenu.cursorPos += sMenu.horizontalCount - 1; } - else if ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX >= gUnknown_0203CD90.horizontalCount) + else if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= sMenu.horizontalCount) { - gUnknown_0203CD90.cursorPos = (gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.horizontalCount; + sMenu.cursorPos = (sMenu.cursorPos / sMenu.horizontalCount) * sMenu.horizontalCount; } else { - gUnknown_0203CD90.cursorPos += deltaX; + sMenu.cursorPos += deltaX; } } if (deltaY != 0) { - if ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY < 0) + if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < 0) { - gUnknown_0203CD90.cursorPos += gUnknown_0203CD90.horizontalCount * (gUnknown_0203CD90.verticalCount - 1); + sMenu.cursorPos += sMenu.horizontalCount * (sMenu.verticalCount - 1); } - else if ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY >= gUnknown_0203CD90.verticalCount) + else if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= sMenu.verticalCount) { - gUnknown_0203CD90.cursorPos -= gUnknown_0203CD90.horizontalCount * (gUnknown_0203CD90.verticalCount - 1); + sMenu.cursorPos -= sMenu.horizontalCount * (sMenu.verticalCount - 1); } else { - gUnknown_0203CD90.cursorPos += (gUnknown_0203CD90.horizontalCount * deltaY); + sMenu.cursorPos += (sMenu.horizontalCount * deltaY); } } - if (gUnknown_0203CD90.cursorPos > gUnknown_0203CD90.maxCursorPos) + if (sMenu.cursorPos > sMenu.maxCursorPos) { - gUnknown_0203CD90.cursorPos = oldPos; - return gUnknown_0203CD90.cursorPos; + sMenu.cursorPos = oldPos; + return sMenu.cursorPos; } else { - sub_8199060(oldPos, gUnknown_0203CD90.cursorPos); - return gUnknown_0203CD90.cursorPos; + sub_8199060(oldPos, sMenu.cursorPos); + return sMenu.cursorPos; } } u8 sub_81991F8(s8 deltaX, s8 deltaY) { - u8 oldPos = gUnknown_0203CD90.cursorPos; + u8 oldPos = sMenu.cursorPos; if (deltaX != 0) { - if (((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX >= 0) && - ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX < gUnknown_0203CD90.horizontalCount)) + if (((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= 0) && + ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < sMenu.horizontalCount)) { - gUnknown_0203CD90.cursorPos += deltaX; + sMenu.cursorPos += deltaX; } } if (deltaY != 0) { - if (((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY >= 0) && - ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY < gUnknown_0203CD90.verticalCount)) + if (((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= 0) && + ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < sMenu.verticalCount)) { - gUnknown_0203CD90.cursorPos += (gUnknown_0203CD90.horizontalCount * deltaY); + sMenu.cursorPos += (sMenu.horizontalCount * deltaY); } } - if (gUnknown_0203CD90.cursorPos > gUnknown_0203CD90.maxCursorPos) + if (sMenu.cursorPos > sMenu.maxCursorPos) { - gUnknown_0203CD90.cursorPos = oldPos; - return gUnknown_0203CD90.cursorPos; + sMenu.cursorPos = oldPos; + return sMenu.cursorPos; } else { - sub_8199060(oldPos, gUnknown_0203CD90.cursorPos); - return gUnknown_0203CD90.cursorPos; + sub_8199060(oldPos, sMenu.cursorPos); + return sMenu.cursorPos; } } @@ -1413,7 +1413,7 @@ s8 sub_8199284(void) if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1449,12 +1449,12 @@ s8 sub_8199284(void) s8 Menu_ProcessInputGridLayout(void) { - u8 oldPos = gUnknown_0203CD90.cursorPos; + u8 oldPos = sMenu.cursorPos; if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1493,7 +1493,7 @@ s8 sub_81993D8(void) if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1529,12 +1529,12 @@ s8 sub_81993D8(void) s8 sub_8199484(void) { - u8 oldPos = gUnknown_0203CD90.cursorPos; + u8 oldPos = sMenu.cursorPos; if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } else if (gMain.newKeys & B_BUTTON) { @@ -1572,21 +1572,21 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo { s32 pos; - gUnknown_0203CD90.left = 0; - gUnknown_0203CD90.top = 1; - gUnknown_0203CD90.minCursorPos = 0; - gUnknown_0203CD90.maxCursorPos = itemCount - 1; - gUnknown_0203CD90.windowId = windowId; - gUnknown_0203CD90.fontId = 1; - gUnknown_0203CD90.optionHeight = 16; - gUnknown_0203CD90.APressMuted = APressMuted; + sMenu.left = 0; + sMenu.top = 1; + sMenu.minCursorPos = 0; + sMenu.maxCursorPos = itemCount - 1; + sMenu.windowId = windowId; + sMenu.fontId = 1; + sMenu.optionHeight = 16; + sMenu.APressMuted = APressMuted; pos = initialCursorPos; - if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos) - gUnknown_0203CD90.cursorPos = 0; + if (pos < 0 || pos > sMenu.maxCursorPos) + sMenu.cursorPos = 0; else - gUnknown_0203CD90.cursorPos = pos; + sMenu.cursorPos = pos; return Menu_MoveCursor(0); } @@ -1639,11 +1639,11 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa { struct TextPrinterTemplate printer; - gUnknown_0203CD9F = AddWindow(window); - SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum); + sYesNoWindowId = AddWindow(window); + SetWindowBorderStyle(sYesNoWindowId, TRUE, baseTileNum, paletteNum); printer.currentChar = gText_YesNo; - printer.windowId = gUnknown_0203CD9F; + printer.windowId = sYesNoWindowId; printer.fontId = 1; printer.x = 8; printer.y = 1; @@ -1657,7 +1657,7 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa printer.lineSpacing = 0; AddTextPrinter(&printer, 0xFF, NULL); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_0203CD9F, 2, initialCursorPos); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos); } void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs) @@ -1709,26 +1709,26 @@ u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount { s32 pos; - gUnknown_0203CD90.left = 0; - gUnknown_0203CD90.top = 1; - gUnknown_0203CD90.minCursorPos = 0; - gUnknown_0203CD90.maxCursorPos = (horizontalCount * verticalCount) - 1; - gUnknown_0203CD90.windowId = windowId; - gUnknown_0203CD90.fontId = 1; - gUnknown_0203CD90.optionWidth = optionWidth; - gUnknown_0203CD90.optionHeight = 16; - gUnknown_0203CD90.horizontalCount = horizontalCount; - gUnknown_0203CD90.verticalCount = verticalCount; + sMenu.left = 0; + sMenu.top = 1; + sMenu.minCursorPos = 0; + sMenu.maxCursorPos = (horizontalCount * verticalCount) - 1; + sMenu.windowId = windowId; + sMenu.fontId = 1; + sMenu.optionWidth = optionWidth; + sMenu.optionHeight = 16; + sMenu.horizontalCount = horizontalCount; + sMenu.verticalCount = verticalCount; pos = initialCursorPos; - if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos) - gUnknown_0203CD90.cursorPos = 0; + if (pos < 0 || pos > sMenu.maxCursorPos) + sMenu.cursorPos = 0; else - gUnknown_0203CD90.cursorPos = pos; + sMenu.cursorPos = pos; sub_8199134(0, 0); - return gUnknown_0203CD90.cursorPos; + return sMenu.cursorPos; } void clear_scheduled_bg_copies_to_vram(void)