Use window constants in reset_rtc_screen

This commit is contained in:
GriffinR
2022-09-29 18:29:20 -04:00
parent 7d4fddd56b
commit 77c3163cf0
+16 -11
View File
@@ -49,6 +49,11 @@ enum {
SELECTION_NONE SELECTION_NONE
}; };
enum {
WIN_TIME,
WIN_MSG,
};
struct ResetRtcInputMap struct ResetRtcInputMap
{ {
/*0x0*/ u8 dataIndex; /*0x0*/ u8 dataIndex;
@@ -79,7 +84,7 @@ static const struct BgTemplate sBgTemplates[] =
static const struct WindowTemplate sWindowTemplates[] = static const struct WindowTemplate sWindowTemplates[] =
{ {
{ [WIN_TIME] = {
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 1, .tilemapTop = 1,
@@ -88,7 +93,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 0x155 .baseBlock = 0x155
}, },
{ [WIN_MSG] = {
.bg = 0, .bg = 0,
.tilemapLeft = 2, .tilemapLeft = 2,
.tilemapTop = 15, .tilemapTop = 15,
@@ -562,8 +567,8 @@ static void VBlankCB(void)
static void ShowMessage(const u8 *str) static void ShowMessage(const u8 *str)
{ {
DrawDialogFrameWithCustomTileAndPalette(1, FALSE, 0x200, 0xF); DrawDialogFrameWithCustomTileAndPalette(WIN_MSG, FALSE, 0x200, 0xF);
AddTextPrinterParameterized(1, FONT_NORMAL, str, 0, 1, 0, NULL); AddTextPrinterParameterized(WIN_MSG, FONT_NORMAL, str, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);
} }
@@ -576,11 +581,11 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
switch (tState) switch (tState)
{ {
case 0: 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( PrintTime(
0, WIN_TIME,
0, 0,
17, 17,
gLocalTime.days, gLocalTime.days,
@@ -588,9 +593,9 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
gLocalTime.minutes, gLocalTime.minutes,
gLocalTime.seconds); 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( PrintTime(
0, WIN_TIME,
0, 0,
49, 49,
gSaveBlock2Ptr->lastBerryTreeUpdate.days, gSaveBlock2Ptr->lastBerryTreeUpdate.days,
@@ -599,7 +604,7 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
gSaveBlock2Ptr->lastBerryTreeUpdate.seconds); gSaveBlock2Ptr->lastBerryTreeUpdate.seconds);
ShowMessage(gText_ResetRTCConfirmCancel); ShowMessage(gText_ResetRTCConfirmCancel);
CopyWindowToVram(0, COPYWIN_GFX); CopyWindowToVram(WIN_TIME, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);
tState++; tState++;
case 1: case 1:
@@ -666,7 +671,7 @@ static void Task_ResetRtcScreen(u8 taskId)
// Wait for A or B press on prompt first // Wait for A or B press on prompt first
if (gTasks[tSubTaskId].isActive != TRUE) if (gTasks[tSubTaskId].isActive != TRUE)
{ {
ClearStdWindowAndFrameToTransparent(0, FALSE); ClearStdWindowAndFrameToTransparent(WIN_TIME, FALSE);
ShowMessage(gText_PleaseResetTime); ShowMessage(gText_PleaseResetTime);
gLocalTime = gSaveBlock2Ptr->lastBerryTreeUpdate; gLocalTime = gSaveBlock2Ptr->lastBerryTreeUpdate;
tSubTaskId = CreateTask(Task_ResetRtc_Init, 80); tSubTaskId = CreateTask(Task_ResetRtc_Init, 80);