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
+14 -14
View File
@@ -486,7 +486,7 @@ static void FinishLinkup(u16 *linkupStatus, u32 taskId)
{
// Successful battle tower linkup
ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
}
@@ -494,7 +494,7 @@ static void FinishLinkup(u16 *linkupStatus, u32 taskId)
{
// Successful linkup
ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
}
@@ -531,7 +531,7 @@ static void Task_StopLinkup(u8 taskId)
if (!gReceivedRemoteLinkPlayers)
{
ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
ScriptContext_Enable();
RemoveWindow(gTasks[taskId].tWindowId);
DestroyTask(taskId);
}
@@ -543,7 +543,7 @@ static void Task_LinkupFailed(u8 taskId)
ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
StopFieldMessage();
RemoveWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
@@ -553,7 +553,7 @@ static void Task_LinkupConnectionError(u8 taskId)
ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
RemoveWindow(gTasks[taskId].tWindowId);
HideFieldMessageBox();
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
@@ -688,13 +688,13 @@ static void Task_ValidateMixingGameLanguage(u8 taskId)
return;
}
}
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
break;
case 1:
if (!gReceivedRemoteLinkPlayers)
{
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
break;
@@ -1080,7 +1080,7 @@ static void Task_EnterCableClubSeat(u8 taskId)
SetLinkWaitingForScript();
EraseFieldMessageBox(TRUE);
DestroyTask(taskId);
EnableBothScriptContexts();
ScriptContext_Enable();
break;
}
}
@@ -1089,7 +1089,7 @@ void CreateTask_EnterCableClubSeat(TaskFunc followupFunc)
{
u8 taskId = CreateTask(Task_EnterCableClubSeat, 80);
SetTaskFuncWithFollowupFunc(taskId, Task_EnterCableClubSeat, followupFunc);
ScriptContext1_Stop();
ScriptContext_Stop();
}
static void Task_StartWiredTrade(u8 taskId)
@@ -1099,7 +1099,7 @@ static void Task_StartWiredTrade(u8 taskId)
switch (task->tState)
{
case 0:
ScriptContext2_Enable();
LockPlayerFieldControls();
FadeScreen(FADE_TO_BLACK, 0);
ClearLinkCallback_2();
task->tState++;
@@ -1132,7 +1132,7 @@ static void Task_StartWirelessTrade(u8 taskId)
switch (tState)
{
case 0:
ScriptContext2_Enable();
LockPlayerFieldControls();
FadeScreen(FADE_TO_BLACK, 0);
ClearLinkRfuCallback();
tState++;
@@ -1176,7 +1176,7 @@ static void CreateTask_StartWiredTrade(void)
void Script_StartWiredTrade(void)
{
// CreateTask_StartWiredTrade();
// ScriptContext1_Stop();
// ScriptContext_Stop();
}
void ColosseumPlayerSpotTriggered(void)
@@ -1193,7 +1193,7 @@ void ColosseumPlayerSpotTriggered(void)
static void CreateTask_EnterCableClubSeatNoFollowup(void)
{
u8 taskId = CreateTask(Task_EnterCableClubSeat, 80);
ScriptContext1_Stop();
ScriptContext_Stop();
}
void Script_ShowLinkTrainerCard(void)
@@ -1257,7 +1257,7 @@ static void Task_WaitExitToScript(u8 taskId)
{
if (!gReceivedRemoteLinkPlayers)
{
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
}