mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-31 08:23:56 +01:00
Use WINDOW_NONE constant
This commit is contained in:
parent
06ae5a37e2
commit
81a7f491b7
@ -1428,7 +1428,7 @@ static u8 sub_81C6D08(u8 windowArrayId)
|
||||
static u8 sub_81C6D24(u8 windowArrayId)
|
||||
{
|
||||
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
|
||||
if (*windowId == 0xFF)
|
||||
if (*windowId == WINDOW_NONE)
|
||||
{
|
||||
*windowId = AddWindow(&gUnknown_0861F350[windowArrayId]);
|
||||
DrawStdFrameWithCustomTileAndPalette(*windowId, FALSE, 1, 0xE);
|
||||
@ -1440,13 +1440,13 @@ static u8 sub_81C6D24(u8 windowArrayId)
|
||||
static void sub_81C6D6C(u8 windowArrayId)
|
||||
{
|
||||
u8 *windowId = &gPyramidBagResources->windowIds[windowArrayId];
|
||||
if (*windowId != 0xFF)
|
||||
if (*windowId != WINDOW_NONE)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(*windowId, FALSE);
|
||||
ClearWindowTilemap(*windowId);
|
||||
RemoveWindow(*windowId);
|
||||
ScheduleBgCopyTilemapToVram(1);
|
||||
*windowId = 0xFF;
|
||||
*windowId = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2390,7 +2390,7 @@ u8 sub_81AE124(u8 which)
|
||||
u8 BagMenu_AddWindow(u8 which)
|
||||
{
|
||||
u8 *ptr = &gBagMenu->windowPointers[which];
|
||||
if (*ptr == 0xFF)
|
||||
if (*ptr == WINDOW_NONE)
|
||||
{
|
||||
*ptr = AddWindow(&sContextMenuWindowTemplates[which]);
|
||||
DrawStdFrameWithCustomTileAndPalette(*ptr, 0, 1, 14);
|
||||
@ -2402,20 +2402,20 @@ u8 BagMenu_AddWindow(u8 which)
|
||||
void BagMenu_RemoveWindow(u8 which)
|
||||
{
|
||||
u8 *ptr = &gBagMenu->windowPointers[which];
|
||||
if (*ptr != 0xFF)
|
||||
if (*ptr != WINDOW_NONE)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(*ptr, FALSE);
|
||||
ClearWindowTilemap(*ptr);
|
||||
RemoveWindow(*ptr);
|
||||
ScheduleBgCopyTilemapToVram(1);
|
||||
*ptr = 0xFF;
|
||||
*ptr = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
u8 AddItemMessageWindow(u8 which)
|
||||
{
|
||||
u8 *ptr = &gBagMenu->windowPointers[which];
|
||||
if (*ptr == 0xFF)
|
||||
if (*ptr == WINDOW_NONE)
|
||||
*ptr = AddWindow(&sContextMenuWindowTemplates[which]);
|
||||
return *ptr;
|
||||
}
|
||||
@ -2423,14 +2423,14 @@ u8 AddItemMessageWindow(u8 which)
|
||||
void BagMenu_RemoveBagItemMessageWindow(u8 which)
|
||||
{
|
||||
u8 *ptr = &gBagMenu->windowPointers[which];
|
||||
if (*ptr != 0xFF)
|
||||
if (*ptr != WINDOW_NONE)
|
||||
{
|
||||
ClearDialogWindowAndFrameToTransparent(*ptr, FALSE);
|
||||
// This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it.
|
||||
ClearWindowTilemap(*ptr);
|
||||
RemoveWindow(*ptr);
|
||||
ScheduleBgCopyTilemapToVram(1);
|
||||
*ptr = 0xFF;
|
||||
*ptr = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1168,7 +1168,7 @@ static bool32 LoadMatchCallWindowGfx(u8 taskId)
|
||||
{
|
||||
s16 *taskData = gTasks[taskId].data;
|
||||
taskData[2] = AddWindow(&sMatchCallTextWindow);
|
||||
if (taskData[2] == 0xFF)
|
||||
if (taskData[2] == WINDOW_NONE)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
return FALSE;
|
||||
|
28
src/menu.c
28
src/menu.c
@ -144,8 +144,8 @@ void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
|
||||
void InitStandardTextBoxWindows(void)
|
||||
{
|
||||
InitWindows(sStandardTextBox_WindowTemplates);
|
||||
sStartMenuWindowId = 0xFF;
|
||||
sMapNamePopupWindowId = 0xFF;
|
||||
sStartMenuWindowId = WINDOW_NONE;
|
||||
sMapNamePopupWindowId = WINDOW_NONE;
|
||||
}
|
||||
|
||||
void FreeAllOverworldWindowBuffers(void)
|
||||
@ -490,7 +490,7 @@ u8 GetPlayerTextSpeedDelay(void)
|
||||
|
||||
u8 sub_81979C4(u8 a1)
|
||||
{
|
||||
if (sStartMenuWindowId == 0xFF)
|
||||
if (sStartMenuWindowId == WINDOW_NONE)
|
||||
sStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139);
|
||||
return sStartMenuWindowId;
|
||||
}
|
||||
@ -502,10 +502,10 @@ u8 GetStartMenuWindowId(void)
|
||||
|
||||
void RemoveStartMenuWindow(void)
|
||||
{
|
||||
if (sStartMenuWindowId != 0xFF)
|
||||
if (sStartMenuWindowId != WINDOW_NONE)
|
||||
{
|
||||
RemoveWindow(sStartMenuWindowId);
|
||||
sStartMenuWindowId = 0xFF;
|
||||
sStartMenuWindowId = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ u16 sub_8197A38(void)
|
||||
|
||||
u8 AddMapNamePopUpWindow(void)
|
||||
{
|
||||
if (sMapNamePopupWindowId == 0xFF)
|
||||
if (sMapNamePopupWindowId == WINDOW_NONE)
|
||||
sMapNamePopupWindowId = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107);
|
||||
return sMapNamePopupWindowId;
|
||||
}
|
||||
@ -533,10 +533,10 @@ u8 GetMapNamePopUpWindowId(void)
|
||||
|
||||
void RemoveMapNamePopUpWindow(void)
|
||||
{
|
||||
if (sMapNamePopupWindowId != 0xFF)
|
||||
if (sMapNamePopupWindowId != WINDOW_NONE)
|
||||
{
|
||||
RemoveWindow(sMapNamePopupWindowId);
|
||||
sMapNamePopupWindowId = 0xFF;
|
||||
sMapNamePopupWindowId = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram)
|
||||
{
|
||||
u16 width = 0;
|
||||
|
||||
if (sWindowId != 0xFF)
|
||||
if (sWindowId != WINDOW_NONE)
|
||||
{
|
||||
PutWindowTilemap(sWindowId);
|
||||
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];
|
||||
u16 width = 0;
|
||||
|
||||
if (sWindowId != 0xFF)
|
||||
if (sWindowId != WINDOW_NONE)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (sWindowId != 0xFF)
|
||||
if (sWindowId != WINDOW_NONE)
|
||||
CopyWindowToVram(sWindowId, 3);
|
||||
}
|
||||
|
||||
void sub_81982F0(void)
|
||||
{
|
||||
if (sWindowId != 0xFF)
|
||||
if (sWindowId != WINDOW_NONE)
|
||||
{
|
||||
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
|
||||
CopyWindowToVram(sWindowId, 3);
|
||||
@ -887,13 +887,13 @@ void sub_81982F0(void)
|
||||
|
||||
void sub_8198314(void)
|
||||
{
|
||||
if (sWindowId != 0xFF)
|
||||
if (sWindowId != WINDOW_NONE)
|
||||
{
|
||||
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0));
|
||||
ClearWindowTilemap(sWindowId);
|
||||
CopyWindowToVram(sWindowId, 3);
|
||||
RemoveWindow(sWindowId);
|
||||
sWindowId = 0xFF;
|
||||
sWindowId = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,14 +216,14 @@ bool8 sub_81D1C44(u8 count)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sUnknown_0203CF48); i++)
|
||||
sUnknown_0203CF48[i] = 0xFF;
|
||||
sUnknown_0203CF48[i] = WINDOW_NONE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u8 sub_81D1C84(u8 a0)
|
||||
{
|
||||
if (sUnknown_0203CF48[a0] == 0xFF)
|
||||
if (sUnknown_0203CF48[a0] == WINDOW_NONE)
|
||||
{
|
||||
if (a0 == 2)
|
||||
{
|
||||
@ -245,7 +245,7 @@ void sub_81D1D04(u8 a0)
|
||||
ClearStdWindowAndFrameToTransparent(sUnknown_0203CF48[a0], 0);
|
||||
ClearWindowTilemap(sUnknown_0203CF48[a0]);
|
||||
RemoveWindow(sUnknown_0203CF48[a0]);
|
||||
sUnknown_0203CF48[a0] = 0xFF;
|
||||
sUnknown_0203CF48[a0] = WINDOW_NONE;
|
||||
}
|
||||
|
||||
static u8 sub_81D1D34(u8 a0)
|
||||
|
@ -443,7 +443,7 @@ static void InitPartyMenu(u8 menuType, u8 layout, u8 partyAction, bool8 keepCurs
|
||||
for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->data); i++)
|
||||
sPartyMenuInternal->data[i] = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(sPartyMenuInternal->windowId); i++)
|
||||
sPartyMenuInternal->windowId[i] = 0xFF;
|
||||
sPartyMenuInternal->windowId[i] = WINDOW_NONE;
|
||||
|
||||
if (!keepCursorPos)
|
||||
gPartyMenu.slotId = 0;
|
||||
@ -2371,11 +2371,11 @@ static void DisplayPartyPokemonDescriptionText(u8 stringID, struct PartyMenuBox
|
||||
|
||||
static void PartyMenuRemoveWindow(u8 *ptr)
|
||||
{
|
||||
if (*ptr != 0xFF)
|
||||
if (*ptr != WINDOW_NONE)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(*ptr, 0);
|
||||
RemoveWindow(*ptr);
|
||||
*ptr = 0xFF;
|
||||
*ptr = WINDOW_NONE;
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
}
|
||||
}
|
||||
@ -2384,7 +2384,7 @@ void DisplayPartyMenuStdMessage(u32 stringId)
|
||||
{
|
||||
u8 *windowPtr = &sPartyMenuInternal->windowId[1];
|
||||
|
||||
if (*windowPtr != 0xFF)
|
||||
if (*windowPtr != WINDOW_NONE)
|
||||
PartyMenuRemoveWindow(windowPtr);
|
||||
|
||||
if (stringId != PARTY_MSG_NONE)
|
||||
|
@ -889,7 +889,7 @@ static void sub_816BC58(void)
|
||||
static u8 sub_816BC7C(u8 a)
|
||||
{
|
||||
u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]);
|
||||
if (*windowIdLoc == 0xFF)
|
||||
if (*windowIdLoc == WINDOW_NONE)
|
||||
{
|
||||
*windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]);
|
||||
DrawStdFrameWithCustomTileAndPalette(*windowIdLoc, FALSE, 0x214, 0xE);
|
||||
@ -901,13 +901,13 @@ static u8 sub_816BC7C(u8 a)
|
||||
static void sub_816BCC4(u8 a)
|
||||
{
|
||||
u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]);
|
||||
if (*windowIdLoc != 0xFF)
|
||||
if (*windowIdLoc != WINDOW_NONE)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(*windowIdLoc, FALSE);
|
||||
ClearWindowTilemap(*windowIdLoc);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
RemoveWindow(*windowIdLoc);
|
||||
*windowIdLoc = 0xFF;
|
||||
*windowIdLoc = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2680,7 +2680,7 @@ static void ResetWindows(void)
|
||||
for (i = 0; i < PSS_LABEL_WINDOW_END; i++)
|
||||
FillWindowPixelBuffer(i, PIXEL_FILL(0));
|
||||
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)
|
||||
@ -2938,7 +2938,7 @@ static void ClearPageWindowTilemaps(u8 page)
|
||||
static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId)
|
||||
{
|
||||
u8 *windowIdPtr = &sMonSummaryScreen->windowIds[templateId];
|
||||
if (*windowIdPtr == 0xFF)
|
||||
if (*windowIdPtr == WINDOW_NONE)
|
||||
{
|
||||
*windowIdPtr = AddWindow(&template[templateId]);
|
||||
FillWindowPixelBuffer(*windowIdPtr, PIXEL_FILL(0));
|
||||
@ -2949,11 +2949,11 @@ static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 te
|
||||
static void RemoveWindowByIndex(u8 windowIndex)
|
||||
{
|
||||
u8 *windowIdPtr = &sMonSummaryScreen->windowIds[windowIndex];
|
||||
if (*windowIdPtr != 0xFF)
|
||||
if (*windowIdPtr != WINDOW_NONE)
|
||||
{
|
||||
ClearWindowTilemap(*windowIdPtr);
|
||||
RemoveWindow(*windowIdPtr);
|
||||
*windowIdPtr = 0xFF;
|
||||
*windowIdPtr = WINDOW_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2962,7 +2962,7 @@ static void PrintPageSpecificText(u8 pageIndex)
|
||||
u16 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));
|
||||
}
|
||||
sTextPrinterFunctions[pageIndex]();
|
||||
|
@ -987,7 +987,7 @@ bool32 CopyPokenavListMenuTemplate(struct PokenavSub17Substruct *dest, const str
|
||||
window.baseBlock = a3 + 2;
|
||||
|
||||
dest->listWindow.windowId = AddWindow(&window);
|
||||
if (dest->listWindow.windowId == 0xFF)
|
||||
if (dest->listWindow.windowId == WINDOW_NONE)
|
||||
return FALSE;
|
||||
|
||||
dest->listWindow.unkA = 0;
|
||||
|
@ -613,7 +613,7 @@ static void ClearStarterLabel(void)
|
||||
FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0));
|
||||
ClearWindowTilemap(sStarterLabelWindowId);
|
||||
RemoveWindow(sStarterLabelWindowId);
|
||||
sStarterLabelWindowId = 0xFF;
|
||||
sStarterLabelWindowId = WINDOW_NONE;
|
||||
SetGpuReg(REG_OFFSET_WIN0H, 0);
|
||||
SetGpuReg(REG_OFFSET_WIN0V, 0);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
|
@ -2724,7 +2724,7 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos)
|
||||
template.paletteNum = 14;
|
||||
template.baseBlock = 0x52;
|
||||
sDisplay->yesNoMenuWindowId = AddWindow(&template);
|
||||
if (sDisplay->yesNoMenuWindowId != 0xFF)
|
||||
if (sDisplay->yesNoMenuWindowId != WINDOW_NONE)
|
||||
{
|
||||
FillWindowPixelBuffer(sDisplay->yesNoMenuWindowId, PIXEL_FILL(1));
|
||||
PutWindowTilemap(sDisplay->yesNoMenuWindowId);
|
||||
@ -2778,7 +2778,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs)
|
||||
|
||||
sDisplay->messageWindowId = AddWindow(&template);
|
||||
windowId = sDisplay->messageWindowId;
|
||||
if (sDisplay->messageWindowId == 0xFF)
|
||||
if (sDisplay->messageWindowId == WINDOW_NONE)
|
||||
return;
|
||||
|
||||
if (sDisplayStdMessages[msgId].hasPlaceholders)
|
||||
|
Loading…
x
Reference in New Issue
Block a user