Renaming Script Contexts

- Determined how the various script contexts were used and renamed accordingly.
- ScriptContext2_Enable/Disable => Lock/UnlockPlayerFieldControls - The sole purpose of the flag is to make sure the player can't move around in the overworld. It has nothing to do with script contexts.
- ScriptContext1 => ScriptContext - It is the global script context used to set up scripts which run over many frames.
- ScriptContext2_RunNewScript => RunScriptImmediately - ScriptContext2's sole purpose was to run scripts immediately and in a separate context, usually while the global context is waiting for things like map loads or screen changes.
This commit is contained in:
tustin2121
2022-08-15 15:18:12 -04:00
parent 3dc3dc847f
commit 1cb659df8c
65 changed files with 438 additions and 409 deletions

View File

@@ -2129,7 +2129,7 @@ static void Task_StartContest(u8 taskId)
void StartContest(void)
{
ScriptContext2_Enable();
LockPlayerFieldControls();
CreateTask(Task_StartContest, 10);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
}
@@ -2150,7 +2150,7 @@ static void Task_StartShowContestResults(u8 taskId)
void ShowContestResults(void)
{
ScriptContext2_Enable();
LockPlayerFieldControls();
CreateTask(Task_StartShowContestResults, 10);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
}
@@ -2163,7 +2163,7 @@ void GetContestPlayerId(void)
void ContestLinkTransfer(u8 category)
{
u8 newTaskId;
ScriptContext2_Enable();
LockPlayerFieldControls();
newTaskId = CreateTask(Task_LinkContest_Init, 0);
SetTaskFuncWithFollowupFunc(newTaskId, Task_LinkContest_Init, Task_StartCommunication);
gTasks[newTaskId].data[9] = category;
@@ -2265,8 +2265,8 @@ void Task_LinkContest_FinalizeConnection(u8 taskId)
DestroyTask(taskId);
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, WARP_ID_NONE);
ScriptContext2_Disable();
EnableBothScriptContexts();
UnlockPlayerFieldControls();
ScriptContext_Enable();
}
}
@@ -2281,8 +2281,8 @@ static void Task_LinkContest_WaitDisconnect(u8 taskId)
if (!gReceivedRemoteLinkPlayers)
{
DestroyTask(taskId);
ScriptContext2_Disable();
EnableBothScriptContexts();
UnlockPlayerFieldControls();
ScriptContext_Enable();
}
}
@@ -2726,7 +2726,7 @@ static void Task_LinkContestWaitForConnection(u8 taskId)
default:
if (IsLinkTaskFinished() == 1)
{
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
break;