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:
@@ -1468,7 +1468,7 @@ static void Task_PushBoulder(u8 taskId)
|
||||
|
||||
static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@@ -1508,7 +1508,7 @@ static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *player, stru
|
||||
ObjectEventClearHeldMovementIfFinished(player);
|
||||
ObjectEventClearHeldMovementIfFinished(boulder);
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(FindTaskIdByFunc(Task_PushBoulder));
|
||||
}
|
||||
return FALSE;
|
||||
@@ -1570,7 +1570,7 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct Objec
|
||||
task->data[0]++;
|
||||
task->data[1] = objectEvent->movementDirection;
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
PlaySE(SE_WARP_IN);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct Objec
|
||||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
ObjectEventSetHeldMovement(objectEvent, GetWalkSlowMovementAction(GetOppositeDirection(task->data[1])));
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
DestroyTask(FindTaskIdByFunc(PlayerAvatar_DoSecretBaseMatSpin));
|
||||
}
|
||||
@@ -1627,7 +1627,7 @@ static void CreateStopSurfingTask(u8 direction)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_ClearSavedMusic();
|
||||
Overworld_ChangeMusicToDefault();
|
||||
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_SURFING;
|
||||
@@ -1661,7 +1661,7 @@ static void Task_WaitStopSurfing(u8 taskId)
|
||||
ObjectEventSetGraphicsId(playerObjEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
|
||||
ObjectEventSetHeldMovement(playerObjEvent, GetFaceDirectionMovementAction(playerObjEvent->facingDirection));
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroySprite(&gSprites[playerObjEvent->fieldEffectSpriteId]);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@@ -1720,7 +1720,7 @@ static void Task_Fishing(u8 taskId)
|
||||
|
||||
static bool8 Fishing_Init(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
task->tStep++;
|
||||
return FALSE;
|
||||
@@ -1945,7 +1945,7 @@ static bool8 Fishing_StartEncounter(struct Task *task)
|
||||
if (task->tFrameCounter != 0)
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
FishingWildEncounter(task->tFishingRod);
|
||||
RecordFishingAttemptForTV(TRUE);
|
||||
DestroyTask(FindTaskIdByFunc(Task_Fishing));
|
||||
@@ -2004,7 +2004,7 @@ static bool8 Fishing_EndNoMon(struct Task *task)
|
||||
if (!IsTextPrinterActive(0))
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
RecordFishingAttemptForTV(FALSE);
|
||||
|
||||
Reference in New Issue
Block a user