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