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:
+15
-15
@@ -132,14 +132,14 @@ static void BufferFanClubTrainerName_(struct LinkBattleRecords *, u8, u8);
|
||||
void Special_ShowDiploma(void)
|
||||
{
|
||||
SetMainCallback2(CB2_ShowDiploma);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void Special_ViewWallClock(void)
|
||||
{
|
||||
gMain.savedCallback = CB2_ReturnToField;
|
||||
SetMainCallback2(CB2_ViewWallClock);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ResetCyclingRoadChallengeData(void)
|
||||
@@ -799,7 +799,7 @@ static void Task_PetalburgGymSlideOpenRoomDoors(u8 taskId)
|
||||
if ((++sSlidingDoorFrame) == ARRAY_COUNT(sPetalburgGymSlidingDoorMetatiles))
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1459,7 +1459,7 @@ static void Task_ShakeCamera(u8 taskId)
|
||||
static void StopCameraShake(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
#undef horizontalPan
|
||||
@@ -1814,7 +1814,7 @@ static void Task_MoveElevator(u8 taskId)
|
||||
{
|
||||
PlaySE(SE_DING_DONG);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
InstallCameraPanAheadCallback();
|
||||
}
|
||||
}
|
||||
@@ -2476,7 +2476,7 @@ static void Task_ShowScrollableMultichoice(u8 taskId)
|
||||
struct WindowTemplate template;
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sScrollableMultichoice_ScrollOffset = 0;
|
||||
sScrollableMultichoice_ItemSpriteId = MAX_SPRITES;
|
||||
FillFrontierExchangeCornerWindowAndItemIcon(task->tScrollMultiId, 0);
|
||||
@@ -2591,7 +2591,7 @@ static void ScrollableMultichoice_ProcessInput(u8 taskId)
|
||||
// Handle selection while keeping the menu open
|
||||
ScrollableMultichoice_RemoveScrollArrows(taskId);
|
||||
task->func = Task_ScrollableMultichoice_WaitReturnToList;
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2611,7 +2611,7 @@ static void CloseScrollableMultichoice(u8 taskId)
|
||||
CopyWindowToVram(task->tWindowId, COPYWIN_GFX);
|
||||
RemoveWindow(task->tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
// Never run, tKeepOpenAfterSelect is FALSE for all scrollable multichoices.
|
||||
@@ -2634,14 +2634,14 @@ void ScrollableMultichoice_TryReturnToList(void)
|
||||
{
|
||||
u8 taskId = FindTaskIdByFunc(Task_ScrollableMultichoice_WaitReturnToList);
|
||||
if (taskId == TASK_NONE)
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
else
|
||||
gTasks[taskId].tKeepOpenAfterSelect++; // Return to list
|
||||
}
|
||||
|
||||
static void Task_ScrollableMultichoice_ReturnToList(u8 taskId)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
ScrollableMultichoice_UpdateScrollArrows(taskId);
|
||||
gTasks[taskId].func = ScrollableMultichoice_ProcessInput;
|
||||
}
|
||||
@@ -3228,7 +3228,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
|
||||
if (FlagGet(FLAG_DEOXYS_ROCK_COMPLETE) == TRUE)
|
||||
{
|
||||
gSpecialVar_Result = 3;
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
@@ -3249,7 +3249,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
|
||||
{
|
||||
FlagSet(FLAG_DEOXYS_ROCK_COMPLETE);
|
||||
gSpecialVar_Result = 2;
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
@@ -3294,7 +3294,7 @@ static void WaitForDeoxysRockMovement(u8 taskId)
|
||||
{
|
||||
if (FieldEffectActiveListContains(FLDEFF_MOVE_DEOXYS_ROCK) == FALSE)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@@ -3700,7 +3700,7 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
|
||||
SetCloseLinkCallback();
|
||||
|
||||
gBattleTypeFlags = sBattleTowerMultiBattleTypeFlags;
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@@ -3786,7 +3786,7 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
|
||||
if (tCurrentFrame == 3)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user