From 77c3163cf00b12b1568c69571d135888e3b25946 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 29 Sep 2022 18:29:20 -0400 Subject: [PATCH] Use window constants in reset_rtc_screen --- src/reset_rtc_screen.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/reset_rtc_screen.c b/src/reset_rtc_screen.c index 0a9ec4911..8f8ff6c16 100644 --- a/src/reset_rtc_screen.c +++ b/src/reset_rtc_screen.c @@ -49,6 +49,11 @@ enum { SELECTION_NONE }; +enum { + WIN_TIME, + WIN_MSG, +}; + struct ResetRtcInputMap { /*0x0*/ u8 dataIndex; @@ -79,7 +84,7 @@ static const struct BgTemplate sBgTemplates[] = static const struct WindowTemplate sWindowTemplates[] = { - { + [WIN_TIME] = { .bg = 0, .tilemapLeft = 1, .tilemapTop = 1, @@ -88,7 +93,7 @@ static const struct WindowTemplate sWindowTemplates[] = .paletteNum = 15, .baseBlock = 0x155 }, - { + [WIN_MSG] = { .bg = 0, .tilemapLeft = 2, .tilemapTop = 15, @@ -562,8 +567,8 @@ static void VBlankCB(void) static void ShowMessage(const u8 *str) { - DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF); - AddTextPrinterParameterized(1, FONT_NORMAL, str, 0, 1, 0, NULL); + DrawDialogFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x200, 0xF); + AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, str, 0, 1, 0, NULL); ScheduleBgCopyTilemapToVram(0); } @@ -576,11 +581,11 @@ static void Task_ShowResetRtcPrompt(u8 taskId) switch (tState) { case 0: - DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x214, 0xE); + DrawStdFrameWithCustomTileAndPalette(WIN_TIME, FALSE, 0x214, 0xE); - AddTextPrinterParameterized(0, FONT_NORMAL, gText_PresentTime, 0, 1, TEXT_SKIP_DRAW, 0); + AddTextPrinterParameterized(WIN_TIME, FONT_NORMAL, gText_PresentTime, 0, 1, TEXT_SKIP_DRAW, 0); PrintTime( - 0, + WIN_TIME, 0, 17, gLocalTime.days, @@ -588,9 +593,9 @@ static void Task_ShowResetRtcPrompt(u8 taskId) gLocalTime.minutes, gLocalTime.seconds); - AddTextPrinterParameterized(0, FONT_NORMAL, gText_PreviousTime, 0, 33, TEXT_SKIP_DRAW, 0); + AddTextPrinterParameterized(WIN_TIME, FONT_NORMAL, gText_PreviousTime, 0, 33, TEXT_SKIP_DRAW, 0); PrintTime( - 0, + WIN_TIME, 0, 49, gSaveBlock2Ptr->lastBerryTreeUpdate.days, @@ -599,7 +604,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId) gSaveBlock2Ptr->lastBerryTreeUpdate.seconds); ShowMessage(gText_ResetRTCConfirmCancel); - CopyWindowToVram(0, COPYWIN_GFX); + CopyWindowToVram(WIN_TIME, COPYWIN_GFX); ScheduleBgCopyTilemapToVram(0); tState++; case 1: @@ -666,7 +671,7 @@ static void Task_ResetRtcScreen(u8 taskId) // Wait for A or B press on prompt first if (gTasks[tSubTaskId].isActive != TRUE) { - ClearStdWindowAndFrameToTransparent(0, FALSE); + ClearStdWindowAndFrameToTransparent(WIN_TIME, FALSE); ShowMessage(gText_PleaseResetTime); gLocalTime = gSaveBlock2Ptr->lastBerryTreeUpdate; tSubTaskId = CreateTask(Task_ResetRtc_Init, 80);