Use WINDOW_NONE constant

This commit is contained in:
GriffinR
2021-02-19 18:36:48 -05:00
parent 06ae5a37e2
commit 81a7f491b7
11 changed files with 43 additions and 43 deletions
+3 -3
View File
@@ -1428,7 +1428,7 @@ static u8 sub_81C6D08(u8 windowArrayId)
static u8 sub_81C6D24(u8 windowArrayId) static u8 sub_81C6D24(u8 windowArrayId)
{ {
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId]; u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
if (*windowId == 0xFF) if (*windowId == WINDOW_NONE)
{ {
*windowId = AddWindow(&gUnknown_0861F350[windowArrayId]); *windowId = AddWindow(&gUnknown_0861F350[windowArrayId]);
DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE); DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE);
@@ -1440,13 +1440,13 @@ static u8 sub_81C6D24(u8 windowArrayId)
static void sub_81C6D6C(u8 windowArrayId) static void sub_81C6D6C(u8 windowArrayId)
{ {
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId]; u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
if (*windowId != 0xFF) if (*windowId != WINDOW_NONE)
{ {
ClearStdWindowAndFrameToTransparent(*windowId, FALSE); ClearStdWindowAndFrameToTransparent(*windowId, FALSE);
ClearWindowTilemap(*windowId); ClearWindowTilemap(*windowId);
RemoveWindow(*windowId); RemoveWindow(*windowId);
ScheduleBgCopyTilemapToVram(1); ScheduleBgCopyTilemapToVram(1);
*windowId = 0xFF; *windowId = WINDOW_NONE;
} }
} }
+6 -6
View File
@@ -2390,7 +2390,7 @@ u8 sub_81AE124(u8 which)
u8 BagMenu_AddWindow(u8 which) u8 BagMenu_AddWindow(u8 which)
{ {
u8 *ptr = &gBagMenu->windowPointers[which]; u8 *ptr = &gBagMenu->windowPointers[which];
if (*ptr == 0xFF) if (*ptr == WINDOW_NONE)
{ {
*ptr = AddWindow(&sContextMenuWindowTemplates[which]); *ptr = AddWindow(&sContextMenuWindowTemplates[which]);
DrawStdFrameWithCustomTileAndPalette(*ptr, 0, 1, 14); DrawStdFrameWithCustomTileAndPalette(*ptr, 0, 1, 14);
@@ -2402,20 +2402,20 @@ u8 BagMenu_AddWindow(u8 which)
void BagMenu_RemoveWindow(u8 which) void BagMenu_RemoveWindow(u8 which)
{ {
u8 *ptr = &gBagMenu->windowPointers[which]; u8 *ptr = &gBagMenu->windowPointers[which];
if (*ptr != 0xFF) if (*ptr != WINDOW_NONE)
{ {
ClearStdWindowAndFrameToTransparent(*ptr, FALSE); ClearStdWindowAndFrameToTransparent(*ptr, FALSE);
ClearWindowTilemap(*ptr); ClearWindowTilemap(*ptr);
RemoveWindow(*ptr); RemoveWindow(*ptr);
ScheduleBgCopyTilemapToVram(1); ScheduleBgCopyTilemapToVram(1);
*ptr = 0xFF; *ptr = WINDOW_NONE;
} }
} }
u8 AddItemMessageWindow(u8 which) u8 AddItemMessageWindow(u8 which)
{ {
u8 *ptr = &gBagMenu->windowPointers[which]; u8 *ptr = &gBagMenu->windowPointers[which];
if (*ptr == 0xFF) if (*ptr == WINDOW_NONE)
*ptr = AddWindow(&sContextMenuWindowTemplates[which]); *ptr = AddWindow(&sContextMenuWindowTemplates[which]);
return *ptr; return *ptr;
} }
@@ -2423,14 +2423,14 @@ u8 AddItemMessageWindow(u8 which)
void BagMenu_RemoveBagItemMessageWindow(u8 which) void BagMenu_RemoveBagItemMessageWindow(u8 which)
{ {
u8 *ptr = &gBagMenu->windowPointers[which]; u8 *ptr = &gBagMenu->windowPointers[which];
if (*ptr != 0xFF) if (*ptr != WINDOW_NONE)
{ {
ClearDialogWindowAndFrameToTransparent(*ptr, FALSE); ClearDialogWindowAndFrameToTransparent(*ptr, FALSE);
// This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it. // This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it.
ClearWindowTilemap(*ptr); ClearWindowTilemap(*ptr);
RemoveWindow(*ptr); RemoveWindow(*ptr);
ScheduleBgCopyTilemapToVram(1); ScheduleBgCopyTilemapToVram(1);
*ptr = 0xFF; *ptr = WINDOW_NONE;
} }
} }
+1 -1
View File
@@ -1168,7 +1168,7 @@ static bool32 LoadMatchCallWindowGfx(u8 taskId)
{ {
s16 *taskData = gTasks[taskId].data; s16 *taskData = gTasks[taskId].data;
taskData[2] = AddWindow(&sMatchCallTextWindow); taskData[2] = AddWindow(&sMatchCallTextWindow);
if (taskData[2] == 0xFF) if (taskData[2] == WINDOW_NONE)
{ {
DestroyTask(taskId); DestroyTask(taskId);
return FALSE; return FALSE;
+14 -14
View File
@@ -144,8 +144,8 @@ void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
void InitStandardTextBoxWindows(void) void InitStandardTextBoxWindows(void)
{ {
InitWindows(sStandardTextBox_WindowTemplates); InitWindows(sStandardTextBox_WindowTemplates);
sStartMenuWindowId = 0xFF; sStartMenuWindowId = WINDOW_NONE;
sMapNamePopupWindowId = 0xFF; sMapNamePopupWindowId = WINDOW_NONE;
} }
void FreeAllOverworldWindowBuffers(void) void FreeAllOverworldWindowBuffers(void)
@@ -490,7 +490,7 @@ u8 GetPlayerTextSpeedDelay(void)
u8 sub_81979C4(u8 a1) u8 sub_81979C4(u8 a1)
{ {
if (sStartMenuWindowId == 0xFF) if (sStartMenuWindowId == WINDOW_NONE)
sStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139); sStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139);
return sStartMenuWindowId; return sStartMenuWindowId;
} }
@@ -502,10 +502,10 @@ u8 GetStartMenuWindowId(void)
void RemoveStartMenuWindow(void) void RemoveStartMenuWindow(void)
{ {
if (sStartMenuWindowId != 0xFF) if (sStartMenuWindowId != WINDOW_NONE)
{ {
RemoveWindow(sStartMenuWindowId); RemoveWindow(sStartMenuWindowId);
sStartMenuWindowId = 0xFF; sStartMenuWindowId = WINDOW_NONE;
} }
} }
@@ -521,7 +521,7 @@ u16 sub_8197A38(void)
u8 AddMapNamePopUpWindow(void) u8 AddMapNamePopUpWindow(void)
{ {
if (sMapNamePopupWindowId == 0xFF) if (sMapNamePopupWindowId == WINDOW_NONE)
sMapNamePopupWindowId = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107); sMapNamePopupWindowId = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107);
return sMapNamePopupWindowId; return sMapNamePopupWindowId;
} }
@@ -533,10 +533,10 @@ u8 GetMapNamePopUpWindowId(void)
void RemoveMapNamePopUpWindow(void) void RemoveMapNamePopUpWindow(void)
{ {
if (sMapNamePopupWindowId != 0xFF) if (sMapNamePopupWindowId != WINDOW_NONE)
{ {
RemoveWindow(sMapNamePopupWindowId); RemoveWindow(sMapNamePopupWindowId);
sMapNamePopupWindowId = 0xFF; sMapNamePopupWindowId = WINDOW_NONE;
} }
} }
@@ -815,7 +815,7 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram)
{ {
u16 width = 0; u16 width = 0;
if (sWindowId != 0xFF) if (sWindowId != WINDOW_NONE)
{ {
PutWindowTilemap(sWindowId); PutWindowTilemap(sWindowId);
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
@@ -837,7 +837,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
u8 color[3]; u8 color[3];
u16 width = 0; u16 width = 0;
if (sWindowId != 0xFF) if (sWindowId != WINDOW_NONE)
{ {
if (a3 != 0) if (a3 != 0)
{ {
@@ -872,13 +872,13 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
void sub_81982D8(void) void sub_81982D8(void)
{ {
if (sWindowId != 0xFF) if (sWindowId != WINDOW_NONE)
CopyWindowToVram(sWindowId, 3); CopyWindowToVram(sWindowId, 3);
} }
void sub_81982F0(void) void sub_81982F0(void)
{ {
if (sWindowId != 0xFF) if (sWindowId != WINDOW_NONE)
{ {
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15)); FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
CopyWindowToVram(sWindowId, 3); CopyWindowToVram(sWindowId, 3);
@@ -887,13 +887,13 @@ void sub_81982F0(void)
void sub_8198314(void) void sub_8198314(void)
{ {
if (sWindowId != 0xFF) if (sWindowId != WINDOW_NONE)
{ {
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0)); FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0));
ClearWindowTilemap(sWindowId); ClearWindowTilemap(sWindowId);
CopyWindowToVram(sWindowId, 3); CopyWindowToVram(sWindowId, 3);
RemoveWindow(sWindowId); RemoveWindow(sWindowId);
sWindowId = 0xFF; sWindowId = WINDOW_NONE;
} }
} }
+3 -3
View File
@@ -216,14 +216,14 @@ bool8 sub_81D1C44(u8 count)
return FALSE; return FALSE;
for (i = 0; i < ARRAY_COUNT(sUnknown_0203CF48); i++) for (i = 0; i < ARRAY_COUNT(sUnknown_0203CF48); i++)
sUnknown_0203CF48[i] = 0xFF; sUnknown_0203CF48[i] = WINDOW_NONE;
return TRUE; return TRUE;
} }
u8 sub_81D1C84(u8 a0) u8 sub_81D1C84(u8 a0)
{ {
if (sUnknown_0203CF48[a0] == 0xFF) if (sUnknown_0203CF48[a0] == WINDOW_NONE)
{ {
if (a0 == 2) if (a0 == 2)
{ {
@@ -245,7 +245,7 @@ void sub_81D1D04(u8 a0)
ClearStdWindowAndFrameToTransparent(sUnknown_0203CF48[a0], 0); ClearStdWindowAndFrameToTransparent(sUnknown_0203CF48[a0], 0);
ClearWindowTilemap(sUnknown_0203CF48[a0]); ClearWindowTilemap(sUnknown_0203CF48[a0]);
RemoveWindow(sUnknown_0203CF48[a0]); RemoveWindow(sUnknown_0203CF48[a0]);
sUnknown_0203CF48[a0] = 0xFF; sUnknown_0203CF48[a0] = WINDOW_NONE;
} }
static u8 sub_81D1D34(u8 a0) static u8 sub_81D1D34(u8 a0)
+4 -4
View File
@@ -443,7 +443,7 @@ static void InitPartyMenu(u8 menuType, u8 layout, u8 partyAction, bool8 keepCurs
for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->data); i++) for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->data); i++)
sPartyMenuInternal->data[i] = 0; sPartyMenuInternal->data[i] = 0;
for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->windowId); i++) for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->windowId); i++)
sPartyMenuInternal->windowId[i] = 0xFF; sPartyMenuInternal->windowId[i] = WINDOW_NONE;
if (!keepCursorPos) if (!keepCursorPos)
gPartyMenu.slotId = 0; gPartyMenu.slotId = 0;
@@ -2371,11 +2371,11 @@ static void DisplayPartyPokemonDescriptionText(u8 stringID, struct PartyMenuBox
static void PartyMenuRemoveWindow(u8 *ptr) static void PartyMenuRemoveWindow(u8 *ptr)
{ {
if (*ptr != 0xFF) if (*ptr != WINDOW_NONE)
{ {
ClearStdWindowAndFrameToTransparent(*ptr, 0); ClearStdWindowAndFrameToTransparent(*ptr, 0);
RemoveWindow(*ptr); RemoveWindow(*ptr);
*ptr = 0xFF; *ptr = WINDOW_NONE;
ScheduleBgCopyTilemapToVram(2); ScheduleBgCopyTilemapToVram(2);
} }
} }
@@ -2384,7 +2384,7 @@ void DisplayPartyMenuStdMessage(u32 stringId)
{ {
u8 *windowPtr = &sPartyMenuInternal->windowId[1]; u8 *windowPtr = &sPartyMenuInternal->windowId[1];
if (*windowPtr != 0xFF) if (*windowPtr != WINDOW_NONE)
PartyMenuRemoveWindow(windowPtr); PartyMenuRemoveWindow(windowPtr);
if (stringId != PARTY_MSG_NONE) if (stringId != PARTY_MSG_NONE)
+3 -3
View File
@@ -889,7 +889,7 @@ static void sub_816BC58(void)
static u8 sub_816BC7C(u8 a) static u8 sub_816BC7C(u8 a)
{ {
u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]); u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]);
if (*windowIdLoc == 0xFF) if (*windowIdLoc == WINDOW_NONE)
{ {
*windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]); *windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]);
DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE); DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE);
@@ -901,13 +901,13 @@ static u8 sub_816BC7C(u8 a)
static void sub_816BCC4(u8 a) static void sub_816BCC4(u8 a)
{ {
u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]); u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]);
if (*windowIdLoc != 0xFF) if (*windowIdLoc != WINDOW_NONE)
{ {
ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE); ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE);
ClearWindowTilemap(*windowIdLoc); ClearWindowTilemap(*windowIdLoc);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);
RemoveWindow(*windowIdLoc); RemoveWindow(*windowIdLoc);
*windowIdLoc = 0xFF; *windowIdLoc = WINDOW_NONE;
} }
} }
+5 -5
View File
@@ -2680,7 +2680,7 @@ static void ResetWindows(void)
for (i = 0; i < PSS_LABEL_WINDOW_END; i++) for (i = 0; i < PSS_LABEL_WINDOW_END; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0)); FillWindowPixelBuffer(i, PIXEL_FILL(0));
for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++)
sMonSummaryScreen->windowIds[i] = 0xFF; sMonSummaryScreen->windowIds[i] = WINDOW_NONE;
} }
static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) static void PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId)
@@ -2938,7 +2938,7 @@ static void ClearPageWindowTilemaps(u8 page)
static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId)
{ {
u8 *windowIdPtr = &sMonSummaryScreen->windowIds[templateId]; u8 *windowIdPtr = &sMonSummaryScreen->windowIds[templateId];
if (*windowIdPtr == 0xFF) if (*windowIdPtr == WINDOW_NONE)
{ {
*windowIdPtr = AddWindow(&template[templateId]); *windowIdPtr = AddWindow(&template[templateId]);
FillWindowPixelBuffer(*windowIdPtr, PIXEL_FILL(0)); FillWindowPixelBuffer(*windowIdPtr, PIXEL_FILL(0));
@@ -2949,11 +2949,11 @@ static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 te
static void RemoveWindowByIndex(u8 windowIndex) static void RemoveWindowByIndex(u8 windowIndex)
{ {
u8 *windowIdPtr = &sMonSummaryScreen->windowIds[windowIndex]; u8 *windowIdPtr = &sMonSummaryScreen->windowIds[windowIndex];
if (*windowIdPtr != 0xFF) if (*windowIdPtr != WINDOW_NONE)
{ {
ClearWindowTilemap(*windowIdPtr); ClearWindowTilemap(*windowIdPtr);
RemoveWindow(*windowIdPtr); RemoveWindow(*windowIdPtr);
*windowIdPtr = 0xFF; *windowIdPtr = WINDOW_NONE;
} }
} }
@@ -2962,7 +2962,7 @@ static void PrintPageSpecificText(u8 pageIndex)
u16 i; u16 i;
for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++) for (i = 0; i < ARRAY_COUNT(sMonSummaryScreen->windowIds); i++)
{ {
if (sMonSummaryScreen->windowIds[i] != 0xFF) if (sMonSummaryScreen->windowIds[i] != WINDOW_NONE)
FillWindowPixelBuffer(sMonSummaryScreen->windowIds[i], PIXEL_FILL(0)); FillWindowPixelBuffer(sMonSummaryScreen->windowIds[i], PIXEL_FILL(0));
} }
sTextPrinterFunctions[pageIndex](); sTextPrinterFunctions[pageIndex]();
+1 -1
View File
@@ -987,7 +987,7 @@ bool32 CopyPokenavListMenuTemplate(struct PokenavSub17Substruct *dest, const str
window.baseBlock = a3 + 2; window.baseBlock = a3 + 2;
dest->listWindow.windowId = AddWindow(&window); dest->listWindow.windowId = AddWindow(&window);
if (dest->listWindow.windowId == 0xFF) if (dest->listWindow.windowId == WINDOW_NONE)
return FALSE; return FALSE;
dest->listWindow.unkA = 0; dest->listWindow.unkA = 0;
+1 -1
View File
@@ -613,7 +613,7 @@ static void ClearStarterLabel(void)
FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0)); FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0));
ClearWindowTilemap(sStarterLabelWindowId); ClearWindowTilemap(sStarterLabelWindowId);
RemoveWindow(sStarterLabelWindowId); RemoveWindow(sStarterLabelWindowId);
sStarterLabelWindowId = 0xFF; sStarterLabelWindowId = WINDOW_NONE;
SetGpuReg(REG_OFFSET_WIN0H, 0); SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0); SetGpuReg(REG_OFFSET_WIN0V, 0);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);
+2 -2
View File
@@ -2724,7 +2724,7 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos)
template.paletteNum = 14; template.paletteNum = 14;
template.baseBlock = 0x52; template.baseBlock = 0x52;
sDisplay->yesNoMenuWindowId = AddWindow(&template); sDisplay->yesNoMenuWindowId = AddWindow(&template);
if (sDisplay->yesNoMenuWindowId != 0xFF) if (sDisplay->yesNoMenuWindowId != WINDOW_NONE)
{ {
FillWindowPixelBuffer(sDisplay->yesNoMenuWindowId, PIXEL_FILL(1)); FillWindowPixelBuffer(sDisplay->yesNoMenuWindowId, PIXEL_FILL(1));
PutWindowTilemap(sDisplay->yesNoMenuWindowId); PutWindowTilemap(sDisplay->yesNoMenuWindowId);
@@ -2778,7 +2778,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs)
sDisplay->messageWindowId = AddWindow(&template); sDisplay->messageWindowId = AddWindow(&template);
windowId = sDisplay->messageWindowId; windowId = sDisplay->messageWindowId;
if (sDisplay->messageWindowId == 0xFF) if (sDisplay->messageWindowId == WINDOW_NONE)
return; return;
if (sDisplayStdMessages[msgId].hasPlaceholders) if (sDisplayStdMessages[msgId].hasPlaceholders)