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
+8 -8
View File
@@ -461,7 +461,7 @@ static void EnterNewlyCreatedSecretBase_WaitFadeIn(u8 taskId)
ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], DIR_NORTH);
if (IsWeatherNotFadingIn() == TRUE)
{
EnableBothScriptContexts();
ScriptContext_Enable();
DestroyTask(taskId);
}
}
@@ -470,7 +470,7 @@ static void EnterNewlyCreatedSecretBase_StartFadeIn(void)
{
s16 x, y;
ScriptContext2_Enable();
LockPlayerFieldControls();
HideMapNamePopUpWindow();
FindMetatileIdMapCoords(&x, &y, METATILE_SecretBase_PC);
x += MAP_OFFSET;
@@ -673,7 +673,7 @@ void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEven
{
SetCurSecretBaseIdFromPosition(position, events);
TrySetCurSecretBaseIndex();
ScriptContext1_SetupScript(SecretBase_EventScript_Enter);
ScriptContext_SetupScript(SecretBase_EventScript_Enter);
}
bool8 TrySetCurSecretBase(void)
@@ -691,7 +691,7 @@ static void Task_WarpOutOfSecretBase(u8 taskId)
switch (gTasks[taskId].data[0])
{
case 0:
ScriptContext2_Enable();
LockPlayerFieldControls();
gTasks[taskId].data[0] = 1;
break;
case 1:
@@ -703,7 +703,7 @@ static void Task_WarpOutOfSecretBase(u8 taskId)
WarpIntoMap();
gFieldCallback = FieldCB_DefaultWarpExit;
SetMainCallback2(CB2_LoadMap);
ScriptContext2_Disable();
UnlockPlayerFieldControls();
DestroyTask(taskId);
break;
}
@@ -914,7 +914,7 @@ void ShowSecretBaseRegistryMenu(void)
static void Task_ShowSecretBaseRegistryMenu(u8 taskId)
{
s16 *data = gTasks[taskId].data;
ScriptContext2_Enable();
LockPlayerFieldControls();
tNumBases = GetNumRegisteredSecretBases();
if (tNumBases != 0)
{
@@ -1110,9 +1110,9 @@ static void ReturnToMainRegistryMenu(u8 taskId)
static void GoToSecretBasePCRegisterMenu(u8 taskId)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) == 0)
ScriptContext1_SetupScript(SecretBase_EventScript_PCCancel);
ScriptContext_SetupScript(SecretBase_EventScript_PCCancel);
else
ScriptContext1_SetupScript(SecretBase_EventScript_ShowRegisterMenu);
ScriptContext_SetupScript(SecretBase_EventScript_ShowRegisterMenu);
DestroyTask(taskId);
}