mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 03:04:15 +01:00
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:
parent
3dc3dc847f
commit
1cb659df8c
@ -277,7 +277,7 @@
|
||||
.endm
|
||||
|
||||
@ Blocks script execution until a command or C code manually unblocks it. Generally used with specific
|
||||
@ commands and specials. Calling EnableBothScriptContexts for instance will allow execution to continue.
|
||||
@ commands and specials. Calling ScriptContext_Enable for instance will allow execution to continue.
|
||||
.macro waitstate
|
||||
.byte 0x27
|
||||
.endm
|
||||
|
@ -16,7 +16,7 @@ struct ApprenticeTrainer
|
||||
extern const struct ApprenticeTrainer gApprentices[];
|
||||
|
||||
void BufferApprenticeChallengeText(u8 saveApprenticeId);
|
||||
void Apprentice_EnableBothScriptContexts(void);
|
||||
void Apprentice_ScriptContext_Enable(void);
|
||||
void ResetApprenticeStruct(struct Apprentice *apprentice);
|
||||
void ResetAllApprenticeData(void);
|
||||
void CallApprenticeFunction(void);
|
||||
|
@ -31,16 +31,39 @@ void ScriptCall(struct ScriptContext *ctx, const u8 *ptr);
|
||||
void ScriptReturn(struct ScriptContext *ctx);
|
||||
u16 ScriptReadHalfword(struct ScriptContext *ctx);
|
||||
u32 ScriptReadWord(struct ScriptContext *ctx);
|
||||
void ScriptContext2_Enable(void);
|
||||
void ScriptContext2_Disable(void);
|
||||
bool8 ScriptContext2_IsEnabled(void);
|
||||
void ScriptContext1_Init(void);
|
||||
bool8 ScriptContext1_IsScriptSetUp(void);
|
||||
bool8 ScriptContext2_RunScript(void);
|
||||
void ScriptContext1_SetupScript(const u8 *ptr);
|
||||
void ScriptContext1_Stop(void);
|
||||
void EnableBothScriptContexts(void);
|
||||
void ScriptContext2_RunNewScript(const u8 *ptr);
|
||||
|
||||
// Formerly ScriptContext2_Enable / Disable / IsEnabled
|
||||
|
||||
void LockPlayerFieldControls(void);
|
||||
void UnlockPlayerFieldControls(void);
|
||||
bool8 ArePlayerFieldControlsLocked(void);
|
||||
|
||||
// Formerly ScriptContext1_*()
|
||||
// The ScriptContext_* functions work with the primary script context,
|
||||
// which yields control back to native code should the script make a wait call.
|
||||
|
||||
// Re-initializes the global script context to zero.
|
||||
void ScriptContext_Init(void);
|
||||
// Checks if the global script context is able to be run right now.
|
||||
bool8 ScriptContext_IsEnabled(void);
|
||||
// Runs the script until the script makes a wait* call, then returns true if
|
||||
// there's more script to run, or false if the script has hit the end.
|
||||
// This function also returns false if the context is finished
|
||||
// or waiting (after a call to _Stop)
|
||||
bool8 ScriptContext_RunScript(void);
|
||||
// Sets up a new script in the global context and enables the context
|
||||
void ScriptContext_SetupScript(const u8 *ptr);
|
||||
// Puts the script into waiting mode; usually called from a wait* script command.
|
||||
void ScriptContext_Stop(void);
|
||||
// Puts the script into running mode.
|
||||
void ScriptContext_Enable(void);
|
||||
|
||||
// Formerly ScriptContext2_RunNewScript()
|
||||
// Sets up and runs a script in its own context immediately. The script will be
|
||||
// finished when this function returns. Used mainly by all of the map header
|
||||
// scripts (except the frame table scripts).
|
||||
void RunScriptImmediately(const u8 *ptr);
|
||||
|
||||
u8 *MapHeaderGetScriptTable(u8 tag);
|
||||
void MapHeaderRunScriptType(u8 tag);
|
||||
u8 *MapHeaderCheckScriptTable(u8 tag);
|
||||
|
@ -24,7 +24,7 @@ void SetCurSecretBaseIdFromPosition(const struct MapPosition *position, const st
|
||||
void TrySetCurSecretBaseIndex(void);
|
||||
void CheckPlayerHasSecretBase(void);
|
||||
void ToggleSecretBaseEntranceMetatile(void);
|
||||
void EnableBothScriptContexts(void);
|
||||
void ScriptContext_Enable(void);
|
||||
void ReceiveSecretBasesData(void *records, size_t recordSize, u8 linkIdx);
|
||||
|
||||
#endif //GUARD_SECRET_BASE_H
|
||||
|
@ -132,9 +132,9 @@ void BufferApprenticeChallengeText(u8 saveApprenticeId)
|
||||
StringExpandPlaceholders(gStringVar4, challengeText);
|
||||
}
|
||||
|
||||
void Apprentice_EnableBothScriptContexts(void)
|
||||
void Apprentice_ScriptContext_Enable(void)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void ResetApprenticeStruct(struct Apprentice *apprentice)
|
||||
@ -679,7 +679,7 @@ static void Task_ChooseAnswer(u8 taskId)
|
||||
|
||||
RemoveAndHideWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static u8 CreateAndShowWindow(u8 left, u8 top, u8 width, u8 height)
|
||||
@ -815,9 +815,9 @@ static void Task_WaitForPrintingMessage(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
if (gSpecialVar_0x8005)
|
||||
ExecuteFuncAfterButtonPress(EnableBothScriptContexts);
|
||||
ExecuteFuncAfterButtonPress(ScriptContext_Enable);
|
||||
else
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ static void PrintApprenticeMessage(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -906,7 +906,7 @@ static void PrintApprenticeMessage(void)
|
||||
|
||||
static void Script_PrintApprenticeMessage(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
PlayerFreeze();
|
||||
StopPlayerAvatar();
|
||||
|
@ -1251,7 +1251,7 @@ static void Task_DoStatusInflictionScreenFlash(u8 taskId)
|
||||
{
|
||||
if (IsStatusInflictionScreenFlashTaskFinished())
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
@ -1480,7 +1480,7 @@ u8 GetTrainerEncounterMusicIdInBattlePyramid(u16 trainerId)
|
||||
// Unused
|
||||
static void BattlePyramidRetireChallenge(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(BattlePyramid_Retire);
|
||||
ScriptContext_SetupScript(BattlePyramid_Retire);
|
||||
}
|
||||
|
||||
static u16 GetUniqueTrainerId(u8 objectEventId)
|
||||
|
@ -393,7 +393,7 @@ static void OpenBattlePyramidBagInBattle(void)
|
||||
// make room.
|
||||
void ChooseItemsToTossFromPyramidBag(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
CreateTask(Task_ChooseItemsToTossFromPyramidBag, 10);
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ void BattleSetup_StartBattlePikeWildBattle(void)
|
||||
|
||||
static void DoStandardWildBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
StopPlayerAvatar();
|
||||
gMain.savedCallback = CB2_EndWildBattle;
|
||||
@ -419,7 +419,7 @@ static void DoStandardWildBattle(void)
|
||||
|
||||
void BattleSetup_StartRoamerBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
StopPlayerAvatar();
|
||||
gMain.savedCallback = CB2_EndWildBattle;
|
||||
@ -433,7 +433,7 @@ void BattleSetup_StartRoamerBattle(void)
|
||||
|
||||
static void DoSafariBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
StopPlayerAvatar();
|
||||
gMain.savedCallback = CB2_EndSafariBattle;
|
||||
@ -443,7 +443,7 @@ static void DoSafariBattle(void)
|
||||
|
||||
static void DoBattlePikeWildBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
StopPlayerAvatar();
|
||||
gMain.savedCallback = CB2_EndWildBattle;
|
||||
@ -479,7 +479,7 @@ static void DoBattlePyramidTrainerHillBattle(void)
|
||||
void StartWallyTutorialBattle(void)
|
||||
{
|
||||
CreateMaleMon(&gEnemyParty[0], SPECIES_RALTS, 5);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_ReturnToFieldContinueScriptPlayMapMusic;
|
||||
gBattleTypeFlags = BATTLE_TYPE_WALLY_TUTORIAL;
|
||||
CreateBattleStartTask(B_TRANSITION_SLICE, 0);
|
||||
@ -487,7 +487,7 @@ void StartWallyTutorialBattle(void)
|
||||
|
||||
void BattleSetup_StartScriptedWildBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = 0;
|
||||
CreateBattleStartTask(GetWildBattleTransition(), 0);
|
||||
@ -499,7 +499,7 @@ void BattleSetup_StartScriptedWildBattle(void)
|
||||
|
||||
void BattleSetup_StartLatiBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY;
|
||||
CreateBattleStartTask(GetWildBattleTransition(), 0);
|
||||
@ -511,7 +511,7 @@ void BattleSetup_StartLatiBattle(void)
|
||||
|
||||
void BattleSetup_StartLegendaryBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY;
|
||||
|
||||
@ -550,7 +550,7 @@ void BattleSetup_StartLegendaryBattle(void)
|
||||
|
||||
void StartGroudonKyogreBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_KYOGRE_GROUDON;
|
||||
|
||||
@ -570,7 +570,7 @@ void StartRegiBattle(void)
|
||||
u8 transitionId;
|
||||
u16 species;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_REGI;
|
||||
|
||||
@ -1194,8 +1194,8 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerSc
|
||||
gSelectedObjectEvent = trainerObjEventId;
|
||||
gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId;
|
||||
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
||||
ScriptContext1_SetupScript(EventScript_StartTrainerApproach);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(EventScript_StartTrainerApproach);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript)
|
||||
@ -1207,8 +1207,8 @@ void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript)
|
||||
|
||||
void SetUpTwoTrainersBattle(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_StartTrainerApproach);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(EventScript_StartTrainerApproach);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool32 GetTrainerFlagFromScriptPointer(const u8 *data)
|
||||
@ -1320,7 +1320,7 @@ void BattleSetup_StartTrainerBattle(void)
|
||||
else
|
||||
DoTrainerBattle();
|
||||
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
static void CB2_EndTrainerBattle(void)
|
||||
@ -1371,7 +1371,7 @@ void BattleSetup_StartRematchBattle(void)
|
||||
gBattleTypeFlags = BATTLE_TYPE_TRAINER;
|
||||
gMain.savedCallback = CB2_EndRematchBattle;
|
||||
DoTrainerBattle();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
void ShowTrainerIntroSpeech(void)
|
||||
|
@ -1853,8 +1853,8 @@ static void Task_ShowRankings(u8 taskId)
|
||||
ClearWindowTilemap(tWindowId);
|
||||
RemoveWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Enable();
|
||||
UnlockPlayerFieldControls();
|
||||
tState = 0;
|
||||
return;
|
||||
}
|
||||
@ -1865,7 +1865,7 @@ void ShowBerryCrushRankings(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
taskId = CreateTask(Task_ShowRankings, 0);
|
||||
gTasks[taskId].tPressingSpeeds(0) = gSaveBlock2Ptr->berryCrush.pressingSpeeds[0];
|
||||
gTasks[taskId].tPressingSpeeds(1) = gSaveBlock2Ptr->berryCrush.pressingSpeeds[1];
|
||||
|
@ -86,7 +86,7 @@ void DoBrailleDigEffect(void)
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_BRAILLE_DIG);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool8 CheckRelicanthWailord(void)
|
||||
@ -152,7 +152,7 @@ static void Task_SealedChamberShakingEffect(u8 taskId)
|
||||
if (task->tShakeCounter == task->tNumShakes)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
InstallCameraPanAheadCallback();
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ static void DoBrailleRegirockEffect(void)
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool8 ShouldDoBrailleRegisteelEffect(void)
|
||||
@ -252,7 +252,7 @@ static void DoBrailleRegisteelEffect(void)
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
// theory: another commented out DoBrailleWait and Task_BrailleWait.
|
||||
|
@ -245,7 +245,7 @@ static void Task_LoadCableCar(u8 taskId)
|
||||
|
||||
void CableCar(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_LoadCableCar, 1);
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0));
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -2753,8 +2753,8 @@ static void Task_ContestReturnToField(u8 taskId)
|
||||
|
||||
static void FieldCB_ContestReturnToField(void)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void TryPutPlayerLast(void)
|
||||
|
@ -2129,7 +2129,7 @@ static void Task_StartContest(u8 taskId)
|
||||
|
||||
void StartContest(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_StartContest, 10);
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
|
||||
}
|
||||
@ -2150,7 +2150,7 @@ static void Task_StartShowContestResults(u8 taskId)
|
||||
|
||||
void ShowContestResults(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_StartShowContestResults, 10);
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
|
||||
}
|
||||
@ -2163,7 +2163,7 @@ void GetContestPlayerId(void)
|
||||
void ContestLinkTransfer(u8 category)
|
||||
{
|
||||
u8 newTaskId;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
newTaskId = CreateTask(Task_LinkContest_Init, 0);
|
||||
SetTaskFuncWithFollowupFunc(newTaskId, Task_LinkContest_Init, Task_StartCommunication);
|
||||
gTasks[newTaskId].data[9] = category;
|
||||
@ -2265,8 +2265,8 @@ void Task_LinkContest_FinalizeConnection(u8 taskId)
|
||||
|
||||
DestroyTask(taskId);
|
||||
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, WARP_ID_NONE);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2281,8 +2281,8 @@ static void Task_LinkContest_WaitDisconnect(u8 taskId)
|
||||
if (!gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2726,7 +2726,7 @@ static void Task_LinkContestWaitForConnection(u8 taskId)
|
||||
default:
|
||||
if (IsLinkTaskFinished() == 1)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
@ -1258,7 +1258,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
||||
ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE);
|
||||
RemoveWindow(gTasks[taskId].tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
@ -1267,7 +1267,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
|
||||
ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE);
|
||||
RemoveWindow(gTasks[taskId].tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ static void AddDecorationActionsWindow(void)
|
||||
static void InitDecorationActionsWindow(void)
|
||||
{
|
||||
sDecorationActionsCursorPos = 0;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
AddDecorationActionsWindow();
|
||||
PrintCurMainMenuDescription();
|
||||
}
|
||||
@ -670,7 +670,7 @@ static void DecorationMenuAction_Cancel(u8 taskId)
|
||||
RemoveDecorationWindow(WINDOW_MAIN_MENU);
|
||||
if (!sDecorationContext.isPlayerRoom)
|
||||
{
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_PCCancel);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_PCCancel);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else
|
||||
@ -1650,7 +1650,7 @@ static void PlaceDecoration(u8 taskId)
|
||||
{
|
||||
sCurDecorMapX = gTasks[taskId].tCursorX - MAP_OFFSET;
|
||||
sCurDecorMapY = gTasks[taskId].tCursorY - MAP_OFFSET;
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_SetDecoration);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_SetDecoration);
|
||||
}
|
||||
|
||||
gSprites[sDecor_CameraSpriteObjectIdx1].y += 2;
|
||||
@ -1722,7 +1722,7 @@ static void c1_overworld_prev_quest(u8 taskId)
|
||||
switch (gTasks[taskId].tState)
|
||||
{
|
||||
case 0:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
WarpToInitialPosition(taskId);
|
||||
@ -1749,11 +1749,11 @@ static void Task_InitDecorationItemsWindow(u8 taskId)
|
||||
tState++;
|
||||
break;
|
||||
case 1:
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_InitDecorations);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_InitDecorations);
|
||||
tState++;
|
||||
break;
|
||||
case 2:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
tState++;
|
||||
break;
|
||||
case 3:
|
||||
@ -1767,7 +1767,7 @@ static void FieldCB_InitDecorationItemsWindow(void)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeInFromBlack();
|
||||
taskId = CreateTask(Task_InitDecorationItemsWindow, 8);
|
||||
AddDecorationItemsWindow(taskId);
|
||||
@ -2246,13 +2246,13 @@ static void Task_PutAwayDecoration(u8 taskId)
|
||||
case 1:
|
||||
if (!gPaletteFade.active) {
|
||||
DrawWholeMapView();
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_PutAwayDecoration);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_PutAwayDecoration);
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
gTasks[taskId].tState = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
IdentifyOwnedDecorationsCurrentlyInUseInternal(taskId);
|
||||
FadeInFromBlack();
|
||||
gTasks[taskId].tState = 3;
|
||||
@ -2645,11 +2645,11 @@ static void Task_ReinitializeDecorationMenuHandler(u8 taskId)
|
||||
tState++;
|
||||
break;
|
||||
case 1:
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_InitDecorations);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_InitDecorations);
|
||||
tState++;
|
||||
break;
|
||||
case 2:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
tState++;
|
||||
break;
|
||||
case 3:
|
||||
|
@ -2988,7 +2988,7 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId)
|
||||
{
|
||||
RemoveWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ static void VBlankCB_EggHatch(void)
|
||||
|
||||
void EggHatch(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_EggHatch, 10);
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ static bool8 TryStartInteractionScript(struct MapPosition *position, u16 metatil
|
||||
&& script != EventScript_PC)
|
||||
PlaySE(SE_SELECT);
|
||||
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext_SetupScript(script);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ static bool32 TrySetupDiveDownScript(void)
|
||||
{
|
||||
if (FlagGet(FLAG_BADGE07_GET) && TrySetDiveWarp() == 2)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_UseDive);
|
||||
ScriptContext_SetupScript(EventScript_UseDive);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -474,7 +474,7 @@ static bool32 TrySetupDiveEmergeScript(void)
|
||||
{
|
||||
if (FlagGet(FLAG_BADGE07_GET) && gMapHeader.mapType == MAP_TYPE_UNDERWATER && TrySetDiveWarp() == 1)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_UseDiveUnderwater);
|
||||
ScriptContext_SetupScript(EventScript_UseDiveUnderwater);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -501,7 +501,7 @@ static bool8 TryStartCoordEventScript(struct MapPosition *position)
|
||||
|
||||
if (script == NULL)
|
||||
return FALSE;
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext_SetupScript(script);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -511,12 +511,12 @@ static bool8 TryStartMiscWalkingScripts(u16 metatileBehavior)
|
||||
|
||||
if (MetatileBehavior_IsCrackedFloorHole(metatileBehavior))
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_FallDownHole);
|
||||
ScriptContext_SetupScript(EventScript_FallDownHole);
|
||||
return TRUE;
|
||||
}
|
||||
else if (MetatileBehavior_IsBattlePyramidWarp(metatileBehavior))
|
||||
{
|
||||
ScriptContext1_SetupScript(BattlePyramid_WarpToNextFloor);
|
||||
ScriptContext_SetupScript(BattlePyramid_WarpToNextFloor);
|
||||
return TRUE;
|
||||
}
|
||||
else if (MetatileBehavior_IsSecretBaseGlitterMat(metatileBehavior) == TRUE)
|
||||
@ -548,48 +548,48 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
|
||||
{
|
||||
if (UpdatePoisonStepCounter() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_FieldPoison);
|
||||
ScriptContext_SetupScript(EventScript_FieldPoison);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldEggHatch())
|
||||
{
|
||||
IncrementGameStat(GAME_STAT_HATCHED_EGGS);
|
||||
ScriptContext1_SetupScript(EventScript_EggHatch);
|
||||
ScriptContext_SetupScript(EventScript_EggHatch);
|
||||
return TRUE;
|
||||
}
|
||||
if (AbnormalWeatherHasExpired() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(AbnormalWeather_EventScript_EndEventAndCleanup_1);
|
||||
ScriptContext_SetupScript(AbnormalWeather_EventScript_EndEventAndCleanup_1);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoBrailleRegicePuzzle() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(IslandCave_EventScript_OpenRegiEntrance);
|
||||
ScriptContext_SetupScript(IslandCave_EventScript_OpenRegiEntrance);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoWallyCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(MauvilleCity_EventScript_RegisterWallyCall);
|
||||
ScriptContext_SetupScript(MauvilleCity_EventScript_RegisterWallyCall);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoScottFortreeCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(Route119_EventScript_ScottWonAtFortreeGymCall);
|
||||
ScriptContext_SetupScript(Route119_EventScript_ScottWonAtFortreeGymCall);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoScottBattleFrontierCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(LittlerootTown_ProfessorBirchsLab_EventScript_ScottAboardSSTidalCall);
|
||||
ScriptContext_SetupScript(LittlerootTown_ProfessorBirchsLab_EventScript_ScottAboardSSTidalCall);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoRoxanneCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(RustboroCity_Gym_EventScript_RegisterRoxanne);
|
||||
ScriptContext_SetupScript(RustboroCity_Gym_EventScript_RegisterRoxanne);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoRivalRayquazaCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(MossdeepCity_SpaceCenter_2F_EventScript_RivalRayquazaCall);
|
||||
ScriptContext_SetupScript(MossdeepCity_SpaceCenter_2F_EventScript_RivalRayquazaCall);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -598,7 +598,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
|
||||
return TRUE;
|
||||
if (CountSSTidalStep(1) == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(SSTidalCorridor_EventScript_ReachedStepCount);
|
||||
ScriptContext_SetupScript(SSTidalCorridor_EventScript_ReachedStepCount);
|
||||
return TRUE;
|
||||
}
|
||||
if (TryStartMatchCall())
|
||||
@ -735,7 +735,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
|
||||
}
|
||||
if (MetatileBehavior_IsMtPyreHole(metatileBehavior) == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_FallDownHoleMtPyre);
|
||||
ScriptContext_SetupScript(EventScript_FallDownHoleMtPyre);
|
||||
return TRUE;
|
||||
}
|
||||
if (MetatileBehavior_IsMossdeepGymWarp(metatileBehavior) == TRUE)
|
||||
@ -886,7 +886,7 @@ static u8 *TryRunCoordEventScript(struct CoordEvent *coordEvent)
|
||||
}
|
||||
if (coordEvent->trigger == 0)
|
||||
{
|
||||
ScriptContext2_RunNewScript(coordEvent->script);
|
||||
RunScriptImmediately(coordEvent->script);
|
||||
return NULL;
|
||||
}
|
||||
if (VarGet(coordEvent->trigger) == (u8)coordEvent->index)
|
||||
|
@ -1337,7 +1337,7 @@ static void FieldCallback_UseFly(void)
|
||||
{
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_UseFly, 0);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
@ -1378,7 +1378,7 @@ static void FieldCallback_FlyIntoMap(void)
|
||||
{
|
||||
ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], DIR_WEST);
|
||||
}
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ static void Task_FlyIntoMap(u8 taskId)
|
||||
}
|
||||
if (!FieldEffectActiveListContains(FLDEFF_FLY_IN))
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@ -1417,7 +1417,7 @@ void FieldCB_FallWarpExit(void)
|
||||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CreateTask(Task_FallWarpFieldEffect, 0);
|
||||
gFieldCallback = NULL;
|
||||
@ -1531,7 +1531,7 @@ static bool8 FallWarpEffect_CameraShake(struct Task *task)
|
||||
static bool8 FallWarpEffect_End(struct Task *task)
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
CameraObjectReset1();
|
||||
UnfreezeObjectEvents();
|
||||
InstallCameraPanAheadCallback();
|
||||
@ -1683,7 +1683,7 @@ static void FieldCallback_EscalatorWarpIn(void)
|
||||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_EscalatorWarpIn, 0);
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
@ -1804,7 +1804,7 @@ static bool8 EscalatorWarpIn_End(struct Task *task)
|
||||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
CameraObjectReset1();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
ObjectEventSetHeldMovement(objectEvent, GetWalkNormalMovementAction(DIR_EAST));
|
||||
DestroyTask(FindTaskIdByFunc(Task_EscalatorWarpIn));
|
||||
}
|
||||
@ -1832,7 +1832,7 @@ static void Task_UseWaterfall(u8 taskId)
|
||||
|
||||
static bool8 WaterfallFieldEffect_Init(struct Task *task, struct ObjectEvent *objectEvent)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
@ -1840,7 +1840,7 @@ static bool8 WaterfallFieldEffect_Init(struct Task *task, struct ObjectEvent *ob
|
||||
|
||||
static bool8 WaterfallFieldEffect_ShowMon(struct Task *task, struct ObjectEvent *objectEvent)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
if (!ObjectEventIsMovementOverridden(objectEvent))
|
||||
{
|
||||
ObjectEventClearHeldMovementIfFinished(objectEvent);
|
||||
@ -1880,7 +1880,7 @@ static bool8 WaterfallFieldEffect_ContinueRideOrEnd(struct Task *task, struct Ob
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
DestroyTask(FindTaskIdByFunc(Task_UseWaterfall));
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_WATERFALL);
|
||||
@ -1914,7 +1914,7 @@ static bool8 DiveFieldEffect_Init(struct Task *task)
|
||||
|
||||
static bool8 DiveFieldEffect_ShowMon(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldEffectArguments[0] = task->data[15];
|
||||
FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT);
|
||||
task->data[0]++;
|
||||
@ -2052,7 +2052,7 @@ static void FieldCB_LavaridgeGymB1FWarpExit(void)
|
||||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldCallback = NULL;
|
||||
CreateTask(Task_LavaridgeGymB1FWarpExit, 0);
|
||||
}
|
||||
@ -2105,7 +2105,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_End(struct Task *task, struct ObjectE
|
||||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(Task_LavaridgeGymB1FWarpExit));
|
||||
}
|
||||
@ -2229,7 +2229,7 @@ void SpriteCB_AshPuff(struct Sprite *sprite)
|
||||
|
||||
void StartEscapeRopeFieldEffect(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CreateTask(Task_EscapeRopeWarpOut, 80);
|
||||
}
|
||||
@ -2286,7 +2286,7 @@ static void FieldCallback_EscapeRopeWarpIn(void)
|
||||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
@ -2320,7 +2320,7 @@ static void EscapeRopeWarpInEffect_Spin(struct Task *task)
|
||||
if (task->tNumTurns >= 32 && task->tStartDir == GetPlayerFacingDirection())
|
||||
{
|
||||
objectEvent->invisible = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(Task_EscapeRopeWarpIn));
|
||||
return;
|
||||
@ -2360,7 +2360,7 @@ static void Task_TeleportWarpOut(u8 taskId)
|
||||
|
||||
static void TeleportWarpOutFieldEffect_Init(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
task->data[15] = GetPlayerFacingDirection();
|
||||
@ -2440,7 +2440,7 @@ static void FieldCallback_TeleportWarpIn(void)
|
||||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
@ -2527,7 +2527,7 @@ static void TeleportWarpInFieldEffect_SpinGround(struct Task *task)
|
||||
task->data[1] = 8;
|
||||
if ((++task->data[2]) > 4 && task->data[14] == objectEvent->facingDirection)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
CameraObjectReset1();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(Task_TeleportWarpIn));
|
||||
@ -2993,7 +2993,7 @@ static void Task_SurfFieldEffect(u8 taskId)
|
||||
|
||||
static void SurfFieldEffect_Init(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING);
|
||||
@ -3054,7 +3054,7 @@ static void SurfFieldEffect_End(struct Task *task)
|
||||
ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(objectEvent->movementDirection));
|
||||
SetSurfBlob_BobState(objectEvent->fieldEffectSpriteId, BOB_PLAYER_AND_MON);
|
||||
UnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_SURF);
|
||||
DestroyTask(FindTaskIdByFunc(Task_SurfFieldEffect));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -98,7 +98,7 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId)
|
||||
{
|
||||
gSpecialVar_Result = FLDPSN_NO_WHITEOUT;
|
||||
}
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@ -110,7 +110,7 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId)
|
||||
void TryFieldPoisonWhiteOut(void)
|
||||
{
|
||||
CreateTask(Task_TryFieldPoisonWhiteOut, 80);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
s32 DoPoisonFieldEffect(void)
|
||||
|
@ -124,7 +124,7 @@ static void Task_WaitForUnionRoomFade(u8 taskId)
|
||||
|
||||
void FieldCB_ContinueScriptUnionRoom(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_WaitForUnionRoomFade, 10);
|
||||
@ -135,13 +135,13 @@ static void Task_WaitForFadeAndEnableScriptCtx(u8 taskID)
|
||||
if (WaitForWeatherFadeIn() == TRUE)
|
||||
{
|
||||
DestroyTask(taskID);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
void FieldCB_ContinueScriptHandleMusic(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_WaitForFadeAndEnableScriptCtx, 10);
|
||||
@ -149,7 +149,7 @@ void FieldCB_ContinueScriptHandleMusic(void)
|
||||
|
||||
void FieldCB_ContinueScript(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_WaitForFadeAndEnableScriptCtx, 10);
|
||||
}
|
||||
@ -174,7 +174,7 @@ static void Task_ReturnToFieldCableLink(u8 taskId)
|
||||
case 2:
|
||||
if (WaitForWeatherFadeIn() == TRUE)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
@ -183,7 +183,7 @@ static void Task_ReturnToFieldCableLink(u8 taskId)
|
||||
|
||||
void FieldCB_ReturnToFieldCableLink(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FillPalBufferBlack();
|
||||
CreateTask(Task_ReturnToFieldCableLink, 10);
|
||||
@ -215,7 +215,7 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
|
||||
if (WaitForWeatherFadeIn() == TRUE)
|
||||
{
|
||||
StartSendingKeysToLink();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
@ -239,7 +239,7 @@ void Task_ReturnToFieldRecordMixing(u8 taskId)
|
||||
case 2:
|
||||
StartSendingKeysToLink();
|
||||
ResetAllMultiplayerState();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@ -247,7 +247,7 @@ void Task_ReturnToFieldRecordMixing(u8 taskId)
|
||||
|
||||
void FieldCB_ReturnToFieldWirelessLink(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FillPalBufferBlack();
|
||||
CreateTask(Task_ReturnToFieldWirelessLink, 10);
|
||||
@ -275,7 +275,7 @@ void FieldCB_DefaultWarpExit(void)
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
SetUpWarpExitTask();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void FieldCB_WarpExitFadeFromWhite(void)
|
||||
@ -283,7 +283,7 @@ void FieldCB_WarpExitFadeFromWhite(void)
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FadeInFromWhite();
|
||||
SetUpWarpExitTask();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void FieldCB_WarpExitFadeFromBlack(void)
|
||||
@ -292,7 +292,7 @@ void FieldCB_WarpExitFadeFromBlack(void)
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FadeInFromBlack();
|
||||
SetUpWarpExitTask();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void FieldCB_SpinEnterWarp(void)
|
||||
@ -301,7 +301,7 @@ static void FieldCB_SpinEnterWarp(void)
|
||||
WarpFadeInScreen();
|
||||
PlaySE(SE_WARP_OUT);
|
||||
CreateTask(Task_SpinEnterWarp, 10);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void FieldCB_MossdeepGymWarpExit(void)
|
||||
@ -310,7 +310,7 @@ static void FieldCB_MossdeepGymWarpExit(void)
|
||||
WarpFadeInScreen();
|
||||
PlaySE(SE_WARP_OUT);
|
||||
CreateTask(Task_ExitNonDoor, 10);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
SetObjectEventLoadFlag((~SKIP_OBJECT_EVENT_LOAD) & 0xF);
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ static void Task_ExitDoor(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@ -395,7 +395,7 @@ static void Task_ExitNonAnimDoor(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@ -407,14 +407,14 @@ static void Task_ExitNonDoor(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gTasks[taskId].tState++;
|
||||
break;
|
||||
case 1:
|
||||
if (WaitForWeatherFadeIn())
|
||||
{
|
||||
UnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
@ -434,7 +434,7 @@ void ReturnToFieldOpenStartMenu(void)
|
||||
{
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_WaitForFadeShowStartMenu, 0x50);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool8 FieldCB_ReturnToFieldOpenStartMenu(void)
|
||||
@ -447,7 +447,7 @@ static void Task_ReturnToFieldNoScript(u8 taskId)
|
||||
{
|
||||
if (WaitForWeatherFadeIn() == 1)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
}
|
||||
@ -455,14 +455,14 @@ static void Task_ReturnToFieldNoScript(u8 taskId)
|
||||
|
||||
void FieldCB_ReturnToFieldNoScript(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_ReturnToFieldNoScript, 10);
|
||||
}
|
||||
|
||||
void FieldCB_ReturnToFieldNoScriptCheckMusic(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_ReturnToFieldNoScript, 10);
|
||||
@ -483,7 +483,7 @@ static bool32 WaitForWeatherFadeIn(void)
|
||||
|
||||
void DoWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeOutScreen();
|
||||
PlayRainStoppingSoundEffect();
|
||||
@ -494,7 +494,7 @@ void DoWarp(void)
|
||||
|
||||
void DoDiveWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeOutScreen();
|
||||
PlayRainStoppingSoundEffect();
|
||||
@ -504,7 +504,7 @@ void DoDiveWarp(void)
|
||||
|
||||
void DoWhiteFadeWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
FadeScreen(FADE_TO_WHITE, 8);
|
||||
PlayRainStoppingSoundEffect();
|
||||
@ -514,7 +514,7 @@ void DoWhiteFadeWarp(void)
|
||||
|
||||
void DoDoorWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldCallback = FieldCB_DefaultWarpExit;
|
||||
CreateTask(Task_DoDoorWarp, 10);
|
||||
}
|
||||
@ -527,19 +527,19 @@ void DoFallWarp(void)
|
||||
|
||||
void DoEscalatorWarp(u8 metatileBehavior)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
StartEscalatorWarp(metatileBehavior, 10);
|
||||
}
|
||||
|
||||
void DoLavaridgeGymB1FWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
StartLavaridgeGymB1FWarp(10);
|
||||
}
|
||||
|
||||
void DoLavaridgeGym1FWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
StartLavaridgeGym1FWarp(10);
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ void DoLavaridgeGym1FWarp(void)
|
||||
// Used by teleporting tiles, e.g. in Aqua Hideout (For the move Teleport see FldEff_TeleportWarpOut)
|
||||
void DoTeleportTileWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeOutScreen();
|
||||
PlaySE(SE_WARP_IN);
|
||||
@ -559,7 +559,7 @@ void DoTeleportTileWarp(void)
|
||||
void DoMossdeepGymWarp(void)
|
||||
{
|
||||
SetObjectEventLoadFlag(SKIP_OBJECT_EVENT_LOAD);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
SaveObjectEvents();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeOutScreen();
|
||||
@ -570,7 +570,7 @@ void DoMossdeepGymWarp(void)
|
||||
|
||||
void DoPortholeWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
WarpFadeOutScreen();
|
||||
CreateTask(Task_WarpAndLoadMap, 10);
|
||||
gFieldCallback = FieldCB_ShowPortholeView;
|
||||
@ -583,7 +583,7 @@ static void Task_DoCableClubWarp(u8 taskId)
|
||||
switch (task->tState)
|
||||
{
|
||||
case 0:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
task->tState++;
|
||||
break;
|
||||
case 1:
|
||||
@ -600,7 +600,7 @@ static void Task_DoCableClubWarp(u8 taskId)
|
||||
|
||||
void DoCableClubWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeOutScreen();
|
||||
PlaySE(SE_EXIT);
|
||||
@ -651,7 +651,7 @@ static void Task_WarpAndLoadMap(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
task->tState++;
|
||||
break;
|
||||
case 1:
|
||||
@ -735,7 +735,7 @@ static void Task_DoContestHallWarp(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
task->tState++;
|
||||
break;
|
||||
case 1:
|
||||
@ -754,7 +754,7 @@ static void Task_DoContestHallWarp(u8 taskId)
|
||||
|
||||
void DoContestHallWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeOutScreen();
|
||||
PlayRainStoppingSoundEffect();
|
||||
@ -916,7 +916,7 @@ static void Task_WaitForFlashUpdate(u8 taskId)
|
||||
{
|
||||
if (!FuncIsActiveTask(UpdateFlashLevelEffect))
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@ -979,7 +979,7 @@ void AnimateFlash(u8 newFlashLevel)
|
||||
fullBrightness = TRUE;
|
||||
StartUpdateFlashLevelEffect(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sFlashLevelToRadius[curFlashLevel], sFlashLevelToRadius[newFlashLevel], fullBrightness, 1);
|
||||
StartWaitForFlashUpdate();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void WriteFlashScanlineEffectBuffer(u8 flashLevel)
|
||||
@ -1003,7 +1003,7 @@ static void Task_SpinEnterWarp(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
DoPlayerSpinEntrance();
|
||||
gTasks[taskId].tState++;
|
||||
break;
|
||||
@ -1011,7 +1011,7 @@ static void Task_SpinEnterWarp(u8 taskId)
|
||||
if (WaitForWeatherFadeIn() && IsPlayerSpinEntranceActive() != TRUE)
|
||||
{
|
||||
UnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
@ -1026,7 +1026,7 @@ static void Task_SpinExitWarp(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
PlaySE(SE_WARP_IN);
|
||||
DoPlayerSpinExit();
|
||||
task->tState++;
|
||||
@ -1054,7 +1054,7 @@ static void Task_SpinExitWarp(u8 taskId)
|
||||
// DoTeleportTileWarp is used instead
|
||||
void DoSpinEnterWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_WarpAndLoadMap, 10);
|
||||
gFieldCallback = FieldCB_SpinEnterWarp;
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ void DoSpinEnterWarp(void)
|
||||
// Player exits current map by spinning up offscreen, enters new map with a fade in
|
||||
void DoSpinExitWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldCallback = FieldCB_DefaultWarpExit;
|
||||
CreateTask(Task_SpinExitWarp, 10);
|
||||
}
|
||||
@ -1152,7 +1152,7 @@ static void Task_OrbEffect(u8 taskId)
|
||||
case 2:
|
||||
if (!FuncIsActiveTask(UpdateOrbFlashEffect))
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
tState = 3;
|
||||
}
|
||||
break;
|
||||
@ -1200,7 +1200,7 @@ static void Task_OrbEffect(u8 taskId)
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, tBldAlpha);
|
||||
SetGpuReg(REG_OFFSET_WININ, tWinIn);
|
||||
SetGpuReg(REG_OFFSET_WINOUT, tWinOut);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
@ -1263,6 +1263,6 @@ static void Task_EnableScriptAfterMusicFade(u8 taskId)
|
||||
if (BGMusicStopped() == TRUE)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ static void Task_HandleTruckSequence(u8 taskId)
|
||||
DrawWholeMapView();
|
||||
PlaySE(SE_TRUCK_DOOR);
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -263,7 +263,7 @@ void ExecuteTruckSequence(void)
|
||||
MapGridSetMetatileIdAt(4 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_InsideOfTruck_DoorClosedFloor_Mid);
|
||||
MapGridSetMetatileIdAt(4 + MAP_OFFSET, 3 + MAP_OFFSET, METATILE_InsideOfTruck_DoorClosedFloor_Bottom);
|
||||
DrawWholeMapView();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CpuFastFill(0, gPlttBufferFaded, 0x400);
|
||||
CreateTask(Task_HandleTruckSequence, 0xA);
|
||||
}
|
||||
@ -371,7 +371,7 @@ void FieldCB_ShowPortholeView(void)
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
FadeInFromBlack();
|
||||
CreateTask(Task_HandlePorthole, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void LookThroughPorthole(void)
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ static void Task_RunTimeBasedEvents(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
if (!ScriptContext2_IsEnabled())
|
||||
if (!ArePlayerFieldControlsLocked())
|
||||
{
|
||||
RunTimeBasedEvents(data);
|
||||
UpdateAmbientCry(&tAmbientCryState, &tAmbientCryDelay);
|
||||
|
@ -339,7 +339,7 @@ static void UpdateDroughtBlend(u8 taskId)
|
||||
task->tState++;
|
||||
break;
|
||||
case 4:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ static void FldEff_UseFlash(void)
|
||||
{
|
||||
PlaySE(SE_M_REFLECT);
|
||||
FlagSet(FLAG_SYS_USE_FLASH);
|
||||
ScriptContext1_SetupScript(EventScript_UseFlash);
|
||||
ScriptContext_SetupScript(EventScript_UseFlash);
|
||||
}
|
||||
|
||||
static void CB2_ChangeMapMain(void)
|
||||
|
@ -586,7 +586,7 @@ bool8 SetUpFieldMove_SecretPower(void)
|
||||
static void FieldCallback_SecretBaseCave(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_CaveUseSecretPower);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_CaveUseSecretPower);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseSecretPowerCave(void)
|
||||
@ -640,13 +640,13 @@ static void SpriteCB_CaveEntranceOpen(struct Sprite *sprite)
|
||||
static void SpriteCB_CaveEntranceEnd(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SECRET_POWER_CAVE);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void FieldCallback_SecretBaseTree(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_TreeUseSecretPower);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_TreeUseSecretPower);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseSecretPowerTree(void)
|
||||
@ -714,13 +714,13 @@ static void SpriteCB_TreeEntranceOpen(struct Sprite *sprite)
|
||||
static void SpriteCB_TreeEntranceEnd(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SECRET_POWER_TREE);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void FieldCallback_SecretBaseShrub(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_ShrubUseSecretPower);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_ShrubUseSecretPower);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseSecretPowerShrub(void)
|
||||
@ -778,7 +778,7 @@ static void SpriteCB_ShrubEntranceOpen(struct Sprite *sprite)
|
||||
static void SpriteCB_ShrubEntranceEnd(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SECRET_POWER_SHRUB);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
#define tX data[0]
|
||||
@ -820,7 +820,7 @@ static void Task_SecretBasePCTurnOn(u8 taskId)
|
||||
MapGridSetMetatileIdAt(tX, tY, METATILE_SecretBase_PC_On);
|
||||
CurrentMapDrawMetatileAt(tX, tY);
|
||||
FieldEffectActiveListRemove(FLDEFF_PCTURN_ON);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
@ -1034,7 +1034,7 @@ bool8 FldEff_SandPillar(void)
|
||||
{
|
||||
s16 x, y;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
|
||||
gFieldEffectArguments[5] = x;
|
||||
@ -1113,7 +1113,7 @@ static void SpriteCB_SandPillar_BreakBase(struct Sprite *sprite)
|
||||
static void SpriteCB_SandPillar_End(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SAND_PILLAR);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void InteractWithShieldOrTVDecoration(void)
|
||||
@ -1279,7 +1279,7 @@ static void Task_WateringBerryTreeAnim_End(u8 taskId)
|
||||
{
|
||||
SetPlayerAvatarTransitionFlags(GetPlayerAvatarFlags());
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void DoWateringBerryTreeAnim(void)
|
||||
|
@ -55,7 +55,7 @@ static void Task_DoFieldMove_Init(u8 taskId)
|
||||
{
|
||||
u8 objEventId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objEventId = gPlayerAvatar.objectEventId;
|
||||
if (!ObjectEventIsMovementOverridden(&gObjectEvents[objEventId])
|
||||
@ -144,7 +144,7 @@ bool8 SetUpFieldMove_RockSmash(void)
|
||||
static void FieldCallback_RockSmash(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(EventScript_UseRockSmash);
|
||||
ScriptContext_SetupScript(EventScript_UseRockSmash);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseRockSmash(void)
|
||||
@ -162,5 +162,5 @@ static void FieldMove_RockSmash(void)
|
||||
{
|
||||
PlaySE(SE_M_ROCK_THROW);
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_ROCK_SMASH);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ bool8 SetUpFieldMove_Strength(void)
|
||||
static void FieldCallback_Strength(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = GetCursorSelectionMonId();
|
||||
ScriptContext1_SetupScript(EventScript_UseStrength);
|
||||
ScriptContext_SetupScript(EventScript_UseStrength);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseStrength(void)
|
||||
@ -46,5 +46,5 @@ bool8 FldEff_UseStrength(void)
|
||||
static void StartStrengthFieldEffect(void)
|
||||
{
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ static void FailSweetScentEncounter(u8 taskId)
|
||||
{
|
||||
CpuFastSet(gPaletteDecompressionBuffer, gPlttBufferUnfaded, 0x100);
|
||||
SetWeatherPalStateIdle();
|
||||
ScriptContext1_SetupScript(EventScript_FailSweetScent);
|
||||
ScriptContext_SetupScript(EventScript_FailSweetScent);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ static void Task_WaitForPaletteFade(u8);
|
||||
void AccessHallOfFamePC(void)
|
||||
{
|
||||
SetMainCallback2(CB2_DoHallOfFamePC);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ReturnFromHallOfFamePC(void)
|
||||
@ -25,7 +25,7 @@ void ReturnFromHallOfFamePC(void)
|
||||
|
||||
static void ReshowPCMenuAfterHallOfFamePC(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
ScriptMenu_CreatePCMultichoice();
|
||||
ScriptMenu_DisplayPCStartupPrompt();
|
||||
|
@ -2044,7 +2044,7 @@ bool8 UseRegisteredKeyItemOnField(void)
|
||||
{
|
||||
if (CheckBagHasItem(gSaveBlock1Ptr->registeredItem, 1) == TRUE)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
PlayerFreeze();
|
||||
StopPlayerAvatar();
|
||||
@ -2058,7 +2058,7 @@ bool8 UseRegisteredKeyItemOnField(void)
|
||||
gSaveBlock1Ptr->registeredItem = ITEM_NONE;
|
||||
}
|
||||
}
|
||||
ScriptContext1_SetupScript(EventScript_SelectWithoutRegisteredItem);
|
||||
ScriptContext_SetupScript(EventScript_SelectWithoutRegisteredItem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2373,7 +2373,7 @@ static void ItemMenu_Show(u8 taskId)
|
||||
|
||||
static void CB2_ApprenticeExitBagMenu(void)
|
||||
{
|
||||
gFieldCallback = Apprentice_EnableBothScriptContexts;
|
||||
gFieldCallback = Apprentice_ScriptContext_Enable;
|
||||
SetMainCallback2(CB2_ReturnToField);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ static void Task_CloseCantUseKeyItemMessage(u8 taskId)
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
DestroyTask(taskId);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId)
|
||||
@ -222,7 +222,7 @@ static void ItemUseOnFieldCB_Bike(u8 taskId)
|
||||
else // ACRO_BIKE
|
||||
GetOnOffBike(PLAYER_AVATAR_FLAG_ACRO_BIKE);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ static void Task_CloseItemfinderMessage(u8 taskId)
|
||||
{
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@ -692,8 +692,8 @@ void ItemUseOutOfBattle_Berry(u8 taskId)
|
||||
static void ItemUseOnFieldCB_Berry(u8 taskId)
|
||||
{
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext1_SetupScript(BerryTree_EventScript_ItemUsePlantBerry);
|
||||
LockPlayerFieldControls();
|
||||
ScriptContext_SetupScript(BerryTree_EventScript_ItemUsePlantBerry);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@ -717,8 +717,8 @@ void ItemUseOutOfBattle_WailmerPail(u8 taskId)
|
||||
|
||||
static void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext1_SetupScript(BerryTree_EventScript_ItemUseWailmerPail);
|
||||
LockPlayerFieldControls();
|
||||
ScriptContext_SetupScript(BerryTree_EventScript_ItemUseWailmerPail);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@ -738,8 +738,8 @@ static bool8 TryToWaterSudowoodo(void)
|
||||
|
||||
static void ItemUseOnFieldCB_WailmerPailSudowoodo(u8 taskId)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext1_SetupScript(BattleFrontier_OutsideEast_EventScript_WaterSudowoodo);
|
||||
LockPlayerFieldControls();
|
||||
ScriptContext_SetupScript(BattleFrontier_OutsideEast_EventScript_WaterSudowoodo);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ void SetFavorLadyState_Complete(void)
|
||||
|
||||
void FieldCallback_FavorLadyEnableScriptContexts(void)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void QuizLadyPickQuestion(void)
|
||||
@ -571,7 +571,7 @@ void BufferQuizCorrectAnswer(void)
|
||||
|
||||
void FieldCallback_QuizLadyEnableScriptContexts(void)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady)
|
||||
|
@ -1183,7 +1183,7 @@ static void StartMatchCall(void)
|
||||
{
|
||||
if (!sMatchCallState.triggeredFromScript)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
PlayerFreeze();
|
||||
StopPlayerAvatar();
|
||||
@ -1371,7 +1371,7 @@ static bool32 MatchCall_EndCall(u8 taskId)
|
||||
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]);
|
||||
ScriptMovement_UnfreezeObjectEvents();
|
||||
UnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -222,7 +222,7 @@ static void PrepareSongText(void)
|
||||
void PlayBardSong(void)
|
||||
{
|
||||
StartBardSong(gSpecialVar_0x8004);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
void GetHipsterSpokenFlag(void)
|
||||
@ -627,7 +627,7 @@ static void Task_BardSong(u8 taskId)
|
||||
// End song
|
||||
FadeInBGM(6);
|
||||
m4aMPlayFadeOutTemporarily(&gMPlayInfo_SE2, 2);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else if (gStringVar4[task->tCharIndex] == CHAR_SPACE)
|
||||
@ -1375,7 +1375,7 @@ static void Task_StoryListMenu(u8 taskId)
|
||||
}
|
||||
ClearToTransparentAndRemoveWindow(sStorytellerWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ static void PlayerDescendMirageTower(u8 taskId)
|
||||
(gSprites[player->spriteId].y + gSprites[player->spriteId].y2))
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ static void FinishCeilingCrumbleTask(u8 taskId)
|
||||
{
|
||||
FreeSpriteTilesByTag(TAG_CEILING_CRUMBLE);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void CreateCeilingCrumbleSprites(void)
|
||||
@ -565,7 +565,7 @@ static void InitMirageTowerShake(u8 taskId)
|
||||
sBgShakeOffsets->bgVOFS = zero;
|
||||
CreateTask(UpdateBgShake, 10);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -654,7 +654,7 @@ static void DoMirageTowerDisintegration(u8 taskId)
|
||||
break;
|
||||
case 8:
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
break;
|
||||
}
|
||||
gTasks[taskId].tState++;
|
||||
@ -719,7 +719,7 @@ static void Task_FossilFallAndSink(u8 taskId)
|
||||
FREE_AND_SET_NULL(sFallingFossil);
|
||||
break;
|
||||
case 8:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
break;
|
||||
}
|
||||
gTasks[taskId].tState++;
|
||||
|
@ -365,7 +365,7 @@ static void VBlankCB_MoveRelearner(void)
|
||||
// Script arguments: The pokemon to teach is in VAR_0x8004
|
||||
void TeachMoveRelearnerMove(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_WaitForFadeOut, 10);
|
||||
// Fade to black
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
|
||||
|
@ -220,7 +220,7 @@ bool8 MEScrCmd_setmsg(struct ScriptContext *ctx)
|
||||
bool8 MEScrCmd_runscript(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
ScriptContext2_RunNewScript(script);
|
||||
RunScriptImmediately(script);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void NewGameInitData(void)
|
||||
ResetFanClub();
|
||||
ResetLotteryCorner();
|
||||
WarpToTruck();
|
||||
ScriptContext2_RunNewScript(EventScript_ResetAllMapFlags);
|
||||
RunScriptImmediately(EventScript_ResetAllMapFlags);
|
||||
ResetMiniGamesRecords();
|
||||
InitUnionRoomChatRegisteredTexts();
|
||||
InitLilycoveLady();
|
||||
|
@ -360,7 +360,7 @@ static void (*const sMovementStatusHandler[])(struct LinkPlayerObjectEvent *, st
|
||||
// code
|
||||
void DoWhiteOut(void)
|
||||
{
|
||||
ScriptContext2_RunNewScript(EventScript_WhiteOut);
|
||||
RunScriptImmediately(EventScript_WhiteOut);
|
||||
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
||||
HealPlayerParty();
|
||||
Overworld_ResetStateAfterWhiteOut();
|
||||
@ -386,7 +386,7 @@ void Overworld_ResetStateAfterTeleport(void)
|
||||
FlagClear(FLAG_SYS_SAFARI_MODE);
|
||||
FlagClear(FLAG_SYS_USE_STRENGTH);
|
||||
FlagClear(FLAG_SYS_USE_FLASH);
|
||||
ScriptContext2_RunNewScript(EventScript_ResetMrBriney);
|
||||
RunScriptImmediately(EventScript_ResetMrBriney);
|
||||
}
|
||||
|
||||
void Overworld_ResetStateAfterDigEscRope(void)
|
||||
@ -1432,11 +1432,11 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys)
|
||||
UpdatePlayerAvatarTransitionState();
|
||||
FieldClearPlayerInput(&inputStruct);
|
||||
FieldGetPlayerInput(&inputStruct, newKeys, heldKeys);
|
||||
if (!ScriptContext2_IsEnabled())
|
||||
if (!ArePlayerFieldControlsLocked())
|
||||
{
|
||||
if (ProcessPlayerFieldInput(&inputStruct) == 1)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
HideMapNamePopUpWindow();
|
||||
}
|
||||
else
|
||||
@ -1454,7 +1454,7 @@ void CB1_Overworld(void)
|
||||
|
||||
static void OverworldBasic(void)
|
||||
{
|
||||
ScriptContext2_RunScript();
|
||||
ScriptContext_RunScript();
|
||||
RunTasks();
|
||||
AnimateSprites();
|
||||
CameraUpdate();
|
||||
@ -1527,8 +1527,8 @@ void CB2_NewGame(void)
|
||||
NewGameInitData();
|
||||
ResetInitialPlayerAvatarState();
|
||||
PlayTimeCounter_Start();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
gFieldCallback = ExecuteTruckSequence;
|
||||
gFieldCallback2 = NULL;
|
||||
DoMapLoadLoop(&gMain.state);
|
||||
@ -1548,8 +1548,8 @@ void CB2_WhiteOut(void)
|
||||
ResetSafariZoneFlag_();
|
||||
DoWhiteOut();
|
||||
ResetInitialPlayerAvatarState();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
gFieldCallback = FieldCB_WarpExitFadeFromBlack;
|
||||
state = 0;
|
||||
DoMapLoadLoop(&state);
|
||||
@ -1562,8 +1562,8 @@ void CB2_WhiteOut(void)
|
||||
void CB2_LoadMap(void)
|
||||
{
|
||||
FieldClearVBlankHBlankCallbacks();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
SetMainCallback1(NULL);
|
||||
SetMainCallback2(CB2_DoChangeMap);
|
||||
gMain.savedCallback = CB2_LoadMap2;
|
||||
@ -1582,8 +1582,8 @@ void CB2_ReturnToFieldContestHall(void)
|
||||
if (!gMain.state)
|
||||
{
|
||||
FieldClearVBlankHBlankCallbacks();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
SetMainCallback1(NULL);
|
||||
}
|
||||
if (LoadMapInStepsLocal(&gMain.state, TRUE))
|
||||
@ -1652,8 +1652,8 @@ void CB2_ReturnToFieldFromMultiplayer(void)
|
||||
else
|
||||
gFieldCallback = FieldCB_ReturnToFieldCableLink;
|
||||
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
CB2_ReturnToField();
|
||||
}
|
||||
|
||||
@ -1723,8 +1723,8 @@ void CB2_ContinueSavedGame(void)
|
||||
InitMapFromSavedGame();
|
||||
|
||||
PlayTimeCounter_Start();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
InitMatchCallCounters();
|
||||
if (UseContinueGameWarp() == TRUE)
|
||||
{
|
||||
@ -1803,8 +1803,8 @@ static bool32 LoadMapInStepsLink(u8 *state)
|
||||
{
|
||||
case 0:
|
||||
InitOverworldBgs();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
ResetMirageTowerAndSaveBlockPtrs();
|
||||
ResetScreenForMapLoad();
|
||||
(*state)++;
|
||||
@ -2505,7 +2505,7 @@ static void ResetPlayerHeldKeys(u16 *keys)
|
||||
|
||||
static u16 KeyInterCB_SelfIdle(u32 key)
|
||||
{
|
||||
if (ScriptContext2_IsEnabled() == TRUE)
|
||||
if (ArePlayerFieldControlsLocked() == TRUE)
|
||||
return LINK_KEY_CODE_EMPTY;
|
||||
if (GetLinkRecvQueueLength() > 4)
|
||||
return LINK_KEY_CODE_HANDLE_RECV_QUEUE;
|
||||
@ -2525,7 +2525,7 @@ static u16 KeyInterCB_Idle(u32 key)
|
||||
static u16 KeyInterCB_DeferToEventScript(u32 key)
|
||||
{
|
||||
u16 retVal;
|
||||
if (ScriptContext2_IsEnabled() == TRUE)
|
||||
if (ArePlayerFieldControlsLocked() == TRUE)
|
||||
{
|
||||
retVal = LINK_KEY_CODE_EMPTY;
|
||||
}
|
||||
@ -2548,7 +2548,7 @@ static u16 KeyInterCB_DeferToRecvQueue(u32 key)
|
||||
else
|
||||
{
|
||||
retVal = LINK_KEY_CODE_IDLE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
SetKeyInterceptCallback(KeyInterCB_Idle);
|
||||
}
|
||||
return retVal;
|
||||
@ -2565,7 +2565,7 @@ static u16 KeyInterCB_DeferToSendQueue(u32 key)
|
||||
else
|
||||
{
|
||||
retVal = LINK_KEY_CODE_IDLE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
SetKeyInterceptCallback(KeyInterCB_Idle);
|
||||
}
|
||||
return retVal;
|
||||
@ -2618,7 +2618,7 @@ static u16 KeyInterCB_WaitForPlayersToExit(u32 keyOrPlayerId)
|
||||
CheckRfuKeepAliveTimer();
|
||||
if (AreAllPlayersInLinkState(PLAYER_LINK_STATE_EXITING_ROOM) == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_DoLinkRoomExit);
|
||||
ScriptContext_SetupScript(EventScript_DoLinkRoomExit);
|
||||
SetKeyInterceptCallback(KeyInterCB_SendNothing);
|
||||
}
|
||||
return LINK_KEY_CODE_EMPTY;
|
||||
@ -2797,41 +2797,41 @@ static u16 GetDirectionForEventScript(const u8 *script)
|
||||
|
||||
static void InitLinkPlayerQueueScript(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void InitLinkRoomStartMenuScript(void)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
ShowStartMenu();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void RunInteractLocalPlayerScript(const u8 *script)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(script);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void RunConfirmLeaveCableClubScript(void)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
ScriptContext1_SetupScript(EventScript_ConfirmLeaveCableClubRoom);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(EventScript_ConfirmLeaveCableClubRoom);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void InitMenuBasedScript(const u8 *script)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(script);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void RunTerminateLinkScript(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_TerminateLink);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(EventScript_TerminateLink);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool32 Overworld_IsRecvQueueAtMax(void)
|
||||
|
@ -6148,14 +6148,14 @@ static void Task_PartyMenuWaitForFade(u8 taskId)
|
||||
if (IsWeatherNotFadingIn())
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
void ChooseContestMon(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
CreateTask(Task_ChooseContestMon, 10);
|
||||
}
|
||||
@ -6183,7 +6183,7 @@ static void CB2_ChooseContestMon(void)
|
||||
// Used as a script special for showing a party mon to various npcs (e.g. in-game trades, move deleter)
|
||||
void ChoosePartyMon(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
CreateTask(Task_ChoosePartyMon, 10);
|
||||
}
|
||||
@ -6200,7 +6200,7 @@ static void Task_ChoosePartyMon(u8 taskId)
|
||||
|
||||
void ChooseMonForMoveRelearner(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
CreateTask(Task_ChooseMonForMoveRelearner, 10);
|
||||
}
|
||||
@ -6245,7 +6245,7 @@ void DoBattlePyramidMonsHaveHeldItem(void)
|
||||
// The player can then select to toss items from the bag or take/toss held items from the party
|
||||
void BattlePyramidChooseMonHeldItems(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
CreateTask(Task_BattlePyramidChooseMonHeldItems, 10);
|
||||
}
|
||||
|
@ -489,13 +489,13 @@ static void PlayerPC_TurnOff(u8 taskId)
|
||||
if (sTopMenuNumOptions == NUM_BEDROOM_PC_OPTIONS) // Flimsy way to determine if Bedroom PC is in use
|
||||
{
|
||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||
ScriptContext1_SetupScript(LittlerootTown_BrendansHouse_2F_EventScript_TurnOffPlayerPC);
|
||||
ScriptContext_SetupScript(LittlerootTown_BrendansHouse_2F_EventScript_TurnOffPlayerPC);
|
||||
else
|
||||
ScriptContext1_SetupScript(LittlerootTown_MaysHouse_2F_EventScript_TurnOffPlayerPC);
|
||||
ScriptContext_SetupScript(LittlerootTown_MaysHouse_2F_EventScript_TurnOffPlayerPC);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
@ -4195,7 +4195,7 @@ static void Task_ShowPokemonJumpRecords(u8 taskId)
|
||||
{
|
||||
RemoveWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1579,8 +1579,8 @@ static void Task_PCMainMenu(u8 taskId)
|
||||
case MENU_B_PRESSED:
|
||||
case OPTION_EXIT:
|
||||
ClearStdWindowAndFrame(task->tWindowId, TRUE);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
RemoveWindow(task->tWindowId);
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
@ -1655,7 +1655,7 @@ void ShowPokemonStorageSystemPC(void)
|
||||
u8 taskId = CreateTask(Task_PCMainMenu, 80);
|
||||
gTasks[taskId].tState = 0;
|
||||
gTasks[taskId].tSelectedOption = 0;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void FieldTask_ReturnToPcMenu(void)
|
||||
|
@ -365,7 +365,7 @@ static void Task_RecordMixing_Main(u8 taskId)
|
||||
CreateTask(Task_ReturnToFieldRecordMixing, 10);
|
||||
ClearDialogWindowAndFrame(0, TRUE);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3401,7 +3401,7 @@ static void Task_DeclineMinBet(u8 taskId)
|
||||
{
|
||||
ClearStdWindowAndFrame(0, FALSE);
|
||||
HideCoinsWindow();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
@ -3413,7 +3413,7 @@ static void Task_NotEnoughForMinBet(u8 taskId)
|
||||
gSpecialVar_0x8004 = 1;
|
||||
HideCoinsWindow();
|
||||
ClearStdWindowAndFrame(0, TRUE);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@ -3475,7 +3475,7 @@ static void Task_PrintRouletteEntryMsg(u8 taskId)
|
||||
void PlayRoulette(void)
|
||||
{
|
||||
u8 taskId;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
ShowCoinsWindow(GetCoins(), 1, 1);
|
||||
taskId = CreateTask(Task_PrintRouletteEntryMsg, 0);
|
||||
gTasks[taskId].tCoins = GetCoins();
|
||||
|
@ -83,7 +83,7 @@ bool8 SafariZoneTakeStep(void)
|
||||
sSafariZoneStepCounter--;
|
||||
if (sSafariZoneStepCounter == 0)
|
||||
{
|
||||
ScriptContext1_SetupScript(SafariZone_EventScript_TimesUp);
|
||||
ScriptContext_SetupScript(SafariZone_EventScript_TimesUp);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -91,7 +91,7 @@ bool8 SafariZoneTakeStep(void)
|
||||
|
||||
void SafariZoneRetirePrompt(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(SafariZone_EventScript_RetirePrompt);
|
||||
ScriptContext_SetupScript(SafariZone_EventScript_RetirePrompt);
|
||||
}
|
||||
|
||||
void CB2_EndSafariBattle(void)
|
||||
@ -105,15 +105,15 @@ void CB2_EndSafariBattle(void)
|
||||
}
|
||||
else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS)
|
||||
{
|
||||
ScriptContext2_RunNewScript(SafariZone_EventScript_OutOfBallsMidBattle);
|
||||
RunScriptImmediately(SafariZone_EventScript_OutOfBallsMidBattle);
|
||||
WarpIntoMap();
|
||||
gFieldCallback = FieldCB_ReturnToFieldNoScriptCheckMusic;
|
||||
SetMainCallback2(CB2_LoadMap);
|
||||
}
|
||||
else if (gBattleOutcome == B_OUTCOME_CAUGHT)
|
||||
{
|
||||
ScriptContext1_SetupScript(SafariZone_EventScript_OutOfBalls);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_SetupScript(SafariZone_EventScript_OutOfBalls);
|
||||
ScriptContext_Stop();
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
}
|
||||
}
|
||||
|
36
src/scrcmd.c
36
src/scrcmd.c
@ -141,7 +141,7 @@ bool8 ScrCmd_callnative(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_waitstate(struct ScriptContext *ctx)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ bool8 ScrCmd_incrementgamestat(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_animateflash(struct ScriptContext *ctx)
|
||||
{
|
||||
AnimateFlash(ScriptReadByte(ctx));
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1344,7 +1344,7 @@ bool8 ScrCmd_yesnobox(struct ScriptContext *ctx)
|
||||
|
||||
if (ScriptMenu_YesNo(left, top) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -1362,7 +1362,7 @@ bool8 ScrCmd_multichoice(struct ScriptContext *ctx)
|
||||
|
||||
if (ScriptMenu_Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -1381,7 +1381,7 @@ bool8 ScrCmd_multichoicedefault(struct ScriptContext *ctx)
|
||||
|
||||
if (ScriptMenu_MultichoiceWithDefault(left, top, multichoiceId, ignoreBPress, defaultChoice) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -1411,7 +1411,7 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext *ctx)
|
||||
|
||||
if (ScriptMenu_MultichoiceGrid(left, top, multichoiceId, ignoreBPress, numColumns) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -1440,7 +1440,7 @@ bool8 ScrCmd_drawboxtext(struct ScriptContext *ctx)
|
||||
|
||||
/*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}*/
|
||||
return FALSE;
|
||||
@ -1477,7 +1477,7 @@ bool8 ScrCmd_showcontestpainting(struct ScriptContext *ctx)
|
||||
SetContestWinnerForPainting(contestWinnerId);
|
||||
|
||||
ShowContestPainting();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1882,7 +1882,7 @@ bool8 ScrCmd_setwildbattle(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_dowildbattle(struct ScriptContext *ctx)
|
||||
{
|
||||
BattleSetup_StartScriptedWildBattle();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1891,7 +1891,7 @@ bool8 ScrCmd_pokemart(struct ScriptContext *ctx)
|
||||
const void *ptr = (void *)ScriptReadWord(ctx);
|
||||
|
||||
CreatePokemartMenu(ptr);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1900,7 +1900,7 @@ bool8 ScrCmd_pokemartdecoration(struct ScriptContext *ctx)
|
||||
const void *ptr = (void *)ScriptReadWord(ctx);
|
||||
|
||||
CreateDecorationShop1Menu(ptr);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1910,7 +1910,7 @@ bool8 ScrCmd_pokemartdecoration2(struct ScriptContext *ctx)
|
||||
const void *ptr = (void *)ScriptReadWord(ctx);
|
||||
|
||||
CreateDecorationShop2Menu(ptr);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1919,7 +1919,7 @@ bool8 ScrCmd_playslotmachine(struct ScriptContext *ctx)
|
||||
u8 machineId = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
PlaySlotMachine(machineId, CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1947,7 +1947,7 @@ bool8 ScrCmd_getpokenewsactive(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_choosecontestmon(struct ScriptContext *ctx)
|
||||
{
|
||||
ChooseContestMon();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1955,21 +1955,21 @@ bool8 ScrCmd_choosecontestmon(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_startcontest(struct ScriptContext *ctx)
|
||||
{
|
||||
StartContest();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx)
|
||||
{
|
||||
ShowContestResults();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx)
|
||||
{
|
||||
ContestLinkTransfer(gSpecialVar_ContestCategory);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2124,7 +2124,7 @@ bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx)
|
||||
bool8 ScrCmd_showelevmenu(struct ScriptContext *ctx)
|
||||
{
|
||||
/*ScriptShowElevatorMenu();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;*/
|
||||
return FALSE;
|
||||
}
|
||||
|
84
src/script.c
84
src/script.c
@ -14,12 +14,18 @@ enum {
|
||||
SCRIPT_MODE_NATIVE,
|
||||
};
|
||||
|
||||
enum {
|
||||
CONTEXT_RUNNING,
|
||||
CONTEXT_WAITING,
|
||||
CONTEXT_SHUTDOWN,
|
||||
};
|
||||
|
||||
extern const u8 *gRamScriptRetAddr;
|
||||
|
||||
static u8 sScriptContext1Status;
|
||||
static struct ScriptContext sScriptContext1;
|
||||
static struct ScriptContext sScriptContext2;
|
||||
static bool8 sScriptContext2Enabled;
|
||||
static u8 sGlobalScriptContextStatus;
|
||||
static struct ScriptContext sGlobalScriptContext;
|
||||
static struct ScriptContext sImmediateScriptContext;
|
||||
static bool8 sLockFieldControls;
|
||||
|
||||
extern ScrCmdFunc gScriptCmdTable[];
|
||||
extern ScrCmdFunc gScriptCmdTableEnd[];
|
||||
@ -173,79 +179,79 @@ u32 ScriptReadWord(struct ScriptContext *ctx)
|
||||
return (((((value3 << 8) + value2) << 8) + value1) << 8) + value0;
|
||||
}
|
||||
|
||||
void ScriptContext2_Enable(void)
|
||||
void LockPlayerFieldControls(void)
|
||||
{
|
||||
sScriptContext2Enabled = TRUE;
|
||||
sLockFieldControls = TRUE;
|
||||
}
|
||||
|
||||
void ScriptContext2_Disable(void)
|
||||
void UnlockPlayerFieldControls(void)
|
||||
{
|
||||
sScriptContext2Enabled = FALSE;
|
||||
sLockFieldControls = FALSE;
|
||||
}
|
||||
|
||||
bool8 ScriptContext2_IsEnabled(void)
|
||||
bool8 ArePlayerFieldControlsLocked(void)
|
||||
{
|
||||
return sScriptContext2Enabled;
|
||||
return sLockFieldControls;
|
||||
}
|
||||
|
||||
bool8 ScriptContext1_IsScriptSetUp(void)
|
||||
bool8 ScriptContext_IsEnabled(void)
|
||||
{
|
||||
if (sScriptContext1Status == 0)
|
||||
if (sGlobalScriptContextStatus == CONTEXT_RUNNING)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void ScriptContext1_Init(void)
|
||||
void ScriptContext_Init(void)
|
||||
{
|
||||
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
sScriptContext1Status = 2;
|
||||
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
sGlobalScriptContextStatus = CONTEXT_SHUTDOWN;
|
||||
}
|
||||
|
||||
bool8 ScriptContext2_RunScript(void)
|
||||
bool8 ScriptContext_RunScript(void)
|
||||
{
|
||||
if (sScriptContext1Status == 2)
|
||||
if (sGlobalScriptContextStatus == CONTEXT_SHUTDOWN)
|
||||
return FALSE;
|
||||
|
||||
if (sScriptContext1Status == 1)
|
||||
if (sGlobalScriptContextStatus == CONTEXT_WAITING)
|
||||
return FALSE;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
|
||||
if (!RunScriptCommand(&sScriptContext1))
|
||||
if (!RunScriptCommand(&sGlobalScriptContext))
|
||||
{
|
||||
sScriptContext1Status = 2;
|
||||
ScriptContext2_Disable();
|
||||
sGlobalScriptContextStatus = CONTEXT_SHUTDOWN;
|
||||
UnlockPlayerFieldControls();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ScriptContext1_SetupScript(const u8 *ptr)
|
||||
void ScriptContext_SetupScript(const u8 *ptr)
|
||||
{
|
||||
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sScriptContext1, ptr);
|
||||
ScriptContext2_Enable();
|
||||
sScriptContext1Status = 0;
|
||||
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sGlobalScriptContext, ptr);
|
||||
LockPlayerFieldControls();
|
||||
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
||||
}
|
||||
|
||||
void ScriptContext1_Stop(void)
|
||||
void ScriptContext_Stop(void)
|
||||
{
|
||||
sScriptContext1Status = 1;
|
||||
sGlobalScriptContextStatus = CONTEXT_WAITING;
|
||||
}
|
||||
|
||||
void EnableBothScriptContexts(void)
|
||||
void ScriptContext_Enable(void)
|
||||
{
|
||||
sScriptContext1Status = 0;
|
||||
ScriptContext2_Enable();
|
||||
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ScriptContext2_RunNewScript(const u8 *ptr)
|
||||
void RunScriptImmediately(const u8 *ptr)
|
||||
{
|
||||
InitScriptContext(&sScriptContext2, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sScriptContext2, ptr);
|
||||
while (RunScriptCommand(&sScriptContext2) == TRUE);
|
||||
InitScriptContext(&sImmediateScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sImmediateScriptContext, ptr);
|
||||
while (RunScriptCommand(&sImmediateScriptContext) == TRUE);
|
||||
}
|
||||
|
||||
u8 *MapHeaderGetScriptTable(u8 tag)
|
||||
@ -272,7 +278,7 @@ void MapHeaderRunScriptType(u8 tag)
|
||||
{
|
||||
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||
if (ptr)
|
||||
ScriptContext2_RunNewScript(ptr);
|
||||
RunScriptImmediately(ptr);
|
||||
}
|
||||
|
||||
u8 *MapHeaderCheckScriptTable(u8 tag)
|
||||
@ -336,7 +342,7 @@ bool8 TryRunOnFrameMapScript(void)
|
||||
if (!ptr)
|
||||
return FALSE;
|
||||
|
||||
ScriptContext1_SetupScript(ptr);
|
||||
ScriptContext_SetupScript(ptr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -344,7 +350,7 @@ void TryRunOnWarpIntoMapScript(void)
|
||||
{
|
||||
u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE);
|
||||
if (ptr)
|
||||
ScriptContext2_RunNewScript(ptr);
|
||||
RunScriptImmediately(ptr);
|
||||
}
|
||||
|
||||
u32 CalculateRamScriptChecksum(void)
|
||||
|
@ -190,7 +190,7 @@ static void Task_HandleMultichoiceInput(u8 taskId)
|
||||
}
|
||||
ClearToTransparentAndRemoveWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ static void Task_HandleYesNoInput(u8 taskId)
|
||||
}
|
||||
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, bool8 ignoreBPress, u8 columnCount)
|
||||
@ -307,7 +307,7 @@ static void Task_HandleMultichoiceGridInput(u8 taskId)
|
||||
|
||||
ClearToTransparentAndRemoveWindow(tWindowId);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
#undef tWindowId
|
||||
|
@ -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);
|
||||
}
|
||||
|
10
src/shop.c
10
src/shop.c
@ -277,7 +277,7 @@ static u8 CreateShopMenu(u8 martType)
|
||||
{
|
||||
int numMenuItems;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sMartInfo.martType = martType;
|
||||
|
||||
if (martType == MART_TYPE_NORMAL)
|
||||
@ -373,7 +373,7 @@ static void Task_HandleShopMenuQuit(u8 taskId)
|
||||
ClearStdWindowAndFrameToTransparent(sMartInfo.windowId, 2); // Incorrect use, making it not copy it to vram.
|
||||
RemoveWindow(sMartInfo.windowId);
|
||||
TryPutSmartShopperOnAir();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
|
||||
if (sMartInfo.callback)
|
||||
@ -1210,19 +1210,19 @@ void CreatePokemartMenu(const u16 *itemsForSale)
|
||||
CreateShopMenu(MART_TYPE_NORMAL);
|
||||
SetShopItemsForSale(itemsForSale);
|
||||
ClearItemPurchases();
|
||||
SetShopMenuCallback(EnableBothScriptContexts);
|
||||
SetShopMenuCallback(ScriptContext_Enable);
|
||||
}
|
||||
|
||||
void CreateDecorationShop1Menu(const u16 *itemsForSale)
|
||||
{
|
||||
CreateShopMenu(MART_TYPE_DECOR);
|
||||
SetShopItemsForSale(itemsForSale);
|
||||
SetShopMenuCallback(EnableBothScriptContexts);
|
||||
SetShopMenuCallback(ScriptContext_Enable);
|
||||
}
|
||||
|
||||
void CreateDecorationShop2Menu(const u16 *itemsForSale)
|
||||
{
|
||||
CreateShopMenu(MART_TYPE_DECOR2);
|
||||
SetShopItemsForSale(itemsForSale);
|
||||
SetShopMenuCallback(EnableBothScriptContexts);
|
||||
SetShopMenuCallback(ScriptContext_Enable);
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ void ShowStartMenu(void)
|
||||
StopPlayerAvatar();
|
||||
}
|
||||
CreateStartMenuTask(Task_ShowStartMenu);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static bool8 HandleStartMenuInput(void)
|
||||
@ -763,7 +763,7 @@ void ShowBattlePyramidStartMenu(void)
|
||||
ClearDialogWindowAndFrameToTransparent(0, FALSE);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
CreateStartMenuTask(Task_ShowStartMenu);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static bool8 StartMenuBattlePyramidBagCallback(void)
|
||||
@ -804,7 +804,7 @@ static bool8 SaveCallback(void)
|
||||
case SAVE_ERROR: // Close start menu
|
||||
ClearDialogWindowAndFrameToTransparent(0, TRUE);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
SoftResetInBattlePyramid();
|
||||
return TRUE;
|
||||
}
|
||||
@ -841,8 +841,8 @@ static bool8 BattlePyramidRetireCallback(void)
|
||||
case SAVE_CANCELED: // Yes (Retire from battle pyramid)
|
||||
ClearDialogWindowAndFrameToTransparent(0, TRUE);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext1_SetupScript(BattlePyramid_Retire);
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_SetupScript(BattlePyramid_Retire);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -901,7 +901,7 @@ static void SaveGameTask(u8 taskId)
|
||||
}
|
||||
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void HideSaveMessageWindow(void)
|
||||
@ -1378,7 +1378,7 @@ static void Task_WaitForBattleTowerLinkSave(u8 taskId)
|
||||
if (!FuncIsActiveTask(Task_LinkFullSave))
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1398,7 +1398,7 @@ static void HideStartMenuWindow(void)
|
||||
ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE);
|
||||
RemoveStartMenuWindow();
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void HideStartMenu(void)
|
||||
|
@ -95,7 +95,7 @@ static void Task_WaitWeather(u8 taskId)
|
||||
{
|
||||
if (IsWeatherChangeComplete())
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
@ -4794,7 +4794,7 @@ static void CB2_FreeTradeData(void)
|
||||
|
||||
void DoInGameTradeScene(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_InGameTrade, 10);
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void Task_BufferDecorSelectionAndCloseWindow(u8 taskId, u8 decorationId)
|
||||
RemoveWindow(tWindowId);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void Task_HandleGetDecorationMenuInput(u8 taskId)
|
||||
@ -186,14 +186,14 @@ void DecorationItemsMenuAction_Trade(u8 taskId)
|
||||
gSpecialVar_0x8006 = 0xFFFF;
|
||||
}
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void ExitTraderMenu(u8 taskId)
|
||||
{
|
||||
gSpecialVar_0x8006 = 0;
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void TraderDoDecorationTrade(void)
|
||||
|
@ -660,7 +660,7 @@ void DoTrainerApproach(void)
|
||||
static void Task_EndTrainerApproach(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void TryPrepareSecondApproachingTrainer(void)
|
||||
|
@ -686,12 +686,12 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
data->state++; // LL_STATE_RETRY or LL_STATE_FAILED
|
||||
break;
|
||||
case LL_STATE_FAILED:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
gSpecialVar_Result = LINKUP_FAILED;
|
||||
break;
|
||||
case LL_STATE_RETRY:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
gSpecialVar_Result = LINKUP_RETRY_ROLE_ASSIGN;
|
||||
break;
|
||||
@ -1744,7 +1744,7 @@ static void Task_StartActivity(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
gSpecialVar_Result = LINKUP_SUCCESS;
|
||||
if (gPlayerCurrActivity != (ACTIVITY_TRADE | IN_UNION_ROOM))
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||
@ -1779,13 +1779,13 @@ static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||
SaveLinkTrainerNames();
|
||||
DestroyTask(taskId);
|
||||
default:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
data[0] = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!ScriptContext1_IsScriptSetUp())
|
||||
if (!ScriptContext_IsEnabled())
|
||||
{
|
||||
FadeScreen(FADE_TO_BLACK, 0);
|
||||
data[0] = 2;
|
||||
@ -1833,7 +1833,7 @@ static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 7:
|
||||
@ -1844,7 +1844,7 @@ static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||
if (gReceivedRemoteLinkPlayers == 0)
|
||||
{
|
||||
DestroyWirelessStatusIndicatorSprite();
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
@ -2592,7 +2592,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
gSpecialVar_Result = 0;
|
||||
}
|
||||
}
|
||||
else if (ScriptContext2_IsEnabled() != TRUE)
|
||||
else if (ArePlayerFieldControlsLocked() != TRUE)
|
||||
{
|
||||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
@ -3781,7 +3781,7 @@ static void UR_ClearBg0(void)
|
||||
|
||||
static void JoinGroup_EnableScriptContexts(void)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void PrintUnionRoomText(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 colorIdx)
|
||||
@ -4403,7 +4403,7 @@ static u32 GetPartyPositionOfRegisteredMon(struct UnionRoomTrade *trade, u8 mult
|
||||
static void HandleCancelActivity(bool32 setData)
|
||||
{
|
||||
UR_ClearBg0();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnionRoom_UnlockPlayerAndChatPartner();
|
||||
gPlayerCurrActivity = ACTIVITY_NONE;
|
||||
if (setData)
|
||||
@ -4415,7 +4415,7 @@ static void HandleCancelActivity(bool32 setData)
|
||||
|
||||
static void StartScriptInteraction(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjects_WaitForPlayer();
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ static bool32 TryReleaseUnionRoomPlayerObjectEvent(u32 leaderId)
|
||||
if (!ObjectEventClearHeldMovementIfFinished(object))
|
||||
return FALSE;
|
||||
|
||||
if (!ScriptContext2_IsEnabled())
|
||||
if (!ArePlayerFieldControlsLocked())
|
||||
UnfreezeObjectEvent(object);
|
||||
else
|
||||
FreezeObjectEvent(object);
|
||||
|
@ -852,7 +852,7 @@ bool8 UpdateRepelCounter(void)
|
||||
VarSet(VAR_REPEL_STEP_COUNT, steps);
|
||||
if (steps == 0)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_RepelWoreOff);
|
||||
ScriptContext_SetupScript(EventScript_RepelWoreOff);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user