Skip to content

Commit

Permalink
Unify terminology: taskManager -> task
Browse files Browse the repository at this point in the history
  • Loading branch information
lhearachel committed Nov 4, 2024
1 parent 604bab4 commit acb1645
Show file tree
Hide file tree
Showing 44 changed files with 143 additions and 143 deletions.
2 changes: 1 addition & 1 deletion include/field/field_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ typedef struct FieldSystem_t {
FieldSystem_sub2 *unk_04;
BgConfig *bgConfig;
SaveData *saveData;
FieldTask *taskManager;
FieldTask *task;
MapHeaderData *mapHeaderData;
int bottomScreen;
Location *location;
Expand Down
4 changes: 2 additions & 2 deletions include/field_script_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct ScriptContext {
const ScrCmdFunc *cmdTable;
u32 cmdTableSize;
u32 data[4];
FieldTask *taskManager;
FieldTask *task;
MessageLoader *loader;
const u8 *scripts;
FieldSystem *fieldSystem;
Expand All @@ -33,7 +33,7 @@ void ScriptContext_Init(ScriptContext *ctx, const ScrCmdFunc *cmdTable, u32 cmdT
BOOL ScriptContext_Start(ScriptContext *ctx, const u8 *ptr);
void ScriptContext_Pause(ScriptContext *ctx, ShouldResumeScriptFunc shouldResume);
void ScriptContext_Stop(ScriptContext *ctx);
void ScriptContext_SetTaskManager(ScriptContext *ctx, FieldTask *taskManager);
void ScriptContext_SetTask(ScriptContext *ctx, FieldTask *taskManager);
BOOL ScriptContext_Run(ScriptContext *ctx);
void ScriptContext_Jump(ScriptContext *ctx, const u8 *ptr);
void ScriptContext_Call(ScriptContext *ctx, const u8 *ptr);
Expand Down
2 changes: 1 addition & 1 deletion src/field_comm_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static void sub_02059B74(void)
for (v0 = 0; v0 < CommSys_ConnectedCount(); v0++) {
if (v0 != CommSys_CurNetId()) {
if (sub_02036564(v0) == 94) {
if (sFieldCommMan->fieldSystem->taskManager == NULL) {
if (sFieldCommMan->fieldSystem->task == NULL) {
for (v1 = 0; v1 < 4; v1++) {
if (sFieldCommMan->trainerCard[v1]) {
Heap_FreeToHeap(sFieldCommMan->trainerCard[v1]);
Expand Down
2 changes: 1 addition & 1 deletion src/field_map_change.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,5 +1576,5 @@ void sub_02054864(FieldTask *taskMan)
Location *location = FieldOverworldState_GetSpecialLocation(SaveData_GetFieldOverworldState(fieldSystem->saveData));

fieldSystem->mapLoadType = MAP_LOAD_TYPE_OVERWORLD;
FieldSystem_StartChangeMapTask(fieldSystem->taskManager, location);
FieldSystem_StartChangeMapTask(fieldSystem->task, location);
}
2 changes: 1 addition & 1 deletion src/field_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void sub_0203AB00(FieldSystem *fieldSystem)
menu->unk_224 = sub_0203ABD0(fieldSystem);
}

FieldTask_InitJump(fieldSystem->taskManager, sub_0203AC44, menu);
FieldTask_InitJump(fieldSystem->task, sub_0203AC44, menu);
}

static FieldMenu *FieldMenu_Alloc(void)
Expand Down
6 changes: 3 additions & 3 deletions src/field_script_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void ScriptContext_Init(ScriptContext *ctx, const ScrCmdFunc *cmdTable, u32 cmdT
ctx->stack[i] = NULL;
}

ctx->taskManager = NULL;
ctx->task = NULL;
}

BOOL ScriptContext_Start(ScriptContext *ctx, const u8 *ptr)
Expand All @@ -50,9 +50,9 @@ void ScriptContext_Stop(ScriptContext *ctx)
ctx->scriptPtr = NULL;
}

void ScriptContext_SetTaskManager(ScriptContext *ctx, FieldTask *taskManager)
void ScriptContext_SetTask(ScriptContext *ctx, FieldTask *task)
{
ctx->taskManager = taskManager;
ctx->task = task;
}

BOOL ScriptContext_Run(ScriptContext *ctx)
Expand Down
4 changes: 2 additions & 2 deletions src/field_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static FieldSystem *InitFieldSystem(OverlayManager *ovyManager)
fieldSystem->processManager->pause = FALSE;
fieldSystem->processManager->kill = FALSE;
fieldSystem->saveData = ((ApplicationArgs *)OverlayManager_Args(ovyManager))->saveData;
fieldSystem->taskManager = NULL;
fieldSystem->task = NULL;
fieldSystem->location = FieldOverworldState_GetPlayerLocation(SaveData_GetFieldOverworldState(fieldSystem->saveData));
fieldSystem->unk_2C = sub_02039D6C();

Expand Down Expand Up @@ -220,7 +220,7 @@ static BOOL HandleInputsEventsAndProcesses(FieldSystem *fieldSystem)

// Does not match with return (expression)
if (fieldSystem->processManager->kill
&& !fieldSystem->taskManager
&& !fieldSystem->task
&& !fieldSystem->processManager->parent
&& !fieldSystem->processManager->child) {
return TRUE;
Expand Down
24 changes: 12 additions & 12 deletions src/field_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ static FieldTask *CreateTaskManager(FieldSystem *fieldSys, FieldTaskFunc taskFun

FieldTask *FieldSystem_CreateTask(FieldSystem *fieldSys, FieldTaskFunc taskFunc, void *taskEnv)
{
GF_ASSERT(fieldSys->taskManager == NULL);
GF_ASSERT(fieldSys->task == NULL);

FieldTask *task = CreateTaskManager(fieldSys, taskFunc, taskEnv);
fieldSys->taskManager = task;
fieldSys->task = task;

return task;
}
Expand All @@ -56,29 +56,29 @@ FieldTask *FieldTask_InitCall(FieldTask *task, FieldTaskFunc taskFunc, void *tas
{
FieldTask *next = CreateTaskManager(task->fieldSys, taskFunc, taskEnv);
next->prev = task;
task->fieldSys->taskManager = next;
task->fieldSys->task = next;

return next;
}

BOOL FieldTask_Run(FieldSystem *fieldSys)
{
if (fieldSys->taskManager == NULL) {
if (fieldSys->task == NULL) {
return FALSE;
}

// Run invocations through the call-stack until it is empty.
while (fieldSys->taskManager->func(fieldSys->taskManager) == TRUE) {
FieldTask *prev = fieldSys->taskManager->prev;
while (fieldSys->task->func(fieldSys->task) == TRUE) {
FieldTask *prev = fieldSys->task->prev;

if (fieldSys->taskManager->dummy14) {
Heap_FreeToHeap(fieldSys->taskManager->dummy14);
if (fieldSys->task->dummy14) {
Heap_FreeToHeap(fieldSys->task->dummy14);
}

Heap_FreeToHeap(fieldSys->taskManager->dummy1C);
Heap_FreeToHeap(fieldSys->taskManager);
Heap_FreeToHeap(fieldSys->task->dummy1C);
Heap_FreeToHeap(fieldSys->task);

fieldSys->taskManager = prev;
fieldSys->task = prev;
if (prev == NULL) {
return TRUE;
}
Expand All @@ -89,7 +89,7 @@ BOOL FieldTask_Run(FieldSystem *fieldSys)

BOOL FieldSystem_IsRunningTask(FieldSystem *fieldSys)
{
return fieldSys->taskManager != NULL;
return fieldSys->task != NULL;
}

BOOL FieldSystem_IsRunningApplication(FieldSystem *fieldSys)
Expand Down
4 changes: 2 additions & 2 deletions src/overlay005/ov5_021D431C.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ BOOL ov5_021D453C(FieldSystem *fieldSystem, UnkStruct_ov5_021D432C *param1)
(param1->unk_00)++;
} break;
case 1:
sub_02056B30(fieldSystem->taskManager, 0, 9, 1, 0x0, 6, 1, 11);
sub_02056B30(fieldSystem->task, 0, 9, 1, 0x0, 6, 1, 11);
{
int v9;
int v10;
Expand Down Expand Up @@ -813,7 +813,7 @@ void ov5_021D4D48(FieldSystem *fieldSystem, const u8 param1)
u8 *v0 = Heap_AllocFromHeapAtEnd(4, sizeof(u8));

*v0 = param1;
FieldTask_InitCall(fieldSystem->taskManager, ov5_021D4BC8, v0);
FieldTask_InitCall(fieldSystem->task, ov5_021D4BC8, v0);
}

void ov5_021D4D68(FieldSystem *fieldSystem, const u8 param1)
Expand Down
6 changes: 3 additions & 3 deletions src/overlay005/ov5_021DFB54.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ static void ov5_021E00B0(FieldSystem *fieldSystem, int param1, const UnkStruct_o
v0->unk_24 = Player_MapObject(v0->playerAvatar);
v0->unk_0C = *param2;

FieldTask_InitCall(fieldSystem->taskManager, ov5_021E0160, v0);
FieldTask_InitCall(fieldSystem->task, ov5_021E0160, v0);
}

void ov5_021E00EC(FieldTask *taskMan, int param1, int param2)
Expand Down Expand Up @@ -968,7 +968,7 @@ static void ov5_021E06F8(FieldSystem *fieldSystem, int param1, const UnkStruct_o
v0->unk_14 = Player_MapObject(v0->playerAvatar);
v0->unk_1C = *param2;

FieldTask_InitCall(fieldSystem->taskManager, ov5_021E07A0, v0);
FieldTask_InitCall(fieldSystem->task, ov5_021E07A0, v0);
}

void ov5_021E0734(FieldTask *param0, int param1, int param2)
Expand Down Expand Up @@ -1520,7 +1520,7 @@ static void ov5_021E0DE0(FieldSystem *fieldSystem)
v0->unk_08 = Player_MapObject(v0->playerAvatar);
v0->unk_10 = PlayerAvatar_Gender(v0->playerAvatar);

FieldTask_InitCall(fieldSystem->taskManager, ov5_021E0E10, v0);
FieldTask_InitCall(fieldSystem->task, ov5_021E0E10, v0);
}

static BOOL ov5_021E0E10(FieldTask *param0)
Expand Down
2 changes: 1 addition & 1 deletion src/overlay005/ov5_021EA874.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ static void ov5_021EAF1C(UnkStruct_ov5_021EAE78 *param0)
void ov5_021EAF50(FieldSystem *fieldSystem)
{
UnkStruct_ov5_021EAE78 *v0;
FieldTask *v1 = fieldSystem->taskManager;
FieldTask *v1 = fieldSystem->task;

v0 = Heap_AllocFromHeapAtEnd(11, sizeof(UnkStruct_ov5_021EAE78));
ov5_021EAEE0(v0);
Expand Down
2 changes: 1 addition & 1 deletion src/overlay006/ov6_02242AF0.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void ov6_02242B58(FieldSystem *fieldSystem, const u16 param1, const u16 param2)
v2->unk_00 = ov6_02242E60;
}

FieldTask_InitCall(fieldSystem->taskManager, ov6_02242C5C, v2);
FieldTask_InitCall(fieldSystem->task, ov6_02242C5C, v2);
}

u32 ov6_02242C3C(FieldSystem *fieldSystem, const u16 param1)
Expand Down
2 changes: 1 addition & 1 deletion src/overlay006/ov6_02246C24.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void ov6_02246C24(FieldSystem *fieldSystem, const u8 param1)
v4->unk_00.z += v5.z;
}

FieldTask_InitCall(fieldSystem->taskManager, ov6_02246C9C, v4);
FieldTask_InitCall(fieldSystem->task, ov6_02246C9C, v4);
} else {
GF_ASSERT(FALSE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlay006/ov6_02246F00.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void ov6_02246F00(FieldSystem *fieldSystem, const u8 param1, const u8 param2)
v1->unk_01 = param1;
v1->unk_02 = 0;

FieldTask_InitCall(fieldSystem->taskManager, ov6_02246F40, v1);
FieldTask_InitCall(fieldSystem->task, ov6_02246F40, v1);
} else {
GF_ASSERT(FALSE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlay006/ov6_02247D30.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void ov6_02247D30(FieldSystem *fieldSystem, const u8 param1)
v4->unk_00.z += v5.z;
}

FieldTask_InitCall(fieldSystem->taskManager, ov6_02247DAC, v4);
FieldTask_InitCall(fieldSystem->task, ov6_02247DAC, v4);
} else {
GF_ASSERT(FALSE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlay006/ov6_02247F5C.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void ov6_02247F5C(FieldSystem *fieldSystem)

void ov6_02247FBC(FieldSystem *fieldSystem)
{
FieldTask_InitCall(fieldSystem->taskManager, ov6_02247FD0, NULL);
FieldTask_InitCall(fieldSystem->task, ov6_02247FD0, NULL);
}

static BOOL ov6_02247FD0(FieldTask *param0)
Expand Down
14 changes: 7 additions & 7 deletions src/overlay008/ov8_02249960.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ void ov8_0224997C(FieldSystem *fieldSystem)
v6->unk_00 = 0;

if (v4 == 239) {
FieldTask_InitCall(fieldSystem->taskManager, ov8_02249CD8, v6);
FieldTask_InitCall(fieldSystem->task, ov8_02249CD8, v6);
v8->unk_00 = 2;
} else if (v4 == 240) {
FieldTask_InitCall(fieldSystem->taskManager, ov8_02249B74, v6);
FieldTask_InitCall(fieldSystem->task, ov8_02249B74, v6);
v8->unk_00 = 1;
} else if (v4 == 241) {
FieldTask_InitCall(fieldSystem->taskManager, ov8_02249A94, v6);
FieldTask_InitCall(fieldSystem->task, ov8_02249A94, v6);
v8->unk_00 = 0;
} else {
GF_ASSERT(FALSE);
Expand Down Expand Up @@ -761,10 +761,10 @@ void ov8_02249FB8(FieldSystem *fieldSystem)
PlayerAvatar_PosVectorOut(fieldSystem->playerAvatar, &v1);

if (v1.y == (FX32_ONE * 16 * 0)) {
FieldTask_InitCall(fieldSystem->taskManager, ov8_0224A018, v0);
FieldTask_InitCall(fieldSystem->task, ov8_0224A018, v0);
v3->unk_00 = 1;
} else {
FieldTask_InitCall(fieldSystem->taskManager, ov8_0224A0E8, v0);
FieldTask_InitCall(fieldSystem->task, ov8_0224A0E8, v0);
v3->unk_00 = 0;
}
}
Expand Down Expand Up @@ -2206,7 +2206,7 @@ void ov8_0224AD34(FieldSystem *fieldSystem, const u8 param1)
v1->unk_13 = v4;

Sound_PlayEffect(1599);
FieldTask_InitCall(fieldSystem->taskManager, ov8_0224ADE8, v0);
FieldTask_InitCall(fieldSystem->task, ov8_0224ADE8, v0);
}
}

Expand Down Expand Up @@ -2905,7 +2905,7 @@ BOOL ov8_0224B67C(FieldSystem *fieldSystem, Window *param1, MessageLoader *param
v2->unk_14 = v1;
v2->unk_18 = v3;

FieldTask_InitCall(fieldSystem->taskManager, ov8_0224B3D4, v2);
FieldTask_InitCall(fieldSystem->task, ov8_0224B3D4, v2);
}

return 1;
Expand Down
2 changes: 1 addition & 1 deletion src/overlay023/ov23_02241F74.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ BOOL ov23_02243298(int param0)
return 0;
}

if (sCommManUnderground->fieldSystem->taskManager) {
if (sCommManUnderground->fieldSystem->task) {
sCommManUnderground->unk_130++;

if (sCommManUnderground->unk_130 > 100) {
Expand Down
4 changes: 2 additions & 2 deletions src/overlay023/ov23_022499E4.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static void ov23_02249E18(void)

ov23_02242B14();

if (v0->fieldSystem->taskManager != NULL) {
if (v0->fieldSystem->task != NULL) {
return;
}

Expand Down Expand Up @@ -579,7 +579,7 @@ static void ov23_0224A09C(void)
ov23_02242B14();
sub_02059524();

if (v0->fieldSystem->taskManager != NULL) {
if (v0->fieldSystem->task != NULL) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/overlay023/ov23_0224B05C.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ static UnkStruct_ov23_0224BA48 *ov23_0224BCC4(FieldSystem *fieldSystem, int para
{
UnkStruct_ov23_0224BA48 *v0 = NULL;

if (fieldSystem->taskManager == NULL) {
if (fieldSystem->task == NULL) {
v0 = Heap_AllocFromHeapAtEnd(11, sizeof(UnkStruct_ov23_0224BA48));
MI_CpuClear8(v0, sizeof(UnkStruct_ov23_0224BA48));

Expand Down
2 changes: 1 addition & 1 deletion src/overlay023/ov23_0225128C.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ static void ov23_02251C04(SysTask *param0, void *param1)
}
break;
case 3:
if (v0->fieldSystem->taskManager == NULL) {
if (v0->fieldSystem->task == NULL) {
v2 = Heap_AllocFromHeapAtEnd(11, sizeof(UnkStruct_ov23_02251ACC));
MI_CpuClear8(v2, sizeof(UnkStruct_ov23_02251ACC));
v2->unk_00 = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/pokeradar.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void sub_0206979C(FieldSystem *fieldSystem)
GrassPatch *patch;
int patchRing;

if (!fieldSystem->chain->active || fieldSystem->taskManager != NULL) {
if (!fieldSystem->chain->active || fieldSystem->task != NULL) {
return;
}

Expand Down
Loading

0 comments on commit acb1645

Please sign in to comment.