From d979ac3bf3924051de8bb4154e8398083535eabb Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 11 Feb 2019 00:05:20 -0500 Subject: Document main_menu state machine, name window constants The new names for the constants (and newly named functions) give a much better understanding of what the window system is trying to do. --- src/save_failed_screen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/save_failed_screen.c') diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index c668c1db0..4cd4cd4bf 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -231,8 +231,8 @@ static void CB2_SaveFailedScreen(void) LoadPalette(gUnknown_0860F074, 0xF0, 0x20); SetWindowBorderStyle(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); SetWindowBorderStyle(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); - FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], 0x11); // backwards? - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PIXEL_BUFFER_WHITE); // backwards? + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again? CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); @@ -265,19 +265,19 @@ static void CB2_WipeSave(void) { if (WipeSectors(gDamagedSaveSectors) != FALSE) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); SetMainCallback2(CB2_GameplayCannotBeContinued); return; } - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); SaveFailedScreenTextPrint(gText_CheckCompleted, 1, 0); HandleSavingData(gSaveFailedType); if (gDamagedSaveSectors != 0) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); } @@ -286,12 +286,12 @@ static void CB2_WipeSave(void) if (wipeTries == 3) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); } else { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); if (gGameContinueCallback == NULL) SaveFailedScreenTextPrint(gText_SaveCompleteGameCannotContinue, 1, 0); @@ -308,7 +308,7 @@ static void CB2_GameplayCannotBeContinued(void) if (gMain.newKeys & A_BUTTON) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0); SetVBlankCallback(VBlankCB); SetMainCallback2(CB2_FadeAndReturnToTitleScreen); -- cgit v1.2.3 From c96f8751cddf1a203bd5f310683ea35bf9cb8db2 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 21 Feb 2019 23:27:12 -0500 Subject: Improve window palette macros --- src/save_failed_screen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/save_failed_screen.c') diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 411f3f3d9..62d6f9e3e 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -231,8 +231,8 @@ static void CB2_SaveFailedScreen(void) LoadPalette(gUnknown_0860F074, 0xF0, 0x20); SetWindowBorderStyle(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); SetWindowBorderStyle(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); - FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PIXEL_BUFFER_WHITE); // backwards? - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); // backwards? + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again? CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); @@ -265,19 +265,19 @@ static void CB2_WipeSave(void) { if (WipeSectors(gDamagedSaveSectors) != FALSE) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); SetMainCallback2(CB2_GameplayCannotBeContinued); return; } - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); SaveFailedScreenTextPrint(gText_CheckCompleted, 1, 0); HandleSavingData(gSaveFailedType); if (gDamagedSaveSectors != 0) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); } @@ -286,12 +286,12 @@ static void CB2_WipeSave(void) if (wipeTries == 3) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); } else { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); if (gGameContinueCallback == NULL) SaveFailedScreenTextPrint(gText_SaveCompleteGameCannotContinue, 1, 0); @@ -308,7 +308,7 @@ static void CB2_GameplayCannotBeContinued(void) if (gMain.newKeys & A_BUTTON) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_BUFFER_WHITE); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0); SetVBlankCallback(VBlankCB); SetMainCallback2(CB2_FadeAndReturnToTitleScreen); -- cgit v1.2.3 From 44e92ce2596981c8d42b70922e5ae84d6b321ab1 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Fri, 22 Feb 2019 01:40:11 -0500 Subject: Give window drawing functions better names --- src/save_failed_screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/save_failed_screen.c') diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 62d6f9e3e..1f0fe69c9 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -229,8 +229,8 @@ static void CB2_SaveFailedScreen(void) LoadPalette(sSaveFailedClockPal, 0x100, 0x20); LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20); LoadPalette(gUnknown_0860F074, 0xF0, 0x20); - SetWindowBorderStyle(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); - SetWindowBorderStyle(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); + DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); + DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); // backwards? FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again? -- cgit v1.2.3 From 3716da5430a976d05afecdf82f43f14fc2584949 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 2 Mar 2019 17:25:39 -0500 Subject: Rename macro with correct name for pixel values --- src/save_failed_screen.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/save_failed_screen.c') diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 1f0fe69c9..08f193890 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -231,8 +231,8 @@ static void CB2_SaveFailedScreen(void) LoadPalette(gUnknown_0860F074, 0xF0, 0x20); DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE); DrawStdFrameWithCustomTileAndPalette(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE); - FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); // backwards? - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], PIXEL_FILL(1)); // backwards? + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again? CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); @@ -265,19 +265,19 @@ static void CB2_WipeSave(void) { if (WipeSectors(gDamagedSaveSectors) != FALSE) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); SetMainCallback2(CB2_GameplayCannotBeContinued); return; } - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_CheckCompleted, 1, 0); HandleSavingData(gSaveFailedType); if (gDamagedSaveSectors != 0) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0); } @@ -286,12 +286,12 @@ static void CB2_WipeSave(void) if (wipeTries == 3) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_BackupMemoryDamaged, 1, 0); } else { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); if (gGameContinueCallback == NULL) SaveFailedScreenTextPrint(gText_SaveCompleteGameCannotContinue, 1, 0); @@ -308,7 +308,7 @@ static void CB2_GameplayCannotBeContinued(void) if (gMain.newKeys & A_BUTTON) { - FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PALETTE_NUM_TO_FILL_VALUE(1)); + FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1)); SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0); SetVBlankCallback(VBlankCB); SetMainCallback2(CB2_FadeAndReturnToTitleScreen); -- cgit v1.2.3