Use TASK_NONE constant

This commit is contained in:
GriffinR 2021-02-19 23:22:26 -05:00
parent e52b46ab43
commit a5852d57d1
40 changed files with 115 additions and 116 deletions

View File

@ -73,7 +73,7 @@ struct PlayerPCItemPageStruct
u8 pageItems;
u8 count;
u8 filler[3];
u8 scrollIndicatorId;
u8 scrollIndicatorTaskId;
};
// Exported type declarations

View File

@ -3,6 +3,7 @@
#define HEAD_SENTINEL 0xFE
#define TAIL_SENTINEL 0xFF
#define TASK_NONE TAIL_SENTINEL
#define NUM_TASKS 16
#define NUM_TASK_DATA 16

View File

@ -1814,8 +1814,8 @@ void ClearBattleAnimationVars(void)
for (i = 0; i < ANIM_ARGS_COUNT; i++)
gBattleAnimArgs[i] = 0;
sMonAnimTaskIdArray[0] = 0xFF;
sMonAnimTaskIdArray[1] = 0xFF;
sMonAnimTaskIdArray[0] = TASK_NONE;
sMonAnimTaskIdArray[1] = TASK_NONE;
gAnimMoveTurn = 0;
sAnimBackgroundFadeState = 0;
sAnimMoveIndex = 0;
@ -1861,8 +1861,8 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
for (i = 0; i < ANIM_ARGS_COUNT; i++)
gBattleAnimArgs[i] = 0;
sMonAnimTaskIdArray[0] = 0xFF;
sMonAnimTaskIdArray[1] = 0xFF;
sMonAnimTaskIdArray[0] = TASK_NONE;
sMonAnimTaskIdArray[1] = TASK_NONE;
sBattleAnimScriptPtr = animsTable[tableId];
gAnimScriptActive = TRUE;
gAnimFramesToWait = 0;
@ -2106,7 +2106,7 @@ static void ScriptCmd_end(void)
// Keep waiting as long as there are animations to be done.
if (gAnimVisualTaskCount != 0 || gAnimSoundTaskCount != 0
|| sMonAnimTaskIdArray[0] != 0xFF || sMonAnimTaskIdArray[1] != 0xFF)
|| sMonAnimTaskIdArray[0] != TASK_NONE || sMonAnimTaskIdArray[1] != TASK_NONE)
{
sSoundAnimFramesToWait = 0;
gAnimFramesToWait = 1;
@ -2482,9 +2482,9 @@ static void ScriptCmd_clearmonbg(void)
else
battlerId = gBattleAnimTarget;
if (sMonAnimTaskIdArray[0] != 0xFF)
if (sMonAnimTaskIdArray[0] != TASK_NONE)
gSprites[gBattlerSpriteIds[battlerId]].invisible = FALSE;
if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
if (animBattlerId > 1 && sMonAnimTaskIdArray[1] != TASK_NONE)
gSprites[gBattlerSpriteIds[battlerId ^ BIT_FLANK]].invisible = FALSE;
else
animBattlerId = 0;
@ -2508,17 +2508,17 @@ static void sub_80A4980(u8 taskId)
else
to_BG2 = TRUE;
if (sMonAnimTaskIdArray[0] != 0xFF)
if (sMonAnimTaskIdArray[0] != TASK_NONE)
{
sub_80A477C(to_BG2);
DestroyTask(sMonAnimTaskIdArray[0]);
sMonAnimTaskIdArray[0] = 0xFF;
sMonAnimTaskIdArray[0] = TASK_NONE;
}
if (gTasks[taskId].data[0] > 1)
{
sub_80A477C(to_BG2 ^ 1);
DestroyTask(sMonAnimTaskIdArray[1]);
sMonAnimTaskIdArray[1] = 0xFF;
sMonAnimTaskIdArray[1] = TASK_NONE;
}
DestroyTask(taskId);
}

View File

@ -731,7 +731,7 @@ static void AnimRolloutParticle(struct Sprite *sprite)
if (TranslateAnimHorizontalArc(sprite))
{
u8 taskId = FindTaskIdByFunc(AnimTask_Rollout_Step);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
gTasks[taskId].data[11]--;
DestroySprite(sprite);

View File

@ -1260,14 +1260,14 @@ static void AnimTask_WaterSpoutRain_Step(u8 taskId)
gBattleAnimArgs[1] = 0;
gBattleAnimArgs[2] = 12;
taskId2 = CreateTask(AnimTask_HorizontalShake, 80);
if (taskId2 != 0xFF)
if (taskId2 != TASK_NONE)
{
gTasks[taskId2].func(taskId2);
gAnimVisualTaskCount++;
}
gBattleAnimArgs[0] = ANIM_DEF_PARTNER;
taskId2 = CreateTask(AnimTask_HorizontalShake, 80);
if (taskId2 != 0xFF)
if (taskId2 != TASK_NONE)
{
gTasks[taskId2].func(taskId2);
gAnimVisualTaskCount++;

View File

@ -1235,7 +1235,7 @@ static void StartStatusInflictionScreenFlash(s16 fadeOutDelay, s16 fadeInDelay,
static bool8 IsStatusInflictionScreenFlashTaskFinished(void)
{
if (FindTaskIdByFunc(DoStatusInflictionScreenFlash) == 0xFF)
if (FindTaskIdByFunc(DoStatusInflictionScreenFlash) == TASK_NONE)
return TRUE;
else
return FALSE;

View File

@ -389,10 +389,10 @@ void GoToBattlePyramidBagMenu(u8 a0, void (*callback)(void))
gPyramidBagResources->callback2 = NULL;
gPyramidBagResources->unk814 = 0xFF;
gPyramidBagResources->scrollIndicatorsTaskId = 0xFF;
gPyramidBagResources->scrollIndicatorsTaskId = TASK_NONE;
memset(gPyramidBagResources->itemsSpriteIds, 0xFF, sizeof(gPyramidBagResources->itemsSpriteIds));
memset(gPyramidBagResources->windowIds, 0xFF, sizeof(gPyramidBagResources->windowIds));
memset(gPyramidBagResources->windowIds, WINDOW_NONE, sizeof(gPyramidBagResources->windowIds));
SetMainCallback2(sub_81C504C);
}
@ -657,16 +657,16 @@ static void PrintItemDescription(s32 listMenuId)
static void AddScrollArrow(void)
{
if (gPyramidBagResources->scrollIndicatorsTaskId == 0xFF)
if (gPyramidBagResources->scrollIndicatorsTaskId == TASK_NONE)
gPyramidBagResources->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(2, 172, 12, 148, gPyramidBagResources->listMenuCount - gPyramidBagResources->listMenuMaxShown, 0xB5E, 0xB5E, &gPyramidBagCursorData.scrollPosition);
}
static void RemoveScrollArrow(void)
{
if (gPyramidBagResources->scrollIndicatorsTaskId != 0xFF)
if (gPyramidBagResources->scrollIndicatorsTaskId != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(gPyramidBagResources->scrollIndicatorsTaskId);
gPyramidBagResources->scrollIndicatorsTaskId = 0xFF;
gPyramidBagResources->scrollIndicatorsTaskId = TASK_NONE;
}
}

View File

@ -991,7 +991,7 @@ static bool8 Transition_Phase1(struct Task *task)
static bool8 Transition_WaitForPhase1(struct Task *task)
{
if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == 0xFF)
if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == TASK_NONE)
{
task->tState++;
return TRUE;
@ -1012,7 +1012,7 @@ static bool8 Transition_Phase2(struct Task *task)
static bool8 Transition_WaitForPhase2(struct Task *task)
{
task->tTransitionDone = FALSE;
if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == 0xFF)
if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == TASK_NONE)
task->tTransitionDone = TRUE;
return FALSE;
}
@ -3612,7 +3612,7 @@ static void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4)
static bool8 IsPhase1Done(void)
{
if (FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == 0xFF)
if (FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == TASK_NONE)
return TRUE;
else
return FALSE;

View File

@ -82,7 +82,7 @@ static void Task_ReestablishLinkAwaitConfirmation(u8 taskId);
static void CreateLinkupTask(u8 minPlayers, u8 maxPlayers)
{
if (FindTaskIdByFunc(Task_LinkupStart) == 0xFF)
if (FindTaskIdByFunc(Task_LinkupStart) == TASK_NONE)
{
u8 taskId1;
@ -627,7 +627,7 @@ void ValidateMixingGameLanguage(void)
{
u32 taskId = FindTaskIdByFunc(Task_ValidateMixingGameLanguage);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
{
taskId = CreateTask(Task_ValidateMixingGameLanguage, 80);
gTasks[taskId].tState = 0;

View File

@ -2535,7 +2535,7 @@ void ShowContestEntryMonPic(void)
u8 taskId;
u8 left, top;
if (FindTaskIdByFunc(Task_ShowContestEntryMonPic) == 0xFF)
if (FindTaskIdByFunc(Task_ShowContestEntryMonPic) == TASK_NONE)
{
AllocateMonSpritesGfx();
left = 10;
@ -2578,7 +2578,7 @@ void ShowContestEntryMonPic(void)
void HideContestEntryMonPic(void)
{
u8 taskId = FindTaskIdByFunc(Task_ShowContestEntryMonPic);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
{
gTasks[taskId].data[0]++;
FreeMonSpritesGfx();

View File

@ -925,7 +925,7 @@ static void DecorationItemsMenu_PrintDecorationInUse(u8 windowId, s32 itemIndex,
static void AddDecorationItemsScrollIndicators(void)
{
if (sDecorationItemsMenu->scrollIndicatorsTaskId == 0xFF)
if (sDecorationItemsMenu->scrollIndicatorsTaskId == TASK_NONE)
{
sDecorationItemsMenu->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(
SCROLL_ARROW_UP,
@ -941,10 +941,10 @@ static void AddDecorationItemsScrollIndicators(void)
static void RemoveDecorationItemsScrollIndicators(void)
{
if (sDecorationItemsMenu->scrollIndicatorsTaskId != 0xFF)
if (sDecorationItemsMenu->scrollIndicatorsTaskId != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(sDecorationItemsMenu->scrollIndicatorsTaskId);
sDecorationItemsMenu->scrollIndicatorsTaskId = 0xFF;
sDecorationItemsMenu->scrollIndicatorsTaskId = TASK_NONE;
}
}
@ -960,7 +960,7 @@ static void InitDecorationItemsWindow(u8 taskId)
AddDecorationWindow(WINDOW_DECORATION_CATEGORY_ITEMS);
ShowDecorationCategorySummaryWindow(sCurDecorationCategory);
sDecorationItemsMenu = AllocZeroed(sizeof(*sDecorationItemsMenu));
sDecorationItemsMenu->scrollIndicatorsTaskId = 0xFF;
sDecorationItemsMenu->scrollIndicatorsTaskId = TASK_NONE;
InitDecorationItemsMenuLimits();
InitDecorationItemsMenuScrollAndCursor();
InitDecorationItemsMenuScrollAndCursor2();

View File

@ -1646,7 +1646,7 @@ static void PauseBgPaletteAnim(void)
{
u8 taskId = FindTaskIdByFunc(Task_UpdateBgPalette);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
gTasks[taskId].tPaused = TRUE;
FillPalette(0, 0xA0, 0x20);
@ -1658,9 +1658,9 @@ static void StopBgAnimation(void)
{
u8 taskId;
if ((taskId = FindTaskIdByFunc(Task_UpdateBgPalette)) != 0xFF)
if ((taskId = FindTaskIdByFunc(Task_UpdateBgPalette)) != TASK_NONE)
DestroyTask(taskId);
if ((taskId = FindTaskIdByFunc(Task_AnimateBg)) != 0xFF)
if ((taskId = FindTaskIdByFunc(Task_AnimateBg)) != TASK_NONE)
DestroyTask(taskId);
FillPalette(0, 0xA0, 0x20);

View File

@ -55,7 +55,7 @@ static void CreateTask_DrawFieldMessage(void)
static void DestroyTask_DrawFieldMessage(void)
{
u8 taskId = FindTaskIdByFunc(Task_DrawFieldMessage);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
DestroyTask(taskId);
}

View File

@ -2667,7 +2667,7 @@ static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct
u8 taskId;
PlaySE(SE_SELECT);
taskId = FindTaskIdByFunc(ScrollableMultichoice_ProcessInput);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
{
u16 selection;
struct Task *task = &gTasks[taskId];
@ -2753,7 +2753,7 @@ static void sub_813A600(u8 taskId)
void sub_813A630(void)
{
u8 taskId = FindTaskIdByFunc(sub_813A600);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
{
EnableBothScriptContexts();
}
@ -3262,7 +3262,7 @@ void sub_813ADD4(void)
u16 scrollOffset, selectedRow;
u8 i;
u8 taskId = FindTaskIdByFunc(sub_813A600);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
{
struct Task *task = &gTasks[taskId];
ListMenuGetScrollAndRow(task->tListTaskId, &scrollOffset, &selectedRow);
@ -3321,7 +3321,7 @@ void GetBattleFrontierTutorMoveIndex(void)
void sub_813AF48(void)
{
u8 taskId = FindTaskIdByFunc(sub_813A600);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
{
struct Task *task = &gTasks[taskId];
DestroyListMenuTask(task->tListTaskId, NULL, NULL);

View File

@ -174,7 +174,7 @@ void SetUpFieldTasks(void)
void ActivatePerStepCallback(u8 callbackId)
{
u8 taskId = FindTaskIdByFunc(Task_RunPerStepCallback);
if (taskId != 0xff)
if (taskId != TASK_NONE)
{
s32 i;
s16 *data = gTasks[taskId].data;
@ -199,12 +199,12 @@ void ResetFieldTasksArgs(void)
s16 *data;
taskId = FindTaskIdByFunc(Task_RunPerStepCallback);
if (taskId != 0xff)
if (taskId != TASK_NONE)
{
data = gTasks[taskId].data;
}
taskId = FindTaskIdByFunc(Task_RunTimeBasedEvents);
if (taskId != 0xff)
if (taskId != TASK_NONE)
{
data = gTasks[taskId].data;
data[1] = 0;

View File

@ -1433,7 +1433,7 @@ void DoDomeConfetti(void)
gSpecialVar_0x8004 = 180;
taskId = CreateTask(Task_DoDomeConfetti, 0);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
{
gTasks[taskId].tTimer = gSpecialVar_0x8004;
gSpecialVar_0x8005 = taskId;
@ -1444,7 +1444,7 @@ static void StopDomeConfetti(void)
{
u8 taskId;
if ((taskId = FindTaskIdByFunc(Task_DoDomeConfetti)) != 0xFF)
if ((taskId = FindTaskIdByFunc(Task_DoDomeConfetti)) != TASK_NONE)
DestroyTask(taskId);
ConfettiUtil_Free();

View File

@ -594,8 +594,8 @@ void GoToBagMenu(u8 location, u8 pocket, void ( *postExitMenuMainCallback2)())
gBagMenu->pocketSwitchDisabled = TRUE;
gBagMenu->exitCallback = NULL;
gBagMenu->itemOriginalLocation = 0xFF;
gBagMenu->pocketScrollArrowsTask = 0xFF;
gBagMenu->pocketSwitchArrowsTask = 0xFF;
gBagMenu->pocketScrollArrowsTask = TASK_NONE;
gBagMenu->pocketSwitchArrowsTask = TASK_NONE;
memset(gBagMenu->spriteId, 0xFF, sizeof(gBagMenu->spriteId));
memset(gBagMenu->windowPointers, 0xFF, 10);
SetMainCallback2(CB2_Bag);
@ -971,7 +971,7 @@ void BagMenu_PrintCursor(u8 y, u8 colorIndex)
void CreatePocketScrollArrowPair(void)
{
if (gBagMenu->pocketScrollArrowsTask == 0xFF)
if (gBagMenu->pocketScrollArrowsTask == TASK_NONE)
gBagMenu->pocketScrollArrowsTask = AddScrollIndicatorArrowPairParameterized(
SCROLL_ARROW_UP,
172,
@ -985,26 +985,26 @@ void CreatePocketScrollArrowPair(void)
void BagDestroyPocketScrollArrowPair(void)
{
if (gBagMenu->pocketScrollArrowsTask != 0xFF)
if (gBagMenu->pocketScrollArrowsTask != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(gBagMenu->pocketScrollArrowsTask);
gBagMenu->pocketScrollArrowsTask = 0xFF;
gBagMenu->pocketScrollArrowsTask = TASK_NONE;
}
BagDestroyPocketSwitchArrowPair();
}
void CreatePocketSwitchArrowPair(void)
{
if (gBagMenu->pocketSwitchDisabled != TRUE && gBagMenu->pocketSwitchArrowsTask == 0xFF)
if (gBagMenu->pocketSwitchDisabled != TRUE && gBagMenu->pocketSwitchArrowsTask == TASK_NONE)
gBagMenu->pocketSwitchArrowsTask = AddScrollIndicatorArrowPair(&sBagScrollArrowsTemplate, &gBagPositionStruct.unk6);
}
void BagDestroyPocketSwitchArrowPair(void)
{
if (gBagMenu->pocketSwitchArrowsTask != 0xFF)
if (gBagMenu->pocketSwitchArrowsTask != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(gBagMenu->pocketSwitchArrowsTask);
gBagMenu->pocketSwitchArrowsTask = 0xFF;
gBagMenu->pocketSwitchArrowsTask = TASK_NONE;
}
}

View File

@ -2643,7 +2643,7 @@ static void sub_8011E2C(u8 taskId)
static void sub_8011E94(u32 a0, u32 a1)
{
u8 taskId = FindTaskIdByFunc(sub_8011E2C);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
{
taskId = CreateTask(sub_8011E2C, 5);
gTasks[taskId].data[0] = a0;
@ -2792,12 +2792,12 @@ void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 activity)
taskId2 = FindTaskIdByFunc(Task_LinkRfu_UnionRoomListen);
if (activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
{
if (taskId2 != 0xFF)
if (taskId2 != TASK_NONE)
gTasks[taskId2].data[7] = 1;
}
else
{
if (taskId2 != 0xFF)
if (taskId2 != TASK_NONE)
gTasks[taskId2].data[7] = 0;
}
}

View File

@ -467,8 +467,6 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
}
}
#define TASK_NONE 0xFF
void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;

View File

@ -310,7 +310,7 @@ static void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list)
void sub_81D1E90(struct PlayerPCItemPageStruct *page)
{
page->scrollIndicatorId = AddScrollIndicatorArrowPairParameterized(2, 0xC8, 12, 0x94, page->count - page->pageItems + 1, 0x6E, 0x6E, &page->itemsAbove);
page->scrollIndicatorTaskId = AddScrollIndicatorArrowPairParameterized(2, 0xC8, 12, 0x94, page->count - page->pageItems + 1, 0x6E, 0x6E, &page->itemsAbove);
}
void sub_81D1EC0(void)

View File

@ -125,7 +125,7 @@ static u32 sub_802E63C(u8 funcSetId, u8 taskPriority)
static bool32 sub_802E688(void)
{
u8 taskId = FindTaskIdByFunc(sub_802E6D0);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
return FALSE;
gTasks[taskId].data[0] = 2;

View File

@ -398,7 +398,7 @@ static void DoScreenShake(u8 taskId)
static void IncrementCeilingCrumbleFinishedCount(void)
{
u8 taskId = FindTaskIdByFunc(WaitCeilingCrumble);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
gTasks[taskId].data[0]++;
}
@ -610,7 +610,7 @@ static void DoMirageTowerDisintegration(u8 taskId)
case 4:
UnsetBgTilemapBuffer(0);
bgShakeTaskId = FindTaskIdByFunc(UpdateBgShake);
if (bgShakeTaskId != 0xFF)
if (bgShakeTaskId != TASK_NONE)
DestroyTask(bgShakeTaskId);
sBgShakeOffsets->bgVOFS = sBgShakeOffsets->bgHOFS = 0;
SetBgShakeOffsets();

View File

@ -844,8 +844,8 @@ static void CreateUISprites(void)
{
int i;
sMoveRelearnerStruct->moveDisplayArrowTask = 0xFF;
sMoveRelearnerStruct->moveListScrollArrowTask = 0xFF;
sMoveRelearnerStruct->moveDisplayArrowTask = TASK_NONE;
sMoveRelearnerStruct->moveListScrollArrowTask = TASK_NONE;
AddScrollArrows();
// These are the appeal hearts.
@ -870,12 +870,12 @@ static void CreateUISprites(void)
static void AddScrollArrows(void)
{
if (sMoveRelearnerStruct->moveDisplayArrowTask == 0xFF)
if (sMoveRelearnerStruct->moveDisplayArrowTask == TASK_NONE)
{
sMoveRelearnerStruct->moveDisplayArrowTask = AddScrollIndicatorArrowPair(&sDisplayModeArrowsTemplate, &sMoveRelearnerStruct->scrollOffset);
}
if (sMoveRelearnerStruct->moveListScrollArrowTask == 0xFF)
if (sMoveRelearnerStruct->moveListScrollArrowTask == TASK_NONE)
{
gTempScrollArrowTemplate = sMoveListScrollArrowsTemplate;
gTempScrollArrowTemplate.fullyDownThreshold = sMoveRelearnerStruct->numMenuChoices - sMoveRelearnerStruct->numToShowAtOnce;
@ -885,16 +885,16 @@ static void AddScrollArrows(void)
static void RemoveScrollArrows(void)
{
if (sMoveRelearnerStruct->moveDisplayArrowTask != 0xFF)
if (sMoveRelearnerStruct->moveDisplayArrowTask != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(sMoveRelearnerStruct->moveDisplayArrowTask);
sMoveRelearnerStruct->moveDisplayArrowTask = 0xFF;
sMoveRelearnerStruct->moveDisplayArrowTask = TASK_NONE;
}
if (sMoveRelearnerStruct->moveListScrollArrowTask != 0xFF)
if (sMoveRelearnerStruct->moveListScrollArrowTask != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(sMoveRelearnerStruct->moveListScrollArrowTask);
sMoveRelearnerStruct->moveListScrollArrowTask = 0xFF;
sMoveRelearnerStruct->moveListScrollArrowTask = TASK_NONE;
}
}

View File

@ -826,7 +826,7 @@ static void Task_HandlePageSwapAnim(u8 taskId)
static bool8 IsPageSwapAnimNotInProgress(void)
{
if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == 0xFF)
if (FindTaskIdByFunc(Task_HandlePageSwapAnim) == TASK_NONE)
return TRUE;
else
return FALSE;

View File

@ -1002,7 +1002,7 @@ static void DestroyBlendPalettesGraduallyTask(void)
while (1)
{
taskId = FindTaskIdByFunc(Task_BlendPalettesGradually);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
break;
DestroyTask(taskId);
}

View File

@ -398,7 +398,7 @@ static void PlayerPC_Mailbox(u8 taskId)
{
playerPCItemPageInfo.cursorPos = 0;
playerPCItemPageInfo.itemsAbove = 0;
playerPCItemPageInfo.scrollIndicatorId = 0xFF;
playerPCItemPageInfo.scrollIndicatorTaskId = TASK_NONE;
Mailbox_UpdateMailList();
ItemStorage_SetItemAndMailCount(taskId);
if (sub_81D1C44(playerPCItemPageInfo.count) == TRUE)
@ -554,7 +554,7 @@ static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss)
sub_816B4DC(taskId);
playerPCItemPageInfo.cursorPos = 0;
playerPCItemPageInfo.itemsAbove = 0;
playerPCItemPageInfo.scrollIndicatorId = 0xFF;
playerPCItemPageInfo.scrollIndicatorTaskId = TASK_NONE;
ItemStorage_SetItemAndMailCount(taskId);
sub_816BC14();
FreeAndReserveObjectSpritePalettes();
@ -647,7 +647,7 @@ static void Mailbox_ProcessInput(u8 taskId)
break;
case LIST_CANCEL:
PlaySE(SE_SELECT);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorTaskId);
Mailbox_ReturnToPlayerPC(taskId);
break;
default:
@ -656,7 +656,7 @@ static void Mailbox_ProcessInput(u8 taskId)
sub_81D1D04(1);
DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ScheduleBgCopyTilemapToVram(0);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorTaskId);
gTasks[taskId].func = Mailbox_PrintWhatToDoWithPlayerMailText;
break;
}
@ -983,16 +983,16 @@ static void sub_816BEF0(s32 id)
static void ItemStorage_StartScrollIndicator(void)
{
if (playerPCItemPageInfo.scrollIndicatorId == 0xFF)
playerPCItemPageInfo.scrollIndicatorId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xB0, 0xC, 0x94, playerPCItemPageInfo.count - playerPCItemPageInfo.pageItems, 0x13F8, 0x13F8, &(playerPCItemPageInfo.itemsAbove));
if (playerPCItemPageInfo.scrollIndicatorTaskId == TASK_NONE)
playerPCItemPageInfo.scrollIndicatorTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xB0, 0xC, 0x94, playerPCItemPageInfo.count - playerPCItemPageInfo.pageItems, 0x13F8, 0x13F8, &(playerPCItemPageInfo.itemsAbove));
}
static void ItemStorage_RemoveScrollIndicator(void)
{
if (playerPCItemPageInfo.scrollIndicatorId != 0xFF)
if (playerPCItemPageInfo.scrollIndicatorTaskId != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId);
playerPCItemPageInfo.scrollIndicatorId = 0xFF;
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorTaskId);
playerPCItemPageInfo.scrollIndicatorTaskId = TASK_NONE;
}
}

View File

@ -432,7 +432,7 @@ void OpenPokeblockCase(u8 caseId, void (*callback)(void))
sPokeblockMenu = Alloc(sizeof(*sPokeblockMenu));
sPokeblockMenu->caseId = caseId;
sPokeblockMenu->callbackOnUse = NULL;
sPokeblockMenu->unkTaskId = 0xFF;
sPokeblockMenu->unkTaskId = TASK_NONE;
sPokeblockMenu->isSwapping = FALSE;
sSavedPokeblockData.callback = callback;
@ -898,7 +898,7 @@ static void sub_8136344(void)
static void sub_81363BC(void)
{
if (sPokeblockMenu->unkTaskId == 0xFF)
if (sPokeblockMenu->unkTaskId == TASK_NONE)
{
sPokeblockMenu->unkTaskId = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xB0, 8, 0x98, sPokeblockMenu->itemsNo - sPokeblockMenu->maxShowed,
0x456, 0x456, &sSavedPokeblockData.lastItemPage);
@ -907,10 +907,10 @@ static void sub_81363BC(void)
static void sub_8136418(void)
{
if (sPokeblockMenu->unkTaskId != 0xFF)
if (sPokeblockMenu->unkTaskId != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(sPokeblockMenu->unkTaskId);
sPokeblockMenu->unkTaskId = 0xFF;
sPokeblockMenu->unkTaskId = TASK_NONE;
}
}

View File

@ -6706,7 +6706,7 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF
void StopPokemonAnimationDelayTask(void)
{
u8 delayTaskId = FindTaskIdByFunc(Task_PokemonSummaryAnimateAfterDelay);
if (delayTaskId != 0xFF)
if (delayTaskId != TASK_NONE)
DestroyTask(delayTaskId);
}

View File

@ -2401,7 +2401,7 @@ static void HandlePowerAccTilemap(u16 a, s16 b)
else
{
u8 taskId = FindTaskIdByFunc(Task_ShowPowerAccWindow);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
taskId = CreateTask(Task_ShowPowerAccWindow, 8);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
@ -2453,7 +2453,7 @@ static void HandleAppealJamTilemap(u16 a, s16 b, u16 move)
else
{
u8 taskId = FindTaskIdByFunc(Task_ShowAppealJamWindow);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
taskId = CreateTask(Task_ShowAppealJamWindow, 8);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
@ -3940,10 +3940,10 @@ void SummaryScreen_SetUnknownTaskId(u8 taskId)
void SummaryScreen_DestroyUnknownTask(void)
{
if (sUnknownTaskId != 0xFF)
if (sUnknownTaskId != TASK_NONE)
{
DestroyTask(sUnknownTaskId);
sUnknownTaskId = 0xFF;
sUnknownTaskId = TASK_NONE;
}
}

View File

@ -890,7 +890,7 @@ static void sub_81CBC1C(void)
static void sub_81CBC38(int arg0)
{
u8 taskId = FindTaskIdByFunc(sub_81CBC64);
if (taskId != 0xFF)
if (taskId != TASK_NONE)
gTasks[taskId].data[15] = arg0;
}

View File

@ -22,10 +22,10 @@ void ScanlineEffect_Stop(void)
{
gScanlineEffect.state = 0;
DmaStop(0);
if (gScanlineEffect.waveTaskId != 0xFF)
if (gScanlineEffect.waveTaskId != TASK_NONE)
{
DestroyTask(gScanlineEffect.waveTaskId);
gScanlineEffect.waveTaskId = 0xFF;
gScanlineEffect.waveTaskId = TASK_NONE;
}
}
@ -40,7 +40,7 @@ void ScanlineEffect_Clear(void)
gScanlineEffect.state = 0;
gScanlineEffect.unused16 = 0;
gScanlineEffect.unused17 = 0;
gScanlineEffect.waveTaskId = 0xFF;
gScanlineEffect.waveTaskId = TASK_NONE;
}
void ScanlineEffect_SetParams(struct ScanlineEffectParams params)
@ -132,7 +132,7 @@ static void TaskFunc_UpdateWavePerFrame(u8 taskId)
if (sShouldStopWaveTask)
{
DestroyTask(taskId);
gScanlineEffect.waveTaskId = 0xFF;
gScanlineEffect.waveTaskId = TASK_NONE;
}
else
{

View File

@ -580,7 +580,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 species, u8 x, u8 y)
u8 taskId;
u8 spriteId;
if (FindTaskIdByFunc(Task_PokemonPicWindow) != 0xFF)
if (FindTaskIdByFunc(Task_PokemonPicWindow) != TASK_NONE)
{
return FALSE;
}
@ -604,7 +604,7 @@ bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void)
{
u8 taskId = FindTaskIdByFunc(Task_PokemonPicWindow);
if (taskId == 0xFF)
if (taskId == TASK_NONE)
return NULL;
gTasks[taskId].tState++;
return IsPicboxClosed;
@ -612,7 +612,7 @@ bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void)
static bool8 IsPicboxClosed(void)
{
if (FindTaskIdByFunc(Task_PokemonPicWindow) == 0xFF)
if (FindTaskIdByFunc(Task_PokemonPicWindow) == TASK_NONE)
return TRUE;
else
return FALSE;

View File

@ -52,7 +52,7 @@ void ScriptMovement_UnfreezeObjectEvents(void)
u8 taskId;
taskId = GetMoveObjectsTaskId();
if (taskId != 0xFF)
if (taskId != TASK_NONE)
{
ScriptMovement_UnfreezeActiveObjects(taskId);
DestroyTask(taskId);

View File

@ -448,7 +448,7 @@ static void CB2_InitBuyMenu(void)
ResetTasks();
ClearScheduledBgCopiesToVram();
gShopDataPtr = AllocZeroed(sizeof(struct ShopData));
gShopDataPtr->scrollIndicatorsTaskId = 0xFF;
gShopDataPtr->scrollIndicatorsTaskId = TASK_NONE;
gShopDataPtr->itemSpriteIds[0] = 0xFF;
gShopDataPtr->itemSpriteIds[1] = 0xFF;
BuyMenuBuildListMenuTemplate();
@ -581,7 +581,7 @@ static void BuyMenuPrintPriceInList(u8 windowId, s32 item, u8 y)
static void BuyMenuAddScrollIndicatorArrows(void)
{
if (gShopDataPtr->scrollIndicatorsTaskId == 0xFF && gMartInfo.itemCount + 1 > 8)
if (gShopDataPtr->scrollIndicatorsTaskId == TASK_NONE && gMartInfo.itemCount + 1 > 8)
{
gShopDataPtr->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(
SCROLL_ARROW_UP,
@ -597,10 +597,10 @@ static void BuyMenuAddScrollIndicatorArrows(void)
static void BuyMenuRemoveScrollIndicatorArrows(void)
{
if (gShopDataPtr->scrollIndicatorsTaskId != 0xFF)
if (gShopDataPtr->scrollIndicatorsTaskId != TASK_NONE)
{
RemoveScrollIndicatorArrowPair(gShopDataPtr->scrollIndicatorsTaskId);
gShopDataPtr->scrollIndicatorsTaskId = 0xFF;
gShopDataPtr->scrollIndicatorsTaskId = TASK_NONE;
}
}

View File

@ -3409,7 +3409,7 @@ static void OpenInfoBox(u8 digDisplayId)
static bool8 IsInfoBoxClosed(void)
{
if (FindTaskIdByFunc(RunInfoBoxActions) == 0xFF)
if (FindTaskIdByFunc(RunInfoBoxActions) == TASK_NONE)
return TRUE;
else
return FALSE;

View File

@ -464,7 +464,7 @@ void CB2_ChooseStarter(void)
gSprites[spriteId].sTaskId = taskId;
gSprites[spriteId].sBallId = 2;
sStarterLabelWindowId = 0xFF;
sStarterLabelWindowId = WINDOW_NONE;
}
static void CB2_StarterChoose(void)

View File

@ -171,7 +171,7 @@ u8 FindTaskIdByFunc(TaskFunc func)
if (gTasks[i].isActive == TRUE && gTasks[i].func == func)
return (u8)i;
return TAIL_SENTINEL; // No task was found.
return TASK_NONE; // No task was found.
}
u8 GetTaskCount(void)

View File

@ -1169,7 +1169,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
{
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32);
BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);
if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) != 0xFF )
if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) != TASK_NONE)
{
sSecondaryTilesetAnimCallback = TilesetAnim_BattleDome2;
sSecondaryTilesetAnimCounterMax = 32;
@ -1179,7 +1179,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer)
{
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % 4], gPlttBufferUnfaded + 0x80, 32);
if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == 0xFF )
if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == TASK_NONE)
{
BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);
if (!--sSecondaryTilesetAnimCounterMax)

View File

@ -1588,7 +1588,7 @@ static void FlipTrainerCard(void)
static bool8 IsCardFlipTaskActive(void)
{
if (FindTaskIdByFunc(Task_DoCardFlipTask) == 0xFF)
if (FindTaskIdByFunc(Task_DoCardFlipTask) == TASK_NONE)
return TRUE;
else
return FALSE;

View File

@ -2157,8 +2157,8 @@ static void FreeDisplay(void)
static void InitDisplay(struct UnionRoomChatDisplay *display)
{
display->yesNoMenuWindowId = 0xFF;
display->messageWindowId = 0xFF;
display->yesNoMenuWindowId = WINDOW_NONE;
display->messageWindowId = WINDOW_NONE;
display->currLine = 0;
}
@ -2737,7 +2737,7 @@ static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos)
static void HideYesNoMenuWindow(void)
{
if (sDisplay->yesNoMenuWindowId != 0xFF)
if (sDisplay->yesNoMenuWindowId != WINDOW_NONE)
{
ClearStdWindowAndFrameToTransparent(sDisplay->yesNoMenuWindowId, FALSE);
ClearWindowTilemap(sDisplay->yesNoMenuWindowId);
@ -2746,10 +2746,10 @@ static void HideYesNoMenuWindow(void)
static void DestroyYesNoMenuWindow(void)
{
if (sDisplay->yesNoMenuWindowId != 0xFF)
if (sDisplay->yesNoMenuWindowId != WINDOW_NONE)
{
RemoveWindow(sDisplay->yesNoMenuWindowId);
sDisplay->yesNoMenuWindowId = 0xFF;
sDisplay->yesNoMenuWindowId = WINDOW_NONE;
}
}
@ -2828,7 +2828,7 @@ static void AddStdMessageWindow(int msgId, u16 bg0vofs)
static void HideStdMessageWindow(void)
{
if (sDisplay->messageWindowId != 0xFF)
if (sDisplay->messageWindowId != WINDOW_NONE)
{
ClearStdWindowAndFrameToTransparent(sDisplay->messageWindowId, FALSE);
ClearWindowTilemap(sDisplay->messageWindowId);
@ -2839,10 +2839,10 @@ static void HideStdMessageWindow(void)
static void DestroyStdMessageWindow(void)
{
if (sDisplay->messageWindowId != 0xFF)
if (sDisplay->messageWindowId != WINDOW_NONE)
{
RemoveWindow(sDisplay->messageWindowId);
sDisplay->messageWindowId = 0xFF;
sDisplay->messageWindowId = WINDOW_NONE;
}
}