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

View File

@ -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);