diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 9327d6cb0e..03faa1a874 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -574,8 +574,6 @@ #define WINOUT_WINOBJ_OBJ (1 << 12) #define WINOUT_WINOBJ_CLR (1 << 13) -#define WINHV_COORDS(m, n) (((m) << 8) | (n)) - // BLDCNT // Bits 0-5 select layers for the 1st target #define BLDCNT_TGT1_BG0 (1 << 0) diff --git a/src/battle_dome.c b/src/battle_dome.c index ff284b564b..0815b6a9b3 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -6024,7 +6024,7 @@ static void HblankCb_BattleDome(void) if (vCount < 50) { REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR; - SET_WIN0H_WIN1H(WINHV_COORDS(152, 155), WINHV_COORDS(85, 88)); + SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88)); return; } else if (vCount > 57) @@ -6032,13 +6032,13 @@ static void HblankCb_BattleDome(void) if (vCount < 75) { REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR; - SET_WIN0H_WIN1H(WINHV_COORDS(144, 152), WINHV_COORDS(88, 96)); + SET_WIN0H_WIN1H(WIN_RANGE(144, 152), WIN_RANGE(88, 96)); return; } else if (vCount < 82) { REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR; - SET_WIN0H_WIN1H(WINHV_COORDS(152, 155), WINHV_COORDS(85, 88)); + SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88)); return; } else if (vCount > 94) @@ -6046,13 +6046,13 @@ static void HblankCb_BattleDome(void) if (vCount < 103) { REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR; - SET_WIN0H_WIN1H(WINHV_COORDS(152, 155), WINHV_COORDS(85, 88)); + SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88)); return; } else if (vCount < 119) { REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR; - SET_WIN0H_WIN1H(WINHV_COORDS(144, 152), WINHV_COORDS(88, 96)); + SET_WIN0H_WIN1H(WIN_RANGE(144, 152), WIN_RANGE(88, 96)); return; } else if (vCount > 126) @@ -6060,7 +6060,7 @@ static void HblankCb_BattleDome(void) if (vCount_ < 135) { REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR; - SET_WIN0H_WIN1H(WINHV_COORDS(152, 155), WINHV_COORDS(85, 88)); + SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88)); return; } } diff --git a/src/main_menu.c b/src/main_menu.c index 3d8d5acc29..314ac272ae 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -131,85 +131,115 @@ const u8 gUnknown_082FEEF0[] = INCBIN_U8("graphics/birch_speech/map.bin.lz"); const u16 gUnknown_082FF018[] = INCBIN_U16("graphics/birch_speech/bg2.gbapal"); const u16 gUnknown_082FF028[] = {0, 0, 0, 0, 0, 0, 0, 0}; -const struct WindowTemplate sWindowTemplates_NoSavedGame[] = +#define MENU_LEFT 2 +#define MENU_TOP_WIN0 1 +#define MENU_TOP_WIN1 5 +#define MENU_TOP_WIN2 1 +#define MENU_TOP_WIN3 9 +#define MENU_TOP_WIN4 13 +#define MENU_TOP_WIN5 17 +#define MENU_TOP_WIN6 21 +#define MENU_WIDTH 26 +#define MENU_HEIGHT_WIN0 2 +#define MENU_HEIGHT_WIN1 2 +#define MENU_HEIGHT_WIN2 6 +#define MENU_HEIGHT_WIN3 2 +#define MENU_HEIGHT_WIN4 2 +#define MENU_HEIGHT_WIN5 2 +#define MENU_HEIGHT_WIN6 2 + +#define MENU_LEFT_ERROR 2 +#define MENU_TOP_ERROR 15 +#define MENU_WIDTH_ERROR 26 +#define MENU_HEIGHT_ERROR 4 + +#define MENU_SHADOW_PADDING 1 + +#define MENU_WIN_HCOORDS WIN_RANGE(((MENU_LEFT - 1) * 8) + MENU_SHADOW_PADDING, (MENU_LEFT + MENU_WIDTH + 1) * 8 - MENU_SHADOW_PADDING) +#define MENU_WIN_VCOORDS(n) WIN_RANGE(((MENU_TOP_WIN##n - 1) * 8) + MENU_SHADOW_PADDING, (MENU_TOP_WIN##n + MENU_HEIGHT_WIN##n + 1) * 8 - MENU_SHADOW_PADDING) +#define MENU_SCROLL_SHIFT WIN_RANGE(32, 32) + +const struct WindowTemplate sWindowTemplates_MainMenu[] = { + // No saved game + // NEW GAME { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 1, - .width = 26, - .height = 2, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN0, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN0, .paletteNum = 15, .baseBlock = 1 }, + // OPTIONS { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 5, - .width = 26, - .height = 2, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN1, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN1, .paletteNum = 15, .baseBlock = 0x35 - } -}; - -const struct WindowTemplate sWindowTemplates_HasSavedGame[] = -{ + }, + // Has saved game + // CONTINUE { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 1, - .width = 26, - .height = 6, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN2, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN2, .paletteNum = 15, .baseBlock = 1 }, + // NEW GAME { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 9, - .width = 26, - .height = 2, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN3, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN3, .paletteNum = 15, .baseBlock = 0x9D }, + // OPTION / MYSTERY GIFT { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 13, - .width = 26, - .height = 2, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN4, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN4, .paletteNum = 15, .baseBlock = 0xD1 }, + // OPTION / MYSTERY EVENTS { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 17, - .width = 26, - .height = 2, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN5, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN5, .paletteNum = 15, .baseBlock = 0x105 }, + // OPTION { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 21, - .width = 26, - .height = 2, + .tilemapLeft = MENU_LEFT, + .tilemapTop = MENU_TOP_WIN6, + .width = MENU_WIDTH, + .height = MENU_HEIGHT_WIN6, .paletteNum = 15, .baseBlock = 0x139 - } -}; - -const struct WindowTemplate sWindowTemplate_ErrorWindow[] = -{ + }, + // Error message window { .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 15, - .width = 26, - .height = 4, + .tilemapLeft = MENU_LEFT_ERROR, + .tilemapTop = MENU_TOP_ERROR, + .width = MENU_WIDTH_ERROR, + .height = MENU_HEIGHT_ERROR, .paletteNum = 15, .baseBlock = 0x16D }, @@ -351,14 +381,14 @@ enum { HAS_NO_SAVED_GAME, //NEW GAME, OPTION HAS_SAVED_GAME, //CONTINUE, NEW GAME, OPTION - HAS_MYSTERY_GIFT, //CONTINUE, NEW GAME, MYSTERY EVENTS, OPTION - HAS_MYSTERY_EVENTS, + HAS_MYSTERY_GIFT, //CONTINUE, NEW GAME, MYSTERY GIFT, OPTION + HAS_MYSTERY_EVENTS, //CONTINUE, NEW GAME, MYSTERY GIFT, MYSTERY EVENTS, OPTION }; enum { ACTION_NEW_GAME, ACTION_CONTINUE, - ACTION_OPTIONS, + ACTION_OPTION, ACTION_MYSTERY_GIFT, ACTION_MYSTERY_EVENTS, ACTION_UNKNOWN, // TODO: change when rom_8011DC0 decompiled @@ -423,12 +453,12 @@ u32 InitMainMenu(bool8 returningFromOptionsMenu) else BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); // fade to white ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_082FF0E8, 2); + InitBgsFromTemplates(0, gUnknown_082FF0E8, ARRAY_COUNT(gUnknown_082FF0E8)); ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); ChangeBgX(1, 0, 0); ChangeBgY(1, 0, 0); - InitWindows(sWindowTemplates_NoSavedGame); + InitWindows(sWindowTemplates_MainMenu); DeactivateAllTextPrinters(); LoadMainMenuWindowFrameTiles(0, MAIN_MENU_BORDER_TILE); @@ -535,7 +565,7 @@ void Task_WaitForSaveFileErrorWindow(u8 taskId) if (!IsTextPrinterActive(7) && (gMain.newKeys & A_BUTTON)) { ClearWindowTilemap(7); - ClearMainMenuWindowTilemap(sWindowTemplate_ErrorWindow); + ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]); gTasks[taskId].func = Task_MainMenuCheckBattery; } } @@ -570,7 +600,7 @@ void Task_WaitForBatteryDryErrorWindow(u8 taskId) if (!IsTextPrinterActive(7) && (gMain.newKeys & A_BUTTON)) { ClearWindowTilemap(7); - ClearMainMenuWindowTilemap(sWindowTemplate_ErrorWindow); + ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]); gTasks[taskId].func = Task_DisplayMainMenu; } } @@ -625,8 +655,8 @@ void Task_DisplayMainMenu(u8 taskId) PutWindowTilemap(1); CopyWindowToVram(0, 2); CopyWindowToVram(1, 2); - DrawMainMenuWindowBorder(&sWindowTemplates_NoSavedGame[0], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_NoSavedGame[1], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[0], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[1], MAIN_MENU_BORDER_TILE); break; case HAS_SAVED_GAME: FillWindowPixelBuffer(2, 0xAA); @@ -642,9 +672,9 @@ void Task_DisplayMainMenu(u8 taskId) CopyWindowToVram(2, 2); CopyWindowToVram(3, 2); CopyWindowToVram(4, 2); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[0], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[1], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[2], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[2], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[3], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[4], MAIN_MENU_BORDER_TILE); break; case HAS_MYSTERY_GIFT: FillWindowPixelBuffer(2, 0xAA); @@ -664,10 +694,10 @@ void Task_DisplayMainMenu(u8 taskId) CopyWindowToVram(3, 2); CopyWindowToVram(4, 2); CopyWindowToVram(5, 2); - DrawMainMenuWindowBorder(sWindowTemplates_HasSavedGame, MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[1], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[2], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[3], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[2], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[3], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[4], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[5], MAIN_MENU_BORDER_TILE); break; case HAS_MYSTERY_EVENTS: FillWindowPixelBuffer(2, 0xAA); @@ -691,11 +721,11 @@ void Task_DisplayMainMenu(u8 taskId) CopyWindowToVram(4, 2); CopyWindowToVram(5, 2); CopyWindowToVram(6, 2); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[0], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[1], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[2], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[3], MAIN_MENU_BORDER_TILE); - DrawMainMenuWindowBorder(&sWindowTemplates_HasSavedGame[4], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[2], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[3], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[4], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[5], MAIN_MENU_BORDER_TILE); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[6], MAIN_MENU_BORDER_TILE); tScrollArrowTaskId = AddScrollIndicatorArrowPair(&sScrollArrowsTemplate_MainMenu, &sCurrItemAndOptionMenuCheck); gTasks[tScrollArrowTaskId].func = Task_ScrollIndicatorArrowPairOnMainMenu; if (sCurrItemAndOptionMenuCheck == 4) @@ -732,8 +762,8 @@ bool8 HandleMainMenuInput(u8 taskId) { PlaySE(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA); - SetGpuReg(REG_OFFSET_WIN0H, 0xF0); - SetGpuReg(REG_OFFSET_WIN0V, 0xA0); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 240)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160)); gTasks[taskId].func = Task_HandleMainMenuBPressed; } else if ((gMain.newKeys & DPAD_UP) && tCurrItem > 0) @@ -798,7 +828,7 @@ void Task_HandleMainMenuAPressed(u8 taskId) action = ACTION_NEW_GAME; break; case 1: - action = ACTION_OPTIONS; + action = ACTION_OPTION; break; } break; @@ -813,7 +843,7 @@ void Task_HandleMainMenuAPressed(u8 taskId) action = ACTION_NEW_GAME; break; case 2: - action = ACTION_OPTIONS; + action = ACTION_OPTION; break; } break; @@ -832,11 +862,11 @@ void Task_HandleMainMenuAPressed(u8 taskId) if (!wirelessAdapterConnected) { action = ACTION_INVALID; - gTasks[taskId].tMenuType = 0; + gTasks[taskId].tMenuType = HAS_NO_SAVED_GAME; } break; case 3: - action = ACTION_OPTIONS; + action = ACTION_OPTION; break; } break; @@ -857,13 +887,13 @@ void Task_HandleMainMenuAPressed(u8 taskId) if (!wirelessAdapterConnected) { action = ACTION_INVALID; - gTasks[taskId].tMenuType = 0; + gTasks[taskId].tMenuType = HAS_NO_SAVED_GAME; } } else if (wirelessAdapterConnected) { action = ACTION_INVALID; - gTasks[taskId].tMenuType = 1; + gTasks[taskId].tMenuType = HAS_SAVED_GAME; } else { @@ -874,7 +904,7 @@ void Task_HandleMainMenuAPressed(u8 taskId) if (wirelessAdapterConnected) { action = ACTION_INVALID; - gTasks[taskId].tMenuType = 2; + gTasks[taskId].tMenuType = HAS_MYSTERY_GIFT; } else { @@ -882,7 +912,7 @@ void Task_HandleMainMenuAPressed(u8 taskId) } break; case 4: - action = ACTION_OPTIONS; + action = ACTION_OPTION; break; } break; @@ -903,7 +933,7 @@ void Task_HandleMainMenuAPressed(u8 taskId) SetMainCallback2(CB2_ContinueSavedGame); DestroyTask(taskId); break; - case ACTION_OPTIONS: + case ACTION_OPTION: gMain.savedCallback = CB2_ReinitMainMenu; SetMainCallback2(CB2_InitOptionMenu); DestroyTask(taskId); @@ -935,7 +965,7 @@ void Task_HandleMainMenuAPressed(u8 taskId) return; } FreeAllWindowBuffers(); - if (action != ACTION_OPTIONS) + if (action != ACTION_OPTION) sCurrItemAndOptionMenuCheck = 0; else sCurrItemAndOptionMenuCheck |= 0x8000; // entering the options menu @@ -1005,7 +1035,7 @@ void Task_DisplayMainMenuInvalidActionError(u8 taskId) void HighlightSelectedMainMenuItem(u8 menuType, u8 selectedMenuItem, s16 isScrolled) { - SetGpuReg(REG_OFFSET_WIN0H, WINHV_COORDS(9, 231)); + SetGpuReg(REG_OFFSET_WIN0H, MENU_WIN_HCOORDS); switch (menuType) { @@ -1015,10 +1045,10 @@ void HighlightSelectedMainMenuItem(u8 menuType, u8 selectedMenuItem, s16 isScrol { case 0: default: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(1, 31)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(0)); break; case 1: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(33, 63)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(1)); break; } break; @@ -1027,13 +1057,13 @@ void HighlightSelectedMainMenuItem(u8 menuType, u8 selectedMenuItem, s16 isScrol { case 0: default: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(1, 63)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(2)); break; case 1: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(65, 95)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(3)); break; case 2: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(97, 127)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(4)); break; } break; @@ -1042,16 +1072,16 @@ void HighlightSelectedMainMenuItem(u8 menuType, u8 selectedMenuItem, s16 isScrol { case 0: default: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(1, 63)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(2)); break; case 1: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(65, 95)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(3)); break; case 2: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(97, 127)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(4)); break; case 3: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(129, 159)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(5)); break; } break; @@ -1060,28 +1090,28 @@ void HighlightSelectedMainMenuItem(u8 menuType, u8 selectedMenuItem, s16 isScrol { case 0: default: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(1, 63)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(2)); break; case 1: if (isScrolled) - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(33, 63)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(3) - MENU_SCROLL_SHIFT); else - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(65, 95)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(3)); break; case 2: if (isScrolled) - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(65, 95)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(4) - MENU_SCROLL_SHIFT); else - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(97, 127)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(4)); break; case 3: if (isScrolled) - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(97, 127)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(5) - MENU_SCROLL_SHIFT); else - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(129, 159)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(5)); break; case 4: - SetGpuReg(REG_OFFSET_WIN0V, WINHV_COORDS(129, 159)); + SetGpuReg(REG_OFFSET_WIN0V, MENU_WIN_VCOORDS(6) - MENU_SCROLL_SHIFT); break; } break; @@ -1915,9 +1945,9 @@ void CreateMainMenuErrorWindow(const u8* str) PrintTextOnWindow(7, 1, str, 0, 1, 2, 0); PutWindowTilemap(7); CopyWindowToVram(7, 2); - DrawMainMenuWindowBorder(sWindowTemplate_ErrorWindow, MAIN_MENU_BORDER_TILE); - SetGpuReg(REG_OFFSET_WIN0H, 0x9E7); - SetGpuReg(REG_OFFSET_WIN0V, 0x719F); + DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[7], MAIN_MENU_BORDER_TILE); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(9, 231)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(113, 159)); } void fmt_savegame(void) diff --git a/tools/gbafix/.gitignore b/tools/gbafix/.gitignore index 23abdd29c6..3cebf8ae8d 100644 --- a/tools/gbafix/.gitignore +++ b/tools/gbafix/.gitignore @@ -1 +1,2 @@ gbafix +README