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

@@ -294,7 +294,7 @@ bool8 FldEff_UseCutOnGrass(void)
static void FieldCallback_CutTree(void)
{
gFieldEffectArguments[0] = GetCursorSelectionMonId();
ScriptContext1_SetupScript(EventScript_UseCut);
ScriptContext_SetupScript(EventScript_UseCut);
}
bool8 FldEff_UseCutOnTree(void)
@@ -583,10 +583,10 @@ static void CutGrassSpriteCallbackEnd(struct Sprite *sprite)
FieldEffectStop(&gSprites[sCutGrassSpriteArrayPtr[0]], FLDEFF_CUT_GRASS);
FREE_AND_SET_NULL(sCutGrassSpriteArrayPtr);
ScriptUnfreezeObjectEvents();
ScriptContext2_Disable();
UnlockPlayerFieldControls();
if (IsMewPlayingHideAndSeek() == TRUE)
ScriptContext1_SetupScript(FarawayIsland_Interior_EventScript_HideMewWhenGrassCut);
ScriptContext_SetupScript(FarawayIsland_Interior_EventScript_HideMewWhenGrassCut);
}
void FixLongGrassMetatilesWindowTop(s16 x, s16 y)
@@ -643,5 +643,5 @@ static void StartCutTreeFieldEffect(void)
{
PlaySE(SE_M_CUT);
FieldEffectActiveListRemove(FLDEFF_USE_CUT_ON_TREE);
EnableBothScriptContexts();
ScriptContext_Enable();
}