diff --git a/src/data/party_menu.h b/src/data/party_menu.h index daf3f4f6c..a4a030e3f 100644 --- a/src/data/party_menu.h +++ b/src/data/party_menu.h @@ -543,7 +543,7 @@ static const struct WindowTemplate sLevelUpStatsWindowTemplate = .baseBlock = 0x2E9, }; -static const struct WindowTemplate sUnusedWindowTemplate_08615978 = +static const struct WindowTemplate sUnusedWindowTemplate1 = { .bg = 2, .tilemapLeft = 2, @@ -554,7 +554,7 @@ static const struct WindowTemplate sUnusedWindowTemplate_08615978 = .baseBlock = 0x1DF, }; -static const struct WindowTemplate sUnusedWindowTemplate_08615980 = +static const struct WindowTemplate sUnusedWindowTemplate2 = { .bg = 2, .tilemapLeft = 0, @@ -669,7 +669,7 @@ static const u8 *const sDescriptionStringTable[] = [PARTYBOX_DESC_DONT_HAVE] = gText_DontHave, }; -static const u16 sUnused_08615B94[] = +static const u16 sUnusedData[] = { 0x0108, 0x0151, 0x0160, 0x015b, 0x002e, 0x005c, 0x0102, 0x0153, 0x014b, 0x00ed, 0x00f1, 0x010d, 0x003a, 0x003b, 0x003f, 0x0071, 0x00b6, 0x00f0, 0x00ca, 0x00db, 0x00da, 0x004c, 0x00e7, 0x0055, 0x0057, 0x0059, 0x00d8, 0x005b, 0x005e, 0x00f7, 0x0118, 0x0068, diff --git a/src/option_menu.c b/src/option_menu.c index 64e9b6576..936aff923 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -75,7 +75,7 @@ static u8 ButtonMode_ProcessInput(u8 selection); static void ButtonMode_DrawChoices(u8 selection); static void DrawTextOption(void); static void DrawOptionMenuTexts(void); -static void sub_80BB154(void); +static void DrawBgWindowFrames(void); EWRAM_DATA static bool8 sArrowPressed = FALSE; @@ -228,7 +228,7 @@ void CB2_InitOptionMenu(void) DrawOptionMenuTexts(); gMain.state++; case 9: - sub_80BB154(); + DrawBgWindowFrames(); gMain.state++; break; case 10: @@ -642,25 +642,37 @@ static void DrawOptionMenuTexts(void) CopyWindowToVram(WIN_OPTIONS, 3); } -static void sub_80BB154(void) +#define TILE_TOP_CORNER_L 0x1A2 +#define TILE_TOP_EDGE 0x1A3 +#define TILE_TOP_CORNER_R 0x1A4 +#define TILE_LEFT_EDGE 0x1A5 +#define TILE_RIGHT_EDGE 0x1A7 +#define TILE_BOT_CORNER_L 0x1A8 +#define TILE_BOT_EDGE 0x1A9 +#define TILE_BOT_CORNER_R 0x1AA + +static void DrawBgWindowFrames(void) { - // bg, tileNum, x, y, width, height, pal - FillBgTilemapBufferRect(1, 0x1A2, 1, 0, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A3, 2, 0, 0x1B, 1, 7); - FillBgTilemapBufferRect(1, 0x1A4, 28, 0, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A5, 1, 1, 1, 2, 7); - FillBgTilemapBufferRect(1, 0x1A7, 28, 1, 1, 2, 7); - FillBgTilemapBufferRect(1, 0x1A8, 1, 3, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A9, 2, 3, 0x1B, 1, 7); - FillBgTilemapBufferRect(1, 0x1AA, 28, 3, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A2, 1, 4, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A3, 2, 4, 0x1A, 1, 7); - FillBgTilemapBufferRect(1, 0x1A4, 28, 4, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A5, 1, 5, 1, 0x12, 7); - FillBgTilemapBufferRect(1, 0x1A7, 28, 5, 1, 0x12, 7); - FillBgTilemapBufferRect(1, 0x1A8, 1, 19, 1, 1, 7); - FillBgTilemapBufferRect(1, 0x1A9, 2, 19, 0x1A, 1, 7); - FillBgTilemapBufferRect(1, 0x1AA, 28, 19, 1, 1, 7); + // bg, tile, x, y, width, height, palNum + // Draw title window frame + FillBgTilemapBufferRect(1, TILE_TOP_CORNER_L, 1, 0, 1, 1, 7); + FillBgTilemapBufferRect(1, TILE_TOP_EDGE, 2, 0, 27, 1, 7); + FillBgTilemapBufferRect(1, TILE_TOP_CORNER_R, 28, 0, 1, 1, 7); + FillBgTilemapBufferRect(1, TILE_LEFT_EDGE, 1, 1, 1, 2, 7); + FillBgTilemapBufferRect(1, TILE_RIGHT_EDGE, 28, 1, 1, 2, 7); + FillBgTilemapBufferRect(1, TILE_BOT_CORNER_L, 1, 3, 1, 1, 7); + FillBgTilemapBufferRect(1, TILE_BOT_EDGE, 2, 3, 27, 1, 7); + FillBgTilemapBufferRect(1, TILE_BOT_CORNER_R, 28, 3, 1, 1, 7); + + // Draw options list window frame + FillBgTilemapBufferRect(1, TILE_TOP_CORNER_L, 1, 4, 1, 1, 7); + FillBgTilemapBufferRect(1, TILE_TOP_EDGE, 2, 4, 26, 1, 7); + FillBgTilemapBufferRect(1, TILE_TOP_CORNER_R, 28, 4, 1, 1, 7); + FillBgTilemapBufferRect(1, TILE_LEFT_EDGE, 1, 5, 1, 18, 7); + FillBgTilemapBufferRect(1, TILE_RIGHT_EDGE, 28, 5, 1, 18, 7); + FillBgTilemapBufferRect(1, TILE_BOT_CORNER_L, 1, 19, 1, 1, 7); + FillBgTilemapBufferRect(1, TILE_BOT_EDGE, 2, 19, 26, 1, 7); + FillBgTilemapBufferRect(1, TILE_BOT_CORNER_R, 28, 19, 1, 1, 7); CopyBgTilemapBufferToVram(1); } diff --git a/src/start_menu.c b/src/start_menu.c index 26a5097a6..2316b85b6 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -170,7 +170,7 @@ static const struct MenuAction sStartMenuItems[] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}} }; -static const struct BgTemplate sUnknown_085105A8[] = +static const struct BgTemplate sBgTemplates_LinkBattleSave[] = { { .bg = 0, @@ -183,13 +183,29 @@ static const struct BgTemplate sUnknown_085105A8[] = } }; -static const struct WindowTemplate sUnknown_085105AC[] = +static const struct WindowTemplate sWindowTemplates_LinkBattleSave[] = { - {0, 2, 0xF, 0x1A, 4, 0xF, 0x194}, + { + .bg = 0, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 26, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x194 + }, DUMMY_WIN_TEMPLATE }; -static const struct WindowTemplate sSaveInfoWindowTemplate = {0, 1, 1, 0xE, 0xA, 0xF, 8}; +static const struct WindowTemplate sSaveInfoWindowTemplate = { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 14, + .height = 10, + .paletteNum = 15, + .baseBlock = 8 +}; // Local functions static void BuildStartMenuActions(void); @@ -211,13 +227,13 @@ static void CreateStartMenuTask(TaskFunc followupFunc); static void InitSave(void); static u8 RunSaveCallback(void); static void ShowSaveMessage(const u8 *message, u8 (*saveCallback)(void)); -static void sub_80A0014(void); +static void HideSaveMessageWindow(void); static void HideSaveInfoWindow(void); static void SaveStartTimer(void); static bool8 SaveSuccesTimer(void); static bool8 SaveErrorTimer(void); static void InitBattlePyramidRetire(void); -static void sub_80A03D8(void); +static void VBlankCB_LinkBattleSave(void); static bool32 InitSaveWindowAfterLinkBattle(u8 *par1); static void CB2_SaveAfterLinkBattle(void); static void ShowSaveInfoWindow(void); @@ -887,7 +903,7 @@ static void SaveGameTask(u8 taskId) EnableBothScriptContexts(); } -static void sub_80A0014(void) +static void HideSaveMessageWindow(void) { ClearDialogWindowAndFrame(0, TRUE); } @@ -982,7 +998,7 @@ static u8 SaveConfirmInputCallback(void) case -1: // B Button case 1: // No HideSaveInfoWindow(); - sub_80A0014(); + HideSaveMessageWindow(); return SAVE_CANCELED; } @@ -1028,7 +1044,7 @@ static u8 SaveOverwriteInputCallback(void) case -1: // B Button case 1: // No HideSaveInfoWindow(); - sub_80A0014(); + HideSaveMessageWindow(); return SAVE_CANCELED; } @@ -1146,14 +1162,14 @@ static u8 BattlePyramidRetireInputCallback(void) return SAVE_CANCELED; case -1: // B Button case 1: // No - sub_80A0014(); + HideSaveMessageWindow(); return SAVE_SUCCESS; } return SAVE_IN_PROGRESS; } -static void sub_80A03D8(void) +static void VBlankCB_LinkBattleSave(void) { TransferPlttBuffer(); } @@ -1167,7 +1183,7 @@ static bool32 InitSaveWindowAfterLinkBattle(u8 *state) SetVBlankCallback(NULL); ScanlineEffect_Stop(); DmaClear16(3, PLTT, PLTT_SIZE); - DmaFillLarge16(3, 0, (void *)(VRAM + 0x0), 0x18000, 0x1000); + DmaFillLarge16(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000); break; case 1: ResetSpriteData(); @@ -1177,15 +1193,15 @@ static bool32 InitSaveWindowAfterLinkBattle(u8 *state) break; case 2: ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, sUnknown_085105A8, ARRAY_COUNT(sUnknown_085105A8)); - InitWindows(sUnknown_085105AC); + InitBgsFromTemplates(0, sBgTemplates_LinkBattleSave, ARRAY_COUNT(sBgTemplates_LinkBattleSave)); + InitWindows(sWindowTemplates_LinkBattleSave); LoadUserWindowBorderGfx_(0, 8, 224); Menu_LoadStdPalAt(240); break; case 3: ShowBg(0); BlendPalettes(-1, 16, 0); - SetVBlankCallback(sub_80A03D8); + SetVBlankCallback(VBlankCB_LinkBattleSave); EnableInterrupts(1); break; case 4: