mirror of
https://github.com/pret/pokeruby.git
synced 2026-03-21 17:54:19 -05:00
Sync Script and Mystery Event files with pokeemerald (#890)
Some checks failed
CI / build (push) Has been cancelled
Some checks failed
CI / build (push) Has been cancelled
This commit is contained in:
parent
f6e2a5901e
commit
71203c45b1
|
|
@ -129,7 +129,7 @@ u8* EasyChat_GetWordText(u8 *, u16);
|
|||
u8 *ConvertEasyChatWordsToString(u8 *dst, u16 *words, u16, u16);
|
||||
u16 sub_80EB784(u16 group);
|
||||
u8 sub_80EB868(u8);
|
||||
void sub_80EB890(u8);
|
||||
void UnlockTrendySaying(u8);
|
||||
u8 sub_80EB8C0(void);
|
||||
u16 sub_80EB8EC(void);
|
||||
u8 *sub_80EB544(u8 *dst, u16 *words, u16 arg2, u16 arg3);
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ struct RamScriptData
|
|||
u8 magic;
|
||||
u8 mapGroup;
|
||||
u8 mapNum;
|
||||
u8 objectId;
|
||||
u8 localId;
|
||||
u8 script[995];
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
#ifndef GUARD_MYSTERY_EVENT_MSG_H
|
||||
#define GUARD_MYSTERY_EVENT_MSG_H
|
||||
|
||||
extern const u8 gOtherText_BerryObtainedDadHasIt[];
|
||||
extern const u8 gOtherText_BerryTransformed[];
|
||||
extern const u8 gOtherText_BerryAlreadyObtained[];
|
||||
extern const u8 gOtherText_SpecialRibbonReceived[];
|
||||
extern const u8 gOtherText_DexUpgraded[];
|
||||
extern const u8 gOtherText_RareWordAdded[];
|
||||
extern const u8 gOtherText_PokeWasSentOver[];
|
||||
extern const u8 gOtherText_PartyIsFull[];
|
||||
extern const u8 gOtherText_NewTrainerInHoenn[];
|
||||
extern const u8 gOtherText_NewAdversaryInBattleTower[];
|
||||
extern const u8 gOtherText_DataCannotUseVersion[];
|
||||
extern const u8 gText_MysteryEventBerry[];
|
||||
extern const u8 gText_MysteryEventBerryTransform[];
|
||||
extern const u8 gText_MysteryEventBerryObtained[];
|
||||
extern const u8 gText_MysteryEventSpecialRibbon[];
|
||||
extern const u8 gText_MysteryEventNationalDex[];
|
||||
extern const u8 gText_MysteryEventRareWord[];
|
||||
extern const u8 gText_MysteryEventSentOver[];
|
||||
extern const u8 gText_MysteryEventFullParty[];
|
||||
extern const u8 gText_MysteryEventNewTrainer[];
|
||||
extern const u8 gText_MysteryEventNewAdversaryInBattleTower[];
|
||||
extern const u8 gText_MysteryEventCantBeUsed[];
|
||||
|
||||
#endif //GUARD_MYSTERY_EVENT_MSG_H
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
#ifndef GUARD_MYSTERY_EVENT_SCRIPT_H
|
||||
#define GUARD_MYSTERY_EVENT_SCRIPT_H
|
||||
|
||||
u32 RunMysteryEventScript(u8 *);
|
||||
void SetMysteryEventScriptStatus(u32 val);
|
||||
enum {
|
||||
MEVENT_STATUS_LOAD_OK,
|
||||
MEVENT_STATUS_LOAD_ERROR,
|
||||
MEVENT_STATUS_SUCCESS,
|
||||
MEVENT_STATUS_FAILURE,
|
||||
MEVENT_STATUS_FF = 0xFF
|
||||
};
|
||||
|
||||
u32 RunMysteryEventScript(u8 *script);
|
||||
void SetMysteryEventScriptStatus(u32 status);
|
||||
u16 GetRecordMixingGift(void);
|
||||
#if DEBUG
|
||||
bool8 debug_sub_812620C(u8 *a1, const u8 * _a2);
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ void sub_809BB90(void);
|
|||
void sub_809BBC0(void);
|
||||
void sub_809BC18(void);
|
||||
void sub_809BD14(void);
|
||||
s16 party_compaction(void);
|
||||
s16 CompactPartySlots(void);
|
||||
void sub_809BDD8(u8 markings);
|
||||
bool8 sub_809BE80(void);
|
||||
bool8 sub_809BEBC(void);
|
||||
|
|
|
|||
|
|
@ -25,23 +25,21 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTable
|
|||
u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr);
|
||||
void SetupNativeScript(struct ScriptContext *ctx, bool8 (*ptr)(void));
|
||||
void StopScript(struct ScriptContext *ctx);
|
||||
u8 RunScriptCommand(struct ScriptContext *ctx);
|
||||
u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr);
|
||||
const u8 *ScriptPop(struct ScriptContext *ctx);
|
||||
void ScriptJump(struct ScriptContext *ctx, u8 *ptr);
|
||||
void ScriptCall(struct ScriptContext *ctx, u8 *ptr);
|
||||
bool8 RunScriptCommand(struct ScriptContext *ctx);
|
||||
void ScriptJump(struct ScriptContext *ctx, const u8 *ptr);
|
||||
void ScriptCall(struct ScriptContext *ctx, const u8 *ptr);
|
||||
void ScriptReturn(struct ScriptContext *ctx);
|
||||
u16 ScriptReadHalfword(struct ScriptContext *ctx);
|
||||
u32 ScriptReadWord(struct ScriptContext *ctx);
|
||||
void ScriptContext2_Enable(void);
|
||||
void ScriptContext2_Disable(void);
|
||||
bool8 ScriptContext2_IsEnabled(void);
|
||||
void ScriptContext1_Init(void);
|
||||
bool8 ScriptContext2_RunScript(void);
|
||||
void ScriptContext1_SetupScript(const u8 *ptr);
|
||||
void ScriptContext1_Stop(void);
|
||||
void EnableBothScriptContexts(void);
|
||||
void ScriptContext2_RunNewScript(const u8 *ptr);
|
||||
void LockPlayerFieldControls(void);
|
||||
void UnlockPlayerFieldControls(void);
|
||||
bool8 ArePlayerFieldControlsLocked(void);
|
||||
void ScriptContext_Init(void);
|
||||
bool8 ScriptContext_RunScript(void);
|
||||
void ScriptContext_SetupScript(const u8 *ptr);
|
||||
void ScriptContext_Stop(void);
|
||||
void ScriptContext_Enable(void);
|
||||
void RunScriptImmediately(const u8 *ptr);
|
||||
void RunOnLoadMapScript(void);
|
||||
void RunOnTransitionMapScript(void);
|
||||
void RunOnResumeMapScript(void);
|
||||
|
|
@ -49,7 +47,7 @@ void RunOnDiveWarpMapScript(void);
|
|||
bool8 TryRunOnFrameMapScript(void);
|
||||
void TryRunOnWarpIntoMapScript(void);
|
||||
void ClearRamScript(void);
|
||||
bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId);
|
||||
const u8 *GetRamScript(u8 objectId, const u8 *script);
|
||||
bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 localId);
|
||||
const u8 *GetRamScript(u8 localId, const u8 *script);
|
||||
|
||||
#endif // GUARD_SCRIPT_H
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ extern const u8 gExpandedPlaceholder_Brendan[];
|
|||
extern const u8 gExpandedPlaceholder_May[];
|
||||
|
||||
// system text
|
||||
extern const u8 gSystemText_Egg[];
|
||||
extern const u8 gSystemText_Pokemon2[];
|
||||
extern const u8 gText_EggNickname[];
|
||||
extern const u8 gText_Pokemon[];
|
||||
|
||||
// main menu text
|
||||
extern const u8 gMainMenuString_NewGame[];
|
||||
|
|
@ -902,7 +902,7 @@ extern const u8 gSystemText_ClockResetDataSave[];
|
|||
extern const u8 gSystemText_SaveCompleted[];
|
||||
extern const u8 gSystemText_SaveFailed[];
|
||||
extern const u8 gSystemText_NoSaveFileNoTime[];
|
||||
extern const u8 gSystemText_ClockAdjustmentUsable[];
|
||||
extern const u8 gText_InGameClockUsable[];
|
||||
extern const u8 gSystemText_Saving[];
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ void BattleSetup_StartWildBattle(void)
|
|||
|
||||
static void DoStandardWildBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
sub_80597F4();
|
||||
gMain.savedCallback = CB2_EndWildBattle;
|
||||
|
|
@ -529,7 +529,7 @@ static void DoStandardWildBattle(void)
|
|||
|
||||
void BattleSetup_StartRoamerBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
sub_80597F4();
|
||||
gMain.savedCallback = CB2_EndWildBattle;
|
||||
|
|
@ -541,7 +541,7 @@ void BattleSetup_StartRoamerBattle(void)
|
|||
|
||||
static void DoSafariBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
sub_80597F4();
|
||||
gMain.savedCallback = sub_80C824C;
|
||||
|
|
@ -560,7 +560,7 @@ static void StartTheBattle(void)
|
|||
void ScrSpecial_StartWallyTutorialBattle(void)
|
||||
{
|
||||
CreateMaleMon(&gEnemyParty[0], SPECIES_RALTS, 5);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_ReturnToFieldContinueScriptPlayMapMusic;
|
||||
gBattleTypeFlags = BATTLE_TYPE_WALLY_TUTORIAL;
|
||||
CreateBattleStartTask(B_TRANSITION_SLICE, 0);
|
||||
|
|
@ -568,7 +568,7 @@ void ScrSpecial_StartWallyTutorialBattle(void)
|
|||
|
||||
void BattleSetup_StartScriptedWildBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = 0;
|
||||
CreateBattleStartTask(GetWildBattleTransition(), 0);
|
||||
|
|
@ -578,7 +578,7 @@ void BattleSetup_StartScriptedWildBattle(void)
|
|||
|
||||
void ScrSpecial_StartSouthernIslandBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY;
|
||||
CreateBattleStartTask(GetWildBattleTransition(), 0);
|
||||
|
|
@ -588,7 +588,7 @@ void ScrSpecial_StartSouthernIslandBattle(void)
|
|||
|
||||
void ScrSpecial_StartRayquazaBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY;
|
||||
CreateBattleStartTask(B_TRANSITION_BLUR, MUS_VS_KYOGRE_GROUDON);
|
||||
|
|
@ -598,7 +598,7 @@ void ScrSpecial_StartRayquazaBattle(void)
|
|||
|
||||
void ScrSpecial_StartGroudonKyogreBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_KYOGRE_GROUDON;
|
||||
if (gGameVersion == VERSION_RUBY)
|
||||
|
|
@ -611,7 +611,7 @@ void ScrSpecial_StartGroudonKyogreBattle(void)
|
|||
|
||||
void ScrSpecial_StartRegiBattle(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_REGI;
|
||||
CreateBattleStartTask(B_TRANSITION_GRID_SQUARES, MUS_VS_REGI);
|
||||
|
|
@ -1046,8 +1046,8 @@ void TrainerWantsBattle(u8 trainerObjEventId, const u8 *trainerScript)
|
|||
gSelectedObjectEvent = trainerObjEventId;
|
||||
gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId;
|
||||
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
||||
ScriptContext1_SetupScript(EventScript_StartTrainerBattle);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(EventScript_StartTrainerBattle);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool32 GetTrainerFlagFromScriptPointer(const u8 *data)
|
||||
|
|
@ -1103,7 +1103,7 @@ void BattleSetup_StartTrainerBattle(void)
|
|||
gBattleTypeFlags = BATTLE_TYPE_TRAINER;
|
||||
gMain.savedCallback = CB2_EndTrainerBattle;
|
||||
StartTheBattle();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
void CB2_EndTrainerBattle(void)
|
||||
|
|
@ -1146,7 +1146,7 @@ void BattleSetup_StartRematchBattle(void)
|
|||
gBattleTypeFlags = BATTLE_TYPE_TRAINER;
|
||||
gMain.savedCallback = CB2_EndTrainerEyeRematchBattle;
|
||||
StartTheBattle();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
static const u8 *GetTrainerIntroSpeech(void);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void DoBrailleDigEffect(void)
|
|||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_BRAILLE_DIG);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool8 CheckRelicanthWailord(void)
|
||||
|
|
@ -95,7 +95,7 @@ void DoBrailleStrengthEffect(void)
|
|||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_BRAILLE_STRENGTH);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool8 ShouldDoBrailleFlyEffect(void)
|
||||
|
|
@ -141,7 +141,7 @@ void UseFlyAncientTomb_Finish(void)
|
|||
DrawWholeMapView();
|
||||
PlaySE(SE_BANG);
|
||||
FlagSet(FLAG_SYS_BRAILLE_FLY);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void DoBrailleWait(void)
|
||||
|
|
@ -188,7 +188,7 @@ void Task_BrailleWait(u8 taskId)
|
|||
}
|
||||
ScriptUnfreezeObjectEvents();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
break;
|
||||
case 3:
|
||||
data[1] = data[1] - 1;
|
||||
|
|
@ -197,7 +197,7 @@ void Task_BrailleWait(u8 taskId)
|
|||
break;
|
||||
case 4:
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext1_SetupScript(S_OpenRegiceChamber);
|
||||
ScriptContext_SetupScript(S_OpenRegiceChamber);
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ void SealedChamberShakingEffect(u8 taskId)
|
|||
if (task->data[2] == task->data[6])
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
InstallCameraPanAheadCallback();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ extern const u8 MauvilleCity_GameCorner_EventScript_1C40AC[];
|
|||
u8 debug_sub_8138C14(void)
|
||||
{
|
||||
unk_203955C = 1;
|
||||
ScriptContext1_SetupScript(MauvilleCity_GameCorner_EventScript_1C407E);
|
||||
ScriptContext_SetupScript(MauvilleCity_GameCorner_EventScript_1C407E);
|
||||
CloseMenu();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -223,7 +223,7 @@ u8 debug_sub_8138C14(void)
|
|||
u8 debug_sub_8138C34(void)
|
||||
{
|
||||
unk_203955C = 1;
|
||||
ScriptContext1_SetupScript(MauvilleCity_GameCorner_EventScript_1C40AC);
|
||||
ScriptContext_SetupScript(MauvilleCity_GameCorner_EventScript_1C40AC);
|
||||
CloseMenu();
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ static void CableCarTask1(u8 taskId)
|
|||
|
||||
void CableCar(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(CableCarTask1, 1);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ static void sub_8083314(u8 taskId)
|
|||
}
|
||||
sub_8082D4C();
|
||||
#endif
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
|
|
@ -520,7 +520,7 @@ static void sub_80833C4(u8 taskId)
|
|||
if (gReceivedRemoteLinkPlayers == FALSE)
|
||||
{
|
||||
sub_8082D4C();
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
@ -530,7 +530,7 @@ static void sub_80833EC(u8 taskId)
|
|||
gSpecialVar_Result = 5;
|
||||
sub_8082D4C();
|
||||
HideFieldMessageBox();
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -539,7 +539,7 @@ static void sub_8083418(u8 taskId)
|
|||
gSpecialVar_Result = 6;
|
||||
sub_8082D4C();
|
||||
HideFieldMessageBox();
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -617,13 +617,13 @@ static void sub_808353C(u8 taskId)
|
|||
}
|
||||
}
|
||||
}
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 1:
|
||||
if (gReceivedRemoteLinkPlayers == FALSE)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
@ -858,7 +858,7 @@ static void sub_80839DC(u8 taskId)
|
|||
HideFieldMessageBox();
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -867,7 +867,7 @@ void sub_8083A84(TaskFunc followupFunc)
|
|||
{
|
||||
u8 taskId = CreateTask(sub_80839DC, 80);
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80839DC, followupFunc);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
static void sub_8083AAC(u8 taskId)
|
||||
|
|
@ -877,7 +877,7 @@ static void sub_8083AAC(u8 taskId)
|
|||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FadeScreen(1, 0);
|
||||
ClearLinkCallback_2();
|
||||
task->data[0]++;
|
||||
|
|
@ -922,7 +922,7 @@ static void sub_8083B6C(void)
|
|||
void sub_8083B80(void)
|
||||
{
|
||||
sub_8083B6C();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
void sub_8083B90(void)
|
||||
|
|
@ -935,7 +935,7 @@ void unref_sub_8083BB0(void)
|
|||
{
|
||||
u8 taskId = CreateTask(sub_80839DC, 80);
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80839DC, Task_RecordMixing_Main);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
void sub_8083BDC(void)
|
||||
|
|
@ -1002,7 +1002,7 @@ static void sub_8083CA4(u8 taskId)
|
|||
{
|
||||
if (!gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -965,7 +965,7 @@ static void sub_81231C4(u8 taskId)
|
|||
if (IsWeatherNotFadingIn() == TRUE)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1882,8 +1882,8 @@ void Task_ContestReturnToField(u8 taskId)
|
|||
void FieldCB_ContestReturnToField(void)
|
||||
{
|
||||
// Why disable and re-enable again?
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
// Expands a one-digit number in the string
|
||||
|
|
|
|||
|
|
@ -2765,7 +2765,7 @@ void sub_80C489C(u8 taskId)
|
|||
|
||||
void sub_80C48C8(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(sub_80C489C, 10);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||
}
|
||||
|
|
@ -2786,7 +2786,7 @@ void sub_80C4914(u8 taskId)
|
|||
|
||||
void sub_80C4940(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(sub_80C4914, 10);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
||||
}
|
||||
|
|
@ -2799,7 +2799,7 @@ void ScrSpecial_GetContestPlayerMonIdx(void)
|
|||
void ContestLinkTransfer(u8 category)
|
||||
{
|
||||
u8 taskId;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
taskId = CreateTask(Task_LinkContest_Init, 0);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_Init, Task_StartCommunication);
|
||||
gTasks[taskId].data[9] = category;
|
||||
|
|
@ -2889,8 +2889,8 @@ void Task_LinkContest_FinalizeConnection(u8 taskId)
|
|||
else
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2905,7 +2905,7 @@ void Task_LinkContest_WaitDisconnect(u8 taskId)
|
|||
if (!gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ static void StorePokemonInDaycare(struct Pokemon * mon, struct DayCare * daycare
|
|||
BoxMonRestorePP(&daycare->mons[emptySlot]);
|
||||
daycare->misc.countersEtc.steps[emptySlot] = 0;
|
||||
ZeroMonData(mon);
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
CalculatePlayerPartyCount();
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ static u16 TakeSelectedPokemonFromDaycare(struct DayCare * daycare, u8 slot)
|
|||
ClearDaycareMail(&daycare->misc.mail[slot]);
|
||||
}
|
||||
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
ZeroBoxMonData(&daycare->mons[slot]);
|
||||
daycare->misc.countersEtc.steps[slot] = 0;
|
||||
ShiftDaycareSlots(daycare);
|
||||
|
|
@ -678,7 +678,7 @@ static void _GiveEggFromDaycare(struct DayCare *daycare) // give_egg
|
|||
isEgg = TRUE;
|
||||
SetMonData(&egg, MON_DATA_IS_EGG, &isEgg);
|
||||
gPlayerParty[5] = egg;
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
CalculatePlayerPartyCount();
|
||||
RemoveEggFromDayCare(daycare);
|
||||
}
|
||||
|
|
@ -1044,7 +1044,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId)
|
|||
gLastFieldPokeMenuOpened = gSpecialVar_Result = gTasks[taskId].data[0];
|
||||
DestroyTask(taskId);
|
||||
Menu_EraseWindowRect(15, 6, 29, 13);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
|
|
@ -1052,7 +1052,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId)
|
|||
gLastFieldPokeMenuOpened = gSpecialVar_Result = 2;
|
||||
DestroyTask(taskId);
|
||||
Menu_EraseWindowRect(15, 6, 29, 13);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ u8 debug_sub_80B068C(void)
|
|||
{
|
||||
debug_sub_80A0710(c2_exit_to_overworld_1_sub_8080DEC);
|
||||
CloseMenu();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -104,7 +104,7 @@ u8 debug_sub_80B06E0(void)
|
|||
{
|
||||
debug_sub_80A073C(c2_exit_to_overworld_1_sub_8080DEC);
|
||||
CloseMenu();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -123,7 +123,7 @@ u8 Kagaya_80B0734(void)
|
|||
{
|
||||
debug_sub_811609C(Random() % 6, c2_exit_to_overworld_1_sub_8080DEC);
|
||||
CloseMenu();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -735,7 +735,7 @@ void DebugMenu_8077020(u8 taskId)
|
|||
void DebugMenu_8077048(void)
|
||||
{
|
||||
gMenuCallback = DebugMenu_807706C;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(DebugMenu_8077020, 80);
|
||||
}
|
||||
|
||||
|
|
@ -898,7 +898,7 @@ u8 DebugMenu_OpenWatanabe(void)
|
|||
{
|
||||
CloseMenu();
|
||||
SetMainCallback2(InitWatanabeDebugMenu);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -906,7 +906,7 @@ u8 DebugMenu_EndSequenceDemo(void)
|
|||
{
|
||||
CloseMenu();
|
||||
SetMainCallback2(CB2_StartCreditsSequence);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -914,7 +914,7 @@ u8 DebugMenu_HallOfFame(void)
|
|||
{
|
||||
CloseMenu();
|
||||
GameClear();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -922,7 +922,7 @@ u8 DebugMenu_OpenSizeComparison(void)
|
|||
{
|
||||
CloseMenu();
|
||||
InitSizeComparison();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1002,7 +1002,7 @@ u8 DebugMenu_BattleForDebug(void)
|
|||
{
|
||||
CloseMenu();
|
||||
InitBattleForDebug();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1039,7 +1039,7 @@ u8 DebugMenu_CreatePKMN(void)
|
|||
{
|
||||
CloseMenu();
|
||||
InitCreatePokemon();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1047,7 +1047,7 @@ u8 DebugMenu_ViewPokemonGraphics(void)
|
|||
{
|
||||
CloseMenu();
|
||||
InitSeePokemonGraphics();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1055,7 +1055,7 @@ u8 DebugMenu_OpenSeeTrainers(void)
|
|||
{
|
||||
CloseMenu();
|
||||
InitSeeTrainers();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1094,7 +1094,7 @@ u8 DebugMenu_Teleport(void)
|
|||
{
|
||||
Overworld_SetWarpDestToLastHealLoc();
|
||||
sub_8080E88();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1377,7 +1377,7 @@ u8 DebugMenu_Safari(void)
|
|||
ConvertIntToDecimalStringN(gStringVar1, gSafariZoneStepCounter, STR_CONV_MODE_RIGHT_ALIGN, 3);
|
||||
sub_8071F40(Str_839BF0C);
|
||||
gMenuCallback = DebugMenu_8077B3C;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1621,7 +1621,7 @@ u8 DebugMenu_MakeItems()
|
|||
{
|
||||
CloseMenu();
|
||||
DebugMenu_8077EAC();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1698,7 +1698,7 @@ void DebugMenu_8077FFC(u8 taskId)
|
|||
void DebugMenu_807806C(u8 taskId)
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
DebugMenu_8077048();
|
||||
}
|
||||
|
|
@ -1759,7 +1759,7 @@ void DebugMenu_807817C(u8 taskId)
|
|||
{
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1786,7 +1786,7 @@ u8 DebugMenu_ViewPortraits(void)
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(DebugMenu_80781A8, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1813,7 +1813,7 @@ u8 DebugMenu_TimeRecords(void)
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(debug_sub_806F9E4, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1821,7 +1821,7 @@ u8 DebugMenu_SetTime(void)
|
|||
{
|
||||
CloseMenu();
|
||||
debug_sub_806F99C();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1852,13 +1852,13 @@ void DebugMenu_8078310(u8 taskId)
|
|||
*GetVarPointer(VAR_MIRAGE_RND_H) = data[1];
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
else if (DebugMenu_8077DD8(data + 1, 0, 0xFFFF, gMain.newAndRepeatedKeys) == TRUE)
|
||||
DebugMenu_80782EC(data[1]);
|
||||
|
|
@ -1870,7 +1870,7 @@ u8 DebugMenu_MiragaIslandRND(void)
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(DebugMenu_8078310, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2129,7 +2129,7 @@ bool32 DebugMenu_807860C(u8 taskId)
|
|||
return FALSE;
|
||||
case 2:
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -2170,7 +2170,7 @@ void DebugMenu_8078714(u8 taskId)
|
|||
bool8 DebugMenu_8078758(TaskFunc func)
|
||||
{
|
||||
CloseMenu();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(func, 80);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -2243,7 +2243,7 @@ void DebugMenu_8078880(u8 taskId)
|
|||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
@ -2255,7 +2255,7 @@ u8 DebugMenu_CellInfo(void)
|
|||
CloseMenu();
|
||||
CreateTask(DebugMenu_8078880, 80);
|
||||
DebugMenu_80787EC();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2350,14 +2350,14 @@ void DebugMenu_8078AA4(u8 taskId)
|
|||
void DebugMenu_8078B38(u8 taskId)
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
u8 DebugMenu_BattleTowerStages(void)
|
||||
{
|
||||
CloseMenu();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(DebugMenu_80789CC, 80);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -2438,14 +2438,14 @@ void DebugMenu_8078BD4(u8 taskId)
|
|||
PlaySE(SE_DING_DONG);
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DebugMenu_8078B94();
|
||||
}
|
||||
else if (JOY_NEW(B_BUTTON))
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
else if (DebugMenu_8077DD8(data + 1, 0, 4, gMain.newAndRepeatedKeys) == TRUE)
|
||||
{
|
||||
|
|
@ -2459,7 +2459,7 @@ u8 DebugMenu_CheckPKBLCK()
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(DebugMenu_8078BD4, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2676,7 +2676,7 @@ void DebugMenu_8078F68(u8 taskId)
|
|||
void DebugMenu_8079020(u8 taskId)
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -2684,7 +2684,7 @@ u8 DebugMenu_PTime(void)
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(DebugMenu_8078F1C, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2728,7 +2728,7 @@ void DebugMenu_8079058(u8 taskId)
|
|||
gUnknown_Debug_Murakawa2 = 0;
|
||||
#endif
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2738,7 +2738,7 @@ u8 DebugMenu_OpenMurakawa(void)
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(DebugMenu_8079058, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2770,7 +2770,7 @@ void DebugMenu_8079110(u8 taskId)
|
|||
if (Menu_UpdateWindowText() && JOY_NEW(A_BUTTON))
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
@ -2781,7 +2781,7 @@ u8 DebugMenu_OpenKiwa(void)
|
|||
{
|
||||
CloseMenu();
|
||||
CreateTask(DebugMenu_8079110, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
// return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ bool8 debug_sub_8090984(void)
|
|||
|
||||
for (i = 0; i < 33; i++)
|
||||
{
|
||||
sub_80EB890(i);
|
||||
UnlockTrendySaying(i);
|
||||
}
|
||||
}
|
||||
CloseMenu();
|
||||
|
|
|
|||
|
|
@ -2321,105 +2321,105 @@ static bool8 ControlEvents_Events2_HandleInput(void)
|
|||
|
||||
static bool8 CallScript_DoHallOfFame(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1CFE);
|
||||
ScriptContext_SetupScript(DebugScript_081C1CFE);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveCoinCaseIfNotAlreadyOwned(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1D07);
|
||||
ScriptContext_SetupScript(DebugScript_081C1D07);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_SetOldaleStateAfterRoute103Rival(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1D1E);
|
||||
ScriptContext_SetupScript(DebugScript_081C1D1E);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_OpenNewMauville(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1D24);
|
||||
ScriptContext_SetupScript(DebugScript_081C1D24);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveSSTicketAndDoHallOfFame(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1D2A);
|
||||
ScriptContext_SetupScript(DebugScript_081C1D2A);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveKyogreEgg(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1D35);
|
||||
ScriptContext_SetupScript(DebugScript_081C1D35);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveAllItems(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C1D46);
|
||||
ScriptContext_SetupScript(DebugScript_081C1D46);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveAllDecorations(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C221F);
|
||||
ScriptContext_SetupScript(DebugScript_081C221F);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveAllCoins(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C23E2);
|
||||
ScriptContext_SetupScript(DebugScript_081C23E2);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_OpenSootopolisGym(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C23E6);
|
||||
ScriptContext_SetupScript(DebugScript_081C23E6);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_SetMoneyTo0(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C23F6);
|
||||
ScriptContext_SetupScript(DebugScript_081C23F6);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_FillPartyWithBarboach(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C2482);
|
||||
ScriptContext_SetupScript(DebugScript_081C2482);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_FillPartyWithShroomish(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C23FD);
|
||||
ScriptContext_SetupScript(DebugScript_081C23FD);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveBarboachEgg(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C2518);
|
||||
ScriptContext_SetupScript(DebugScript_081C2518);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 CallScript_GiveShroomishEgg(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(DebugScript_081C2507);
|
||||
ScriptContext_SetupScript(DebugScript_081C2507);
|
||||
CloseMenu();
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ void debug_80C370C(void)
|
|||
void debug_80C373C(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
SetMainCallback2(sub_80546F0);
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ void InitWatanabeDebugMenu(void)
|
|||
case 3:
|
||||
if (!IsSEPlaying())
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
SetMainCallback2(sub_80546F0);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1443,7 +1443,7 @@ void sub_80FE1DC(void)
|
|||
void sub_80FE220(void)
|
||||
{
|
||||
gUnknown_020388D4 = 0;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sub_80FE1DC();
|
||||
sub_80FE394();
|
||||
}
|
||||
|
|
@ -1524,7 +1524,7 @@ void gpu_pal_decompress_alloc_tag_and_upload(u8 taskId)
|
|||
FreeSpritePaletteByTag(6);
|
||||
if (sDecorationContext.isPlayerRoom == 0)
|
||||
{
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_PCCancel);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_PCCancel);
|
||||
DestroyTask(taskId);
|
||||
} else
|
||||
{
|
||||
|
|
@ -2564,7 +2564,7 @@ void sub_81000C4(u8 taskId)
|
|||
{
|
||||
gUnknown_020391A4 = gTasks[taskId].data[0] - 7;
|
||||
gUnknown_020391A6 = gTasks[taskId].data[1] - 7;
|
||||
ScriptContext1_SetupScript(gUnknown_081A2F7B);
|
||||
ScriptContext_SetupScript(gUnknown_081A2F7B);
|
||||
}
|
||||
gSprites[gUnknown_020391A8].y += 2;
|
||||
sub_810028C(taskId);
|
||||
|
|
@ -2629,7 +2629,7 @@ void c1_overworld_prev_quest(u8 taskId)
|
|||
switch (gTasks[taskId].data[2])
|
||||
{
|
||||
case 0:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sub_80FF114(taskId);
|
||||
|
|
@ -2656,7 +2656,7 @@ void sub_8100334(u8 taskId)
|
|||
|
||||
void sub_8100364(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
LoadScrollIndicatorPalette();
|
||||
pal_fill_black();
|
||||
sub_80FE7EC(CreateTask(sub_8100334, 8));
|
||||
|
|
@ -3147,13 +3147,13 @@ void sub_8100C88(u8 taskId)
|
|||
if (!gPaletteFade.active)
|
||||
{
|
||||
DrawWholeMapView();
|
||||
ScriptContext1_SetupScript(gUnknown_081A2F8A);
|
||||
ScriptContext_SetupScript(gUnknown_081A2F8A);
|
||||
Menu_EraseWindowRect(0, 0, 29, 19);
|
||||
gTasks[taskId].data[2] = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sub_80FED90(taskId);
|
||||
pal_fill_black();
|
||||
gTasks[taskId].data[2] = 3;
|
||||
|
|
|
|||
|
|
@ -2925,7 +2925,7 @@ u8 sub_80EB868(u8 arg0)
|
|||
return (gSaveBlock1.unk2D8C[index] >> offset) & 1;
|
||||
}
|
||||
|
||||
void sub_80EB890(u8 arg0)
|
||||
void UnlockTrendySaying(u8 arg0)
|
||||
{
|
||||
int offset;
|
||||
int index;
|
||||
|
|
@ -2966,7 +2966,7 @@ u16 sub_80EB8EC(void)
|
|||
{
|
||||
if (local2 == 0)
|
||||
{
|
||||
sub_80EB890(i);
|
||||
UnlockTrendySaying(i);
|
||||
return (i & 0x1FF) | 0x2800;
|
||||
}
|
||||
local2--;
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ static void VBlankCB_EggHatch(void)
|
|||
|
||||
void EggHatch(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(Task_EggHatch, 10);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ static bool8 TryStartInteractionScript(struct MapPosition *position, u16 metatil
|
|||
&& script != EventScript_PC)
|
||||
PlaySE(5);
|
||||
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext_SetupScript(script);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -520,7 +520,7 @@ static bool32 TrySetupDiveDownScript(void)
|
|||
{
|
||||
if (FlagGet(FLAG_BADGE07_GET) && TrySetDiveWarp() == 2)
|
||||
{
|
||||
ScriptContext1_SetupScript(UseDiveScript);
|
||||
ScriptContext_SetupScript(UseDiveScript);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -530,7 +530,7 @@ static bool32 TrySetupDiveEmergeScript(void)
|
|||
{
|
||||
if (FlagGet(FLAG_BADGE07_GET) && gMapHeader.mapType == MAP_TYPE_UNDERWATER && TrySetDiveWarp() == 1)
|
||||
{
|
||||
ScriptContext1_SetupScript(S_UseDiveUnderwater);
|
||||
ScriptContext_SetupScript(S_UseDiveUnderwater);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -557,7 +557,7 @@ bool8 TryStartCoordEventScript(struct MapPosition *position)
|
|||
|
||||
if (script == NULL)
|
||||
return FALSE;
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext_SetupScript(script);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -565,7 +565,7 @@ bool8 TryStartCrackedFloorHoleScript(u16 metatileBehavior)
|
|||
{
|
||||
if (MetatileBehavior_IsCrackedFloorHole(metatileBehavior))
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_FallDownHole);
|
||||
ScriptContext_SetupScript(EventScript_FallDownHole);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -577,20 +577,20 @@ bool8 TryStartStepCountScript(void)
|
|||
UpdateHappinessStep();
|
||||
if (UpdatePoisonStepCounter() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(gUnknown_081A14B8);
|
||||
ScriptContext_SetupScript(gUnknown_081A14B8);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldEggHatch())
|
||||
{
|
||||
IncrementGameStat(GAME_STAT_HATCHED_EGGS);
|
||||
ScriptContext1_SetupScript(S_EggHatch);
|
||||
ScriptContext_SetupScript(S_EggHatch);
|
||||
return TRUE;
|
||||
}
|
||||
if (SafariZoneTakeStep() == TRUE)
|
||||
return TRUE;
|
||||
if (CountSSTidalStep(1) == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(gUnknown_0815FD0D);
|
||||
ScriptContext_SetupScript(gUnknown_0815FD0D);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -719,7 +719,7 @@ bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileBehavior
|
|||
}
|
||||
if (MetatileBehavior_IsMtPyreHole(metatileBehavior) == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(EventScript_FallDownHoleMtPyre);
|
||||
ScriptContext_SetupScript(EventScript_FallDownHoleMtPyre);
|
||||
return TRUE;
|
||||
}
|
||||
sub_8080E88();
|
||||
|
|
@ -837,7 +837,7 @@ static const u8 *TryRunCoordEventScript(const struct CoordEvent *coordEvent)
|
|||
}
|
||||
if (coordEvent->trigger == 0)
|
||||
{
|
||||
ScriptContext2_RunNewScript(coordEvent->script);
|
||||
RunScriptImmediately(coordEvent->script);
|
||||
return NULL;
|
||||
}
|
||||
if (VarGet(coordEvent->trigger) == (u8)coordEvent->index)
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@ void mapldr_080842E8(void)
|
|||
{
|
||||
pal_fill_black();
|
||||
CreateTask(task00_8084310, 0);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
|
|
@ -997,7 +997,7 @@ void mapldr_08084390(void)
|
|||
{
|
||||
ObjectEventTurn(&gObjectEvents[gPlayerAvatar.objectEventId], DIR_WEST);
|
||||
}
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
|
|
@ -1017,7 +1017,7 @@ void c3_080843F8(u8 taskId)
|
|||
}
|
||||
if (!FieldEffectActiveListContains(FLDEFF_FLY_IN))
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
|
@ -1031,7 +1031,7 @@ void sub_8086748(void)
|
|||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_for_map_transition();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CreateTask(sub_8086774, 0);
|
||||
gFieldCallback = NULL;
|
||||
|
|
@ -1148,7 +1148,7 @@ bool8 sub_80869B8(struct Task *task)
|
|||
bool8 sub_80869F8(struct Task *task)
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
CameraObjectReset1();
|
||||
UnfreezeObjectEvents();
|
||||
InstallCameraPanAheadCallback();
|
||||
|
|
@ -1299,7 +1299,7 @@ void sub_8086C94(void)
|
|||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_for_map_transition();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(sub_8086CBC, 0);
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
|
|
@ -1416,7 +1416,7 @@ bool8 sub_8086ED4(struct Task *task)
|
|||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
CameraObjectReset1();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
ObjectEventSetHeldMovement(objectEvent, GetWalkNormalMovementAction(DIR_EAST));
|
||||
DestroyTask(FindTaskIdByFunc(sub_8086CBC));
|
||||
}
|
||||
|
|
@ -1441,7 +1441,7 @@ void sub_8086F64(u8 taskId)
|
|||
|
||||
bool8 sub_8086FB0(struct Task *task, struct ObjectEvent *objectEvent)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
task->data[0]++;
|
||||
return FALSE;
|
||||
|
|
@ -1449,7 +1449,7 @@ bool8 sub_8086FB0(struct Task *task, struct ObjectEvent *objectEvent)
|
|||
|
||||
bool8 waterfall_1_do_anim_probably(struct Task *task, struct ObjectEvent *objectEvent)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
if (!ObjectEventIsMovementOverridden(objectEvent))
|
||||
{
|
||||
ObjectEventClearHeldMovementIfFinished(objectEvent);
|
||||
|
|
@ -1488,7 +1488,7 @@ bool8 sub_8087058(struct Task *task, struct ObjectEvent *objectEvent)
|
|||
task->data[0] = 3;
|
||||
return TRUE;
|
||||
}
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
DestroyTask(FindTaskIdByFunc(sub_8086F64));
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_WATERFALL);
|
||||
|
|
@ -1521,7 +1521,7 @@ bool8 sub_8087124(struct Task *task)
|
|||
|
||||
bool8 dive_2_unknown(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldEffectArguments[0] = task->data[15];
|
||||
FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT);
|
||||
task->data[0]++;
|
||||
|
|
@ -1662,7 +1662,7 @@ void mapldr_080851BC(void)
|
|||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_for_map_transition();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldCallback = NULL;
|
||||
CreateTask(sub_8087470, 0);
|
||||
}
|
||||
|
|
@ -1715,7 +1715,7 @@ bool8 sub_808759C(struct Task *task, struct ObjectEvent *objectEvent, struct Spr
|
|||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(sub_8087470));
|
||||
}
|
||||
|
|
@ -1843,7 +1843,7 @@ void sub_808788C(struct Sprite *sprite)
|
|||
|
||||
void StartEscapeRopeFieldEffect(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CreateTask(DoEscapeRopeFieldEffect, 0x50);
|
||||
}
|
||||
|
|
@ -1911,7 +1911,7 @@ void mapldr_080859D4(void)
|
|||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_for_map_transition();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
|
|
@ -1945,7 +1945,7 @@ void sub_8087AC8(struct Task *task)
|
|||
if (task->data[2] >= 32 && task->data[15] == GetPlayerFacingDirection())
|
||||
{
|
||||
objectEvent->invisible = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(sub_8087A74));
|
||||
return;
|
||||
|
|
@ -1986,7 +1986,7 @@ static void ExecuteTeleportFieldEffectTask(u8 taskId)
|
|||
|
||||
static void TeleportFieldEffectTask1(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
task->data[15] = GetPlayerFacingDirection();
|
||||
|
|
@ -2059,7 +2059,7 @@ static void mapldr_08085D88(void)
|
|||
{
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_for_map_transition();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gFieldCallback = NULL;
|
||||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
|
|
@ -2146,7 +2146,7 @@ void sub_8087FDC(struct Task *task)
|
|||
task->data[1] = 8;
|
||||
if ((++task->data[2]) > 4 && task->data[14] == objectEvent->facingDirection)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
CameraObjectReset1();
|
||||
UnfreezeObjectEvents();
|
||||
DestroyTask(FindTaskIdByFunc(sub_8087E1C));
|
||||
|
|
@ -2600,7 +2600,7 @@ void sub_8088954(u8 taskId)
|
|||
|
||||
void sub_8088984(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
SetPlayerAvatarStateMask(8);
|
||||
|
|
@ -2661,7 +2661,7 @@ void sub_8088AF4(struct Task *task)
|
|||
ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(objectEvent->movementDirection));
|
||||
sub_8127ED0(objectEvent->fieldEffectSpriteId, 1);
|
||||
UnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_SURF);
|
||||
DestroyTask(FindTaskIdByFunc(sub_8088954));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,13 +84,13 @@ void task0A_asap_script_env_2_enable_and_set_ctx_running(u8 taskID)
|
|||
if (sub_8080E70() == TRUE)
|
||||
{
|
||||
DestroyTask(taskID);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8080990(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_black();
|
||||
CreateTask(task0A_asap_script_env_2_enable_and_set_ctx_running, 10);
|
||||
|
|
@ -98,7 +98,7 @@ void sub_8080990(void)
|
|||
|
||||
void sub_80809B0(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
pal_fill_black();
|
||||
CreateTask(task0A_asap_script_env_2_enable_and_set_ctx_running, 10);
|
||||
}
|
||||
|
|
@ -123,7 +123,7 @@ void task_mpl_807DD60(u8 taskId)
|
|||
case 2:
|
||||
if (sub_8080E70() == TRUE)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ void task_mpl_807DD60(u8 taskId)
|
|||
|
||||
void sub_8080A3C(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
palette_bg_fill_black();
|
||||
CreateTask(task_mpl_807DD60, 10);
|
||||
|
|
@ -158,7 +158,7 @@ void sub_8080A5C(u8 taskId)
|
|||
if (sub_8080E70() == TRUE)
|
||||
{
|
||||
sub_8007B14();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ void sub_8080A5C(u8 taskId)
|
|||
|
||||
void sub_8080AC4(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
palette_bg_fill_black();
|
||||
CreateTask(sub_8080A5C, 10);
|
||||
|
|
@ -193,7 +193,7 @@ void mapldr_default(void)
|
|||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_for_map_transition();
|
||||
sub_8080AE4();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_8080B60(void)
|
||||
|
|
@ -201,7 +201,7 @@ void sub_8080B60(void)
|
|||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_black();
|
||||
sub_8080AE4();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_8080B78(void)
|
||||
|
|
@ -210,7 +210,7 @@ void sub_8080B78(void)
|
|||
pal_fill_for_map_transition();
|
||||
PlaySE(SE_WARP_OUT);
|
||||
CreateTask(task_map_chg_seq_0807E2CC, 10);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_8080B9C(u8 taskId)
|
||||
|
|
@ -256,7 +256,7 @@ void sub_8080B9C(u8 taskId)
|
|||
}
|
||||
break;
|
||||
case 4:
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
@ -294,7 +294,7 @@ void task_map_chg_seq_0807E20C(u8 taskId)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
@ -306,14 +306,14 @@ void task_map_chg_seq_0807E2CC(u8 taskId)
|
|||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
if (sub_8080E70())
|
||||
{
|
||||
UnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
@ -333,14 +333,14 @@ void sub_8080DEC(void)
|
|||
{
|
||||
pal_fill_black();
|
||||
CreateStartMenuTask(sub_8080DC4);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void task_mpl_807E3C8(u8 taskId)
|
||||
{
|
||||
if (sub_8080E70() == 1)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
}
|
||||
|
|
@ -348,14 +348,14 @@ void task_mpl_807E3C8(u8 taskId)
|
|||
|
||||
void sub_8080E28(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
pal_fill_black();
|
||||
CreateTask(task_mpl_807E3C8, 10);
|
||||
}
|
||||
|
||||
void sub_8080E44(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
pal_fill_black();
|
||||
CreateTask(task_mpl_807E3C8, 10);
|
||||
|
|
@ -376,7 +376,7 @@ bool32 sub_8080E70(void)
|
|||
|
||||
void sub_8080E88(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeScreen();
|
||||
PlayRainSoundEffect();
|
||||
|
|
@ -387,7 +387,7 @@ void sub_8080E88(void)
|
|||
|
||||
void sp13E_warp_to_last_warp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeScreen();
|
||||
PlayRainSoundEffect();
|
||||
|
|
@ -397,7 +397,7 @@ void sp13E_warp_to_last_warp(void)
|
|||
|
||||
void sub_8080EF0(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gFieldCallback = mapldr_default;
|
||||
CreateTask(sub_808115C, 10);
|
||||
}
|
||||
|
|
@ -410,25 +410,25 @@ void DoFallWarp(void)
|
|||
|
||||
void sub_8080F2C(u8 metatileBehavior)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sub_8086A2C(metatileBehavior, 10);
|
||||
}
|
||||
|
||||
void sub_8080F48(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sub_80871B8(10);
|
||||
}
|
||||
|
||||
void sub_8080F58(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
sub_8087654(10);
|
||||
}
|
||||
|
||||
void sub_8080F68(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeScreen();
|
||||
PlaySE(SE_WARP_IN);
|
||||
|
|
@ -438,7 +438,7 @@ void sub_8080F68(void)
|
|||
|
||||
void sub_8080F9C(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
WarpFadeScreen();
|
||||
CreateTask(task0A_fade_n_map_maybe, 10);
|
||||
gFieldCallback = sub_80C791C;
|
||||
|
|
@ -451,7 +451,7 @@ static void WaitCableClubWarp(u8 taskId)
|
|||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
|
|
@ -468,7 +468,7 @@ static void WaitCableClubWarp(u8 taskId)
|
|||
|
||||
void DoCableClubWarp(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeScreen();
|
||||
PlaySE(SE_EXIT);
|
||||
|
|
@ -517,12 +517,12 @@ void debug_sub_80888D8()
|
|||
{
|
||||
debug_sub_8052E04();
|
||||
sub_8080E88();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
/* asm("\
|
||||
PUSH {LR}\n\
|
||||
BL debug_sub_8052E04\n\
|
||||
BL sub_8080E88\n\
|
||||
BL ScriptContext2_Enable\n\
|
||||
BL LockPlayerFieldControls\n\
|
||||
POP {R0}\n\
|
||||
BX R0");*/
|
||||
}
|
||||
|
|
@ -537,7 +537,7 @@ void task0A_fade_n_map_maybe(u8 taskId)
|
|||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
|
|
@ -615,7 +615,7 @@ void sub_80812C8(u8 taskId)
|
|||
{
|
||||
case 0:
|
||||
FreezeObjectEvents();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
|
|
@ -634,7 +634,7 @@ void sub_80812C8(u8 taskId)
|
|||
|
||||
void sub_8081334(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
TryFadeOutOldMapMusic();
|
||||
WarpFadeScreen();
|
||||
PlayRainSoundEffect();
|
||||
|
|
|
|||
|
|
@ -1282,7 +1282,7 @@ static void Task_BumpBoulder(u8 taskId)
|
|||
|
||||
static bool8 sub_8059E84(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
task->data[0]++;
|
||||
return FALSE;
|
||||
|
|
@ -1316,7 +1316,7 @@ static bool8 sub_8059F40(struct Task *task, struct ObjectEvent *playerObject, st
|
|||
ObjectEventClearHeldMovementIfFinished(playerObject);
|
||||
ObjectEventClearHeldMovementIfFinished(strengthObject);
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(FindTaskIdByFunc(Task_BumpBoulder));
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -1374,7 +1374,7 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct Objec
|
|||
task->data[0]++;
|
||||
task->data[1] = objectEvent->movementDirection;
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
PlaySE(SE_WARP_IN);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1420,7 +1420,7 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct Objec
|
|||
if (ObjectEventClearHeldMovementIfFinished(objectEvent))
|
||||
{
|
||||
ObjectEventSetHeldMovement(objectEvent, GetWalkSlowMovementAction(GetOppositeDirection(task->data[1])));
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
DestroyTask(FindTaskIdByFunc(PlayerAvatar_DoSecretBaseMatSpin));
|
||||
}
|
||||
|
|
@ -1433,7 +1433,7 @@ static void sub_805A20C(u8 a)
|
|||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_ClearSavedMusic();
|
||||
Overworld_ChangeMusicToDefault();
|
||||
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_SURFING;
|
||||
|
|
@ -1467,7 +1467,7 @@ static void sub_805A2D0(u8 taskId)
|
|||
ObjectEventSetGraphicsId(playerObjEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
|
||||
ObjectEventSetHeldMovement(playerObjEvent, GetFaceDirectionMovementAction(playerObjEvent->facingDirection));
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroySprite(&gSprites[playerObjEvent->fieldEffectSpriteId]);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
|
@ -1527,7 +1527,7 @@ static void Task_Fishing(u8 taskId)
|
|||
|
||||
static bool8 Fishing1(struct Task *task)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
task->tStep++;
|
||||
return FALSE;
|
||||
|
|
@ -1714,7 +1714,7 @@ static bool8 Fishing11(struct Task *task)
|
|||
if (task->tFrameCounter != 0)
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
FishingWildEncounter(task->tFishingRod);
|
||||
sub_80BE97C(1);
|
||||
DestroyTask(FindTaskIdByFunc(Task_Fishing));
|
||||
|
|
@ -1774,7 +1774,7 @@ static bool8 Fishing16(struct Task *task)
|
|||
if (Menu_UpdateWindowText())
|
||||
{
|
||||
gPlayerAvatar.preventStep = FALSE;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
UnfreezeObjectEvents();
|
||||
Menu_EraseScreen();
|
||||
sub_80BE97C(0);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ static void Task_WhiteOut(u8 taskId)
|
|||
gSpecialVar_Result = 1;
|
||||
else
|
||||
gSpecialVar_Result = 0;
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ static void Task_WhiteOut(u8 taskId)
|
|||
void ExecuteWhiteOut(void)
|
||||
{
|
||||
CreateTask(Task_WhiteOut, 0x50);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
s32 DoPoisonFieldEffect(void)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ static void sub_80814E8(u8 taskId)
|
|||
{
|
||||
if (!FuncIsActiveTask(UpdateFlashLevelEffect))
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ void sub_8081594(u8 flashLevel)
|
|||
value = 1;
|
||||
sub_8081534(120, 80, sFlashLevelPixelRadii[curFlashLevel], sFlashLevelPixelRadii[flashLevel], value, 1);
|
||||
sub_8081510();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void WriteFlashScanlineEffectBuffer(u8 flashLevel)
|
||||
|
|
@ -234,7 +234,7 @@ static void sub_80816A8(u8 taskId)
|
|||
case 2:
|
||||
if (!FuncIsActiveTask(UpdateFlashLevelEffect))
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
data[0] = 3;
|
||||
}
|
||||
break;
|
||||
|
|
@ -283,7 +283,7 @@ static void sub_80816A8(u8 taskId)
|
|||
REG_BLDALPHA = data[8];
|
||||
REG_WININ = data[9];
|
||||
REG_WINOUT = data[10];
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
@ -337,6 +337,6 @@ static void task50_0807F0C8(u8 taskId)
|
|||
if (BGMusicStopped() == TRUE)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ void Task_HandleTruckSequence(u8 taskId)
|
|||
DrawWholeMapView();
|
||||
PlaySE(SE_TRUCK_DOOR);
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ void ExecuteTruckSequence(void)
|
|||
MapGridSetMetatileIdAt(11, 9, METATILE_ID(InsideOfTruck, DoorClosedFloor_Mid));
|
||||
MapGridSetMetatileIdAt(11, 10, METATILE_ID(InsideOfTruck, DoorClosedFloor_Bottom));
|
||||
DrawWholeMapView();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CpuFastFill(0, gPlttBufferFaded, 0x400);
|
||||
CreateTask(Task_HandleTruckSequence, 0xA);
|
||||
}
|
||||
|
|
@ -370,7 +370,7 @@ void sub_80C791C(void)
|
|||
gObjectEvents[gPlayerAvatar.objectEventId].invisible = TRUE;
|
||||
pal_fill_black();
|
||||
CreateTask(Task_HandlePorthole, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_80C7958(void)
|
||||
|
|
|
|||
|
|
@ -70,14 +70,14 @@ static struct ElevatorMenu gUnknown_03000760[20];
|
|||
void ScrSpecial_ShowDiploma(void)
|
||||
{
|
||||
SetMainCallback2(CB2_ShowDiploma);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ScrSpecial_ViewWallClock(void)
|
||||
{
|
||||
gMain.savedCallback = CB2_ReturnToField;
|
||||
SetMainCallback2(CB2_ViewWallClock);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ResetCyclingRoadChallengeData(void)
|
||||
|
|
@ -585,7 +585,7 @@ static void Task_SlideOpenPetalburgGymDoors(u8 taskId)
|
|||
if ((++gPetalburgGymSlidingDoorIndex) == 5)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1073,7 +1073,7 @@ void ScriptShowElevatorMenu(void)
|
|||
static void sub_810E874(void)
|
||||
{
|
||||
u8 i;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
if (gUnknown_0203925A > 5)
|
||||
{
|
||||
Menu_DrawStdWindowFrame(0, 0, 8, 11);
|
||||
|
|
@ -1257,7 +1257,7 @@ void sub_810EC34(u8 taskId)
|
|||
void sub_810EC9C(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void sub_810ECB0(void)
|
||||
|
|
@ -1456,7 +1456,7 @@ void GlassWorkshopUpdateScrollIndicators(u8, u8);
|
|||
void ShowGlassWorkshopMenu(void)
|
||||
{
|
||||
u8 i;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Menu_DrawStdWindowFrame(0, 0, 10, 11);
|
||||
InitMenu(0, 1, 1, 5, 0, 9);
|
||||
gUnknown_0203925C = 0;
|
||||
|
|
@ -1830,7 +1830,7 @@ static void sub_810F7A8(u8 taskId)
|
|||
static void sub_810F814(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
bool8 FoundBlackGlasses(void)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ void Task_RunTimeBasedEvents(u8 taskId)
|
|||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
if (!ScriptContext2_IsEnabled())
|
||||
if (!ArePlayerFieldControlsLocked())
|
||||
{
|
||||
RunTimeBasedEvents(data);
|
||||
UpdateAmbientCry(&tAmbientCryState, &tAmbientCryDelay);
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ void task50_0807B6D4(u8 taskId)
|
|||
task->tState++;
|
||||
break;
|
||||
case 4:
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static void Task_WateringBerryTreeAnim_3(u8 taskId)
|
|||
{
|
||||
SetPlayerAvatarTransitionFlags(sub_80597D0());
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void DoWateringBerryTreeAnim(void)
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void Debug_SetUpFieldMove_Cut(void)
|
|||
}
|
||||
}
|
||||
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -186,7 +186,7 @@ bool8 FldEff_UseCutOnGrass(void)
|
|||
static void FieldCallback_CutTree(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
ScriptContext1_SetupScript(DoCutFieldEffectScript);
|
||||
ScriptContext_SetupScript(DoCutFieldEffectScript);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseCutOnTree(void)
|
||||
|
|
@ -378,12 +378,12 @@ static void CutGrassSpriteCallbackEnd(struct Sprite *sprite)
|
|||
DestroySprite(&gSprites[eCutGrassSpriteArray[i]]);
|
||||
FieldEffectStop(&gSprites[eCutGrassSpriteArray[0]], FLDEFF_CUT_GRASS);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void StartCutTreeFieldEffect(void)
|
||||
{
|
||||
PlaySE(SE_M_CUT);
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_CUT_ON_TREE);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ bool8 FldEff_SandPillar(void)
|
|||
{
|
||||
s16 x, y;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||
gFieldEffectArguments[5] = x;
|
||||
gFieldEffectArguments[6] = y;
|
||||
|
|
@ -328,7 +328,7 @@ void SpriteCB_SandPillar_1(struct Sprite *sprite)
|
|||
void SpriteCB_SandPillar_2(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SAND_PILLAR);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void GetShieldToyTVDecorationInfo(void)
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void debug_sub_8122080(void)
|
|||
if (gMapHeader.cave == 1 && !FlagGet(FLAG_SYS_USE_FLASH))
|
||||
sub_810CBFC();
|
||||
else
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -108,7 +108,7 @@ static void sub_810CC34(void)
|
|||
{
|
||||
PlaySE(SE_M_REFLECT);
|
||||
FlagSet(FLAG_SYS_USE_FLASH);
|
||||
ScriptContext1_SetupScript(gUnknown_081B694A);
|
||||
ScriptContext_SetupScript(gUnknown_081B694A);
|
||||
}
|
||||
|
||||
void sub_810CC54(void)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static void Task_SecretBasePCTurnOn(u8 taskId)
|
|||
MapGridSetMetatileIdAt(data[0], data[1], 548);
|
||||
CurrentMapDrawMetatileAt(data[0], data[1]);
|
||||
FieldEffectActiveListRemove(FLDEFF_SECRET_BASE_PC_TURN_ON);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ void Debug_SetUpFieldMove_SecretPower(void)
|
|||
|
||||
if (gSpecialVar_Result == 1 || GetPlayerFacingDirection() != DIR_NORTH)
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ void Debug_SetUpFieldMove_SecretPower(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ bool8 SetUpFieldMove_SecretPower(void)
|
|||
static void FieldCallback_SecretBaseCave(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
ScriptContext1_SetupScript(DoSecretBaseCaveFieldEffectScript);
|
||||
ScriptContext_SetupScript(DoSecretBaseCaveFieldEffectScript);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseSecretPowerCave(void)
|
||||
|
|
@ -383,13 +383,13 @@ static void CaveEntranceSpriteCallback2(struct Sprite *sprite)
|
|||
static void CaveEntranceSpriteCallbackEnd(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SECRET_POWER_CAVE);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void FieldCallback_SecretBaseTree(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
ScriptContext1_SetupScript(DoSecretBaseTreeFieldEffectScript);
|
||||
ScriptContext_SetupScript(DoSecretBaseTreeFieldEffectScript);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseSecretPowerTree(void)
|
||||
|
|
@ -456,13 +456,13 @@ static void TreeEntranceSpriteCallback2(struct Sprite *sprite)
|
|||
static void TreeEntranceSpriteCallbackEnd(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SECRET_POWER_TREE);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void FieldCallback_SecretBaseShrub(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
ScriptContext1_SetupScript(DoSecretBaseShrubFieldEffectScript);
|
||||
ScriptContext_SetupScript(DoSecretBaseShrubFieldEffectScript);
|
||||
}
|
||||
|
||||
bool8 FldEff_UseSecretPowerShrub(void)
|
||||
|
|
@ -517,5 +517,5 @@ static void ShrubEntranceSpriteCallback2(struct Sprite *sprite)
|
|||
static void ShrubEntranceSpriteCallbackEnd(struct Sprite *sprite)
|
||||
{
|
||||
FieldEffectStop(sprite, FLDEFF_SECRET_POWER_SHRUB);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void debug_sub_8130318(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -67,7 +67,7 @@ bool8 SetUpFieldMove_Strength(void)
|
|||
static void sub_811AA18(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
ScriptContext1_SetupScript(S_UseStrength);
|
||||
ScriptContext_SetupScript(S_UseStrength);
|
||||
}
|
||||
|
||||
static void sub_811AA38(void)
|
||||
|
|
@ -95,6 +95,6 @@ static void sub_811AA9C(void)
|
|||
else
|
||||
{
|
||||
FieldEffectActiveListRemove(40);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static void FailSweetScentEncounter(u8 taskId)
|
|||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
ScriptContext1_SetupScript(SweetScentNothingHereScript);
|
||||
ScriptContext_SetupScript(SweetScentNothingHereScript);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ static void Task_WaitForPaletteFade(u8);
|
|||
void AccessHallOfFamePC(void)
|
||||
{
|
||||
SetMainCallback2(sub_81428CC);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ReturnFromHallOfFamePC(void)
|
||||
|
|
@ -26,7 +26,7 @@ void ReturnFromHallOfFamePC(void)
|
|||
|
||||
static void ReshowPCMenuAfterHallOfFamePC(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
Overworld_PlaySpecialMapMusic();
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0));
|
||||
ScriptMenu_CreatePCMultichoice();
|
||||
|
|
|
|||
|
|
@ -2124,7 +2124,7 @@ void CleanUpOverworldMessage(u8 taskId)
|
|||
Menu_EraseWindowRect(0, 13, 29, 19);
|
||||
DestroyTask(taskId);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ExecuteItemUseFromBlackPalette(void)
|
||||
|
|
@ -2745,7 +2745,7 @@ bool32 UseRegisteredKeyItem(void)
|
|||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
FreezeObjectEvents();
|
||||
sub_80594C0();
|
||||
sub_80597F4();
|
||||
|
|
@ -2756,7 +2756,7 @@ bool32 UseRegisteredKeyItem(void)
|
|||
}
|
||||
gSaveBlock1.registeredItem = 0;
|
||||
}
|
||||
ScriptContext1_SetupScript(Event_NoRegisteredItem);
|
||||
ScriptContext_SetupScript(Event_NoRegisteredItem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ void ItemUseOnFieldCB_Bike(u8 taskId)
|
|||
GetOnOffBike(PLAYER_AVATAR_FLAG_ACRO_BIKE);
|
||||
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ void ExitItemfinder(u8 taskId)
|
|||
{
|
||||
Menu_EraseWindowRect(0, 14, 29, 19);
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -659,8 +659,8 @@ void ItemUseOutOfBattle_Berry(u8 taskId)
|
|||
static void ItemUseOnFieldCB_Berry(u8 taskId)
|
||||
{
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext1_SetupScript(S_PlantBerryTreeFromBag);
|
||||
LockPlayerFieldControls();
|
||||
ScriptContext_SetupScript(S_PlantBerryTreeFromBag);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
@ -679,8 +679,8 @@ void ItemUseOutOfBattle_WailmerPail(u8 taskId)
|
|||
|
||||
static void ItemUseOnFieldCB_WailmerPail(u8 taskId)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext1_SetupScript(S_WaterBerryTreeFromBag);
|
||||
LockPlayerFieldControls();
|
||||
ScriptContext_SetupScript(S_WaterBerryTreeFromBag);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -810,8 +810,8 @@ void debug_sub_810CCEC(u8 taskId)
|
|||
u8 debug_sub_810CD9C(void)
|
||||
{
|
||||
CloseMenu();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_Stop();
|
||||
LockPlayerFieldControls();
|
||||
gUnknown_Debug_0300079C = 0;
|
||||
gSpecialVar_0x8004 = gSpecialVar_0x8005 = gSpecialVar_0x8006 = 0;
|
||||
SetMainCallback2(debug_sub_810D388);
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ void ScrSpecial_PlayBardSong(void)
|
|||
{
|
||||
StartBardSong(gSpecialVar_0x8004);
|
||||
Menu_DisplayDialogueFrame();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
}
|
||||
|
||||
void ScrSpecial_GetHipsterSpokenFlag(void)
|
||||
|
|
@ -747,7 +747,7 @@ static void Task_BardSong(u8 taskId)
|
|||
{
|
||||
FadeInNewBGM(MUS_POKE_CENTER, 6);
|
||||
m4aMPlayFadeOutTemporarily(&gMPlayInfo_SE2, 2);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else if (gStringVar4[task->tCharIndex] == CHAR_SPACE)
|
||||
|
|
@ -1093,7 +1093,7 @@ static void Task_StoryListMenu(u8 taskId)
|
|||
Menu_DestroyCursor();
|
||||
Menu_EraseWindowRect(0, 0, 25, 12);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void CloseMenu(void)
|
|||
PlaySE(SE_SELECT);
|
||||
Menu_EraseScreen();
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
Menu_DestroyCursor();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ static void VBlankCB_MoveTutorMenu(void)
|
|||
|
||||
void DisplayMoveTutorMenu(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(InitMoveTutorMenuWaitFade, 10);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,50 +2,50 @@
|
|||
|
||||
#if ENGLISH
|
||||
|
||||
const u8 gOtherText_BerryObtainedDadHasIt[] = _("Obtained a {STR_VAR_2} BERRY!\nDad has it at PETALBURG GYM.");
|
||||
const u8 gText_MysteryEventBerry[] = _("Obtained a {STR_VAR_2} BERRY!\nDad has it at PETALBURG GYM.");
|
||||
|
||||
const u8 gOtherText_BerryTransformed[] = _("The {STR_VAR_1} BERRY transformed into\none {STR_VAR_2} BERRY.");
|
||||
const u8 gText_MysteryEventBerryTransform[] = _("The {STR_VAR_1} BERRY transformed into\none {STR_VAR_2} BERRY.");
|
||||
|
||||
const u8 gOtherText_BerryAlreadyObtained[] = _("The {STR_VAR_1} BERRY has already been\nobtained.");
|
||||
const u8 gText_MysteryEventBerryObtained[] = _("The {STR_VAR_1} BERRY has already been\nobtained.");
|
||||
|
||||
const u8 gOtherText_SpecialRibbonReceived[] = _("A special RIBBON was awarded to your\nparty POKéMON.");
|
||||
const u8 gText_MysteryEventSpecialRibbon[] = _("A special RIBBON was awarded to your\nparty POKéMON.");
|
||||
|
||||
const u8 gOtherText_DexUpgraded[] = _("The POKéDEX has been upgraded with\nthe NATIONAL MODE.");
|
||||
const u8 gText_MysteryEventNationalDex[] = _("The POKéDEX has been upgraded with\nthe NATIONAL MODE.");
|
||||
|
||||
const u8 gOtherText_RareWordAdded[] = _("A rare word has been added.");
|
||||
const u8 gText_MysteryEventRareWord[] = _("A rare word has been added.");
|
||||
|
||||
const u8 gOtherText_PokeWasSentOver[] = _("{STR_VAR_1} was sent over!");
|
||||
const u8 gText_MysteryEventSentOver[] = _("{STR_VAR_1} was sent over!");
|
||||
|
||||
const u8 gOtherText_PartyIsFull[] = _("Your party is full.\n{STR_VAR_1} could not be sent over.");
|
||||
const u8 gText_MysteryEventFullParty[] = _("Your party is full.\n{STR_VAR_1} could not be sent over.");
|
||||
|
||||
const u8 gOtherText_NewTrainerInHoenn[] = _("A new TRAINER has arrived in HOENN.");
|
||||
const u8 gText_MysteryEventNewTrainer[] = _("A new TRAINER has arrived in HOENN.");
|
||||
|
||||
const u8 gOtherText_NewAdversaryInBattleTower[] = _("A new adversary has arrived in the\nBATTLE TOWER.");
|
||||
const u8 gText_MysteryEventNewAdversaryInBattleTower[] = _("A new adversary has arrived in the\nBATTLE TOWER.");
|
||||
|
||||
const u8 gOtherText_DataCannotUseVersion[] = _("This data cannot be used in\nthis version.");
|
||||
const u8 gText_MysteryEventCantBeUsed[] = _("This data cannot be used in\nthis version.");
|
||||
|
||||
#elif GERMAN
|
||||
|
||||
const u8 gOtherText_BerryObtainedDadHasIt[] = _("Eine {STR_VAR_2}BEERE! Vater in der \nARENA von BLÜTENBURG CITY besitzt\lauch eine.");
|
||||
const u8 gText_MysteryEventBerry[] = _("Eine {STR_VAR_2}BEERE! Vater in der \nARENA von BLÜTENBURG CITY besitzt\lauch eine.");
|
||||
|
||||
const u8 gOtherText_BerryTransformed[] = _("Die {STR_VAR_1}BEERE verwandelte\nsich in eine {STR_VAR_2}BEERE!");
|
||||
const u8 gText_MysteryEventBerryTransform[] = _("Die {STR_VAR_1}BEERE verwandelte\nsich in eine {STR_VAR_2}BEERE!");
|
||||
|
||||
const u8 gOtherText_BerryAlreadyObtained[] = _("Du hast schon eine {STR_VAR_1}BEERE.");
|
||||
const u8 gText_MysteryEventBerryObtained[] = _("Du hast schon eine {STR_VAR_1}BEERE.");
|
||||
|
||||
const u8 gOtherText_SpecialRibbonReceived[] = _("Ein besonderes BAND wurde deinem\nPOKéMON im Team verliehen.");
|
||||
const u8 gText_MysteryEventSpecialRibbon[] = _("Ein besonderes BAND wurde deinem\nPOKéMON im Team verliehen.");
|
||||
|
||||
const u8 gOtherText_DexUpgraded[] = _("Der POKéDEX wurde mit dem NATIONALEN\nMODUS ausgerüstet.");
|
||||
const u8 gText_MysteryEventNationalDex[] = _("Der POKéDEX wurde mit dem NATIONALEN\nMODUS ausgerüstet.");
|
||||
|
||||
const u8 gOtherText_RareWordAdded[] = _("Ein seltenes Wort wurde hinzugefügt.");
|
||||
const u8 gText_MysteryEventRareWord[] = _("Ein seltenes Wort wurde hinzugefügt.");
|
||||
|
||||
const u8 gOtherText_PokeWasSentOver[] = _("{STR_VAR_1} wurde gesendet!");
|
||||
const u8 gText_MysteryEventSentOver[] = _("{STR_VAR_1} wurde gesendet!");
|
||||
|
||||
const u8 gOtherText_PartyIsFull[] = _("Dein Team ist bereits vollständig.\n{STR_VAR_1} kann nicht gesendet\lwerden.");
|
||||
const u8 gText_MysteryEventFullParty[] = _("Dein Team ist bereits vollständig.\n{STR_VAR_1} kann nicht gesendet\lwerden.");
|
||||
|
||||
const u8 gOtherText_NewTrainerInHoenn[] = _("Ein neuer TRAINER ist in HOENN\nangekommen.");
|
||||
const u8 gText_MysteryEventNewTrainer[] = _("Ein neuer TRAINER ist in HOENN\nangekommen.");
|
||||
|
||||
const u8 gOtherText_NewAdversaryInBattleTower[] = _("Ein neuer Widersacher ist im DUELLTURM\neingetroffen.");
|
||||
const u8 gText_MysteryEventNewAdversaryInBattleTower[] = _("Ein neuer Widersacher ist im DUELLTURM\neingetroffen.");
|
||||
|
||||
const u8 gOtherText_DataCannotUseVersion[] = _("Die Daten können in dieser Edition\nnicht eingesetzt werden.");
|
||||
const u8 gText_MysteryEventCantBeUsed[] = _("Die Daten können in dieser Edition\nnicht eingesetzt werden.");
|
||||
|
||||
#endif // ENGLISH/GERMAN
|
||||
|
|
|
|||
|
|
@ -9,44 +9,52 @@
|
|||
#include "pokemon.h"
|
||||
#include "pokemon_size_record.h"
|
||||
#include "script.h"
|
||||
#include "constants/species.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "text.h"
|
||||
#include "util.h"
|
||||
#include "mystery_event_msg.h"
|
||||
|
||||
#if ENGLISH
|
||||
#define LANGUAGE_MASK 0x2
|
||||
#elif GERMAN
|
||||
#define LANGUAGE_MASK 0x4
|
||||
#endif
|
||||
|
||||
#ifdef SAPPHIRE
|
||||
#define VERSION_MASK 0x100
|
||||
#else
|
||||
#define VERSION_MASK 0x80
|
||||
#endif
|
||||
|
||||
extern void party_compaction(void);
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "constants/berry.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
extern ScrCmdFunc gMysteryEventScriptCmdTable[];
|
||||
extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[];
|
||||
|
||||
// 0x1 in English FRLG, 0x1 in English Emerald
|
||||
#if ENGLISH
|
||||
#define LANGUAGE_MASK (1 << 1)
|
||||
#elif GERMAN
|
||||
#define LANGUAGE_MASK (1 << 2)
|
||||
#endif
|
||||
|
||||
// 0x1 in FireRed, 0x2 in LeafGreen, 0x200 in Emerald
|
||||
#ifdef SAPPHIRE
|
||||
#define VERSION_MASK (1 << 8)
|
||||
#else
|
||||
#define VERSION_MASK (1 << 7)
|
||||
#endif
|
||||
|
||||
#define mScriptBase data[0]
|
||||
#define mOffset data[1]
|
||||
#define mStatus data[2]
|
||||
#define mValid data[3]
|
||||
|
||||
static EWRAM_DATA struct ScriptContext sMysteryEventScriptContext = {0};
|
||||
|
||||
static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4)
|
||||
static bool32 CheckCompatibility(u16 unk0, u32 unk1, u16 unk2, u32 version)
|
||||
{
|
||||
if (!(a1 & LANGUAGE_MASK))
|
||||
if (!(unk0 & LANGUAGE_MASK))
|
||||
return FALSE;
|
||||
|
||||
if (!(a2 & LANGUAGE_MASK))
|
||||
if (!(unk1 & LANGUAGE_MASK))
|
||||
return FALSE;
|
||||
|
||||
if (!(a3 & 0x4))
|
||||
// 0x1 in FRLG, 0x4 in Emerald
|
||||
if (!(unk2 & 0x4))
|
||||
return FALSE;
|
||||
|
||||
if (!(a4 & VERSION_MASK))
|
||||
if (!(version & VERSION_MASK))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -54,23 +62,23 @@ static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4)
|
|||
|
||||
static void SetIncompatible(void)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_DataCannotUseVersion);
|
||||
SetMysteryEventScriptStatus(3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventCantBeUsed);
|
||||
SetMysteryEventScriptStatus(MEVENT_STATUS_FAILURE);
|
||||
}
|
||||
|
||||
static void InitMysteryEventScript(struct ScriptContext *ctx, u8 *script)
|
||||
{
|
||||
InitScriptContext(ctx, gMysteryEventScriptCmdTable, gMysteryEventScriptCmdTableEnd);
|
||||
SetupBytecodeScript(ctx, script);
|
||||
ctx->data[0] = (u32)script;
|
||||
ctx->data[1] = 0;
|
||||
ctx->data[2] = 0;
|
||||
ctx->data[3] = 0;
|
||||
ctx->mScriptBase = (u32)script;
|
||||
ctx->mOffset = 0;
|
||||
ctx->mStatus = MEVENT_STATUS_LOAD_OK;
|
||||
ctx->mValid = FALSE;
|
||||
}
|
||||
|
||||
static bool32 RunMysteryEventScriptCommand(struct ScriptContext *ctx)
|
||||
{
|
||||
if (RunScriptCommand(ctx) && ctx->data[3])
|
||||
if (RunScriptCommand(ctx) && ctx->mValid)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
|
@ -80,14 +88,14 @@ u32 RunMysteryEventScript(u8 *script)
|
|||
{
|
||||
struct ScriptContext *ctx = &sMysteryEventScriptContext;
|
||||
InitMysteryEventScript(ctx, script);
|
||||
while (RunMysteryEventScriptCommand(ctx))
|
||||
;
|
||||
return ctx->data[2];
|
||||
while (RunMysteryEventScriptCommand(ctx));
|
||||
|
||||
return ctx->mStatus;
|
||||
}
|
||||
|
||||
void SetMysteryEventScriptStatus(u32 val)
|
||||
void SetMysteryEventScriptStatus(u32 status)
|
||||
{
|
||||
sMysteryEventScriptContext.data[2] = val;
|
||||
sMysteryEventScriptContext.mStatus = status;
|
||||
}
|
||||
|
||||
static int CalcChecksum(u8 *data, int size)
|
||||
|
|
@ -161,25 +169,16 @@ static u32 CalcRecordMixingGiftChecksum(void)
|
|||
static bool32 IsRecordMixingGiftValid(void)
|
||||
{
|
||||
struct RecordMixingGiftData *data = &gSaveBlock1.recordMixingGift.data;
|
||||
|
||||
u32 checksum = CalcRecordMixingGiftChecksum();
|
||||
|
||||
if (!data->unk0)
|
||||
if (data->unk0 == 0
|
||||
|| data->quantity == 0
|
||||
|| data->itemId == 0
|
||||
|| checksum == 0
|
||||
|| checksum != gSaveBlock1.recordMixingGift.checksum)
|
||||
return FALSE;
|
||||
|
||||
if (!data->quantity)
|
||||
return FALSE;
|
||||
|
||||
if (!data->itemId)
|
||||
return FALSE;
|
||||
|
||||
if (checksum == 0)
|
||||
return FALSE;
|
||||
|
||||
if (checksum == gSaveBlock1.recordMixingGift.checksum)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void ClearRecordMixingGift(void)
|
||||
|
|
@ -219,6 +218,7 @@ u16 GetRecordMixingGift(void)
|
|||
ClearRecordMixingGift();
|
||||
else
|
||||
gSaveBlock1.recordMixingGift.checksum = CalcRecordMixingGiftChecksum();
|
||||
|
||||
return itemId;
|
||||
}
|
||||
}
|
||||
|
|
@ -231,19 +231,19 @@ bool8 MEScrCmd_end(struct ScriptContext *ctx)
|
|||
|
||||
bool8 MEScrCmd_checkcompat(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 v1;
|
||||
u32 v2;
|
||||
u16 v3;
|
||||
u32 v4;
|
||||
u16 unk0;
|
||||
u32 unk1;
|
||||
u16 unk2;
|
||||
u32 version;
|
||||
|
||||
ctx->data[1] = ScriptReadWord(ctx);
|
||||
v1 = ScriptReadHalfword(ctx);
|
||||
v2 = ScriptReadWord(ctx);
|
||||
v3 = ScriptReadHalfword(ctx);
|
||||
v4 = ScriptReadWord(ctx);
|
||||
ctx->mOffset = ScriptReadWord(ctx);
|
||||
unk0 = ScriptReadHalfword(ctx);
|
||||
unk1 = ScriptReadWord(ctx);
|
||||
unk2 = ScriptReadHalfword(ctx);
|
||||
version = ScriptReadWord(ctx);
|
||||
|
||||
if (CheckCompatibility(v1, v2, v3, v4) == TRUE)
|
||||
ctx->data[3] = 1;
|
||||
if (CheckCompatibility(unk0, unk1, unk2, version) == TRUE)
|
||||
ctx->mValid = TRUE;
|
||||
else
|
||||
SetIncompatible();
|
||||
|
||||
|
|
@ -257,24 +257,24 @@ bool8 MEScrCmd_nop(struct ScriptContext *ctx)
|
|||
|
||||
bool8 MEScrCmd_setstatus(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 value = ScriptReadByte(ctx);
|
||||
ctx->data[2] = value;
|
||||
u8 status = ScriptReadByte(ctx);
|
||||
ctx->mStatus = status;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_setmsg(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 value = ScriptReadByte(ctx);
|
||||
u8 *str = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
if (value == 255 || value == ctx->data[2])
|
||||
u8 status = ScriptReadByte(ctx);
|
||||
u8 *str = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
if (status == MEVENT_STATUS_FF || status == ctx->mStatus)
|
||||
StringExpandPlaceholders(gStringVar4, str);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_runscript(struct ScriptContext *ctx)
|
||||
{
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
ScriptContext2_RunNewScript(script);
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
RunScriptImmediately(script);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -283,35 +283,35 @@ bool8 MEScrCmd_setenigmaberry(struct ScriptContext *ctx)
|
|||
u8 *str;
|
||||
const u8 *message;
|
||||
bool32 haveBerry = IsEnigmaBerryValid();
|
||||
u8 *berry = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
StringCopyN(gStringVar1, gSaveBlock1.enigmaBerry.berry.name, 7);
|
||||
u8 *berry = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
StringCopyN(gStringVar1, gSaveBlock1.enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1);
|
||||
SetEnigmaBerry(berry);
|
||||
StringCopyN(gStringVar2, gSaveBlock1.enigmaBerry.berry.name, 7);
|
||||
StringCopyN(gStringVar2, gSaveBlock1.enigmaBerry.berry.name, BERRY_NAME_LENGTH + 1);
|
||||
|
||||
if (!haveBerry)
|
||||
{
|
||||
str = gStringVar4;
|
||||
message = gOtherText_BerryObtainedDadHasIt;
|
||||
message = gText_MysteryEventBerry;
|
||||
}
|
||||
else if (StringCompare(gStringVar1, gStringVar2))
|
||||
{
|
||||
str = gStringVar4;
|
||||
message = gOtherText_BerryTransformed;
|
||||
message = gText_MysteryEventBerryTransform;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = gStringVar4;
|
||||
message = gOtherText_BerryAlreadyObtained;
|
||||
message = gText_MysteryEventBerryObtained;
|
||||
}
|
||||
|
||||
StringExpandPlaceholders(str, message);
|
||||
|
||||
ctx->data[2] = 2;
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
|
||||
if (IsEnigmaBerryValid() == TRUE)
|
||||
VarSet(VAR_ENIGMA_BERRY_AVAILABLE, 1);
|
||||
else
|
||||
ctx->data[2] = 1;
|
||||
ctx->mStatus = MEVENT_STATUS_LOAD_ERROR;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -321,8 +321,8 @@ bool8 MEScrCmd_giveribbon(struct ScriptContext *ctx)
|
|||
u8 index = ScriptReadByte(ctx);
|
||||
u8 ribbonId = ScriptReadByte(ctx);
|
||||
GiveGiftRibbonToParty(index, ribbonId);
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_SpecialRibbonReceived);
|
||||
ctx->data[2] = 2;
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventSpecialRibbon);
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -331,8 +331,8 @@ bool8 MEScrCmd_initramscript(struct ScriptContext *ctx)
|
|||
u8 mapGroup = ScriptReadByte(ctx);
|
||||
u8 mapNum = ScriptReadByte(ctx);
|
||||
u8 objectId = ScriptReadByte(ctx);
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *scriptEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *script = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
u8 *scriptEnd = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
InitRamScript(script, scriptEnd - script, mapGroup, mapNum, objectId);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -340,16 +340,16 @@ bool8 MEScrCmd_initramscript(struct ScriptContext *ctx)
|
|||
bool8 MEScrCmd_givenationaldex(struct ScriptContext *ctx)
|
||||
{
|
||||
EnableNationalPokedex();
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_DexUpgraded);
|
||||
ctx->data[2] = 2;
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventNationalDex);
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_addrareword(struct ScriptContext *ctx)
|
||||
{
|
||||
sub_80EB890(ScriptReadByte(ctx));
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_RareWordAdded);
|
||||
ctx->data[2] = 2;
|
||||
UnlockTrendySaying(ScriptReadByte(ctx));
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventRareWord);
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||
struct Pokemon pokemon;
|
||||
u16 species;
|
||||
u16 heldItem;
|
||||
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
|
||||
u32 data = ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase;
|
||||
void *pokemonPtr = (void *)data;
|
||||
void *mailPtr = (void *)(data + sizeof(struct Pokemon));
|
||||
|
||||
|
|
@ -376,34 +376,34 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||
species = GetMonData(&pokemon, MON_DATA_SPECIES2);
|
||||
|
||||
if (species == SPECIES_EGG)
|
||||
StringCopyN(gStringVar1, gSystemText_Egg, 11);
|
||||
StringCopyN(gStringVar1, gText_EggNickname, POKEMON_NAME_LENGTH + 1);
|
||||
else
|
||||
StringCopyN(gStringVar1, gSystemText_Pokemon2, 11);
|
||||
StringCopyN(gStringVar1, gText_Pokemon, POKEMON_NAME_LENGTH + 1);
|
||||
|
||||
if (gPlayerPartyCount == 6)
|
||||
if (gPlayerPartyCount == PARTY_SIZE)
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_PartyIsFull);
|
||||
ctx->data[2] = 3;
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventFullParty);
|
||||
ctx->mStatus = MEVENT_STATUS_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&gPlayerParty[5], pokemonPtr, sizeof(struct Pokemon));
|
||||
memcpy(&gPlayerParty[PARTY_SIZE - 1], pokemonPtr, sizeof(struct Pokemon));
|
||||
memcpy(&mail, mailPtr, sizeof(struct MailStruct));
|
||||
|
||||
if (species != SPECIES_EGG)
|
||||
{
|
||||
u16 pokedexNum = SpeciesToNationalPokedexNum(species);
|
||||
GetSetPokedexFlag(pokedexNum, 2);
|
||||
GetSetPokedexFlag(pokedexNum, 3);
|
||||
GetSetPokedexFlag(pokedexNum, FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(pokedexNum, FLAG_SET_CAUGHT);
|
||||
}
|
||||
|
||||
heldItem = GetMonData(&gPlayerParty[5], MON_DATA_HELD_ITEM);
|
||||
heldItem = GetMonData(&gPlayerParty[PARTY_SIZE - 1], MON_DATA_HELD_ITEM);
|
||||
if (ItemIsMail(heldItem))
|
||||
GiveMailToMon2(&gPlayerParty[5], &mail);
|
||||
party_compaction();
|
||||
GiveMailToMon2(&gPlayerParty[PARTY_SIZE - 1], &mail);
|
||||
CompactPartySlots();
|
||||
CalculatePlayerPartyCount();
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_PokeWasSentOver);
|
||||
ctx->data[2] = 2;
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventSentOver);
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
@ -411,31 +411,31 @@ bool8 MEScrCmd_givepokemon(struct ScriptContext *ctx)
|
|||
|
||||
bool8 MEScrCmd_addtrainer(struct ScriptContext *ctx)
|
||||
{
|
||||
u32 data = ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0];
|
||||
u32 data = ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase;
|
||||
memcpy(&gSaveBlock2.battleTower.ereaderTrainer, (void *)data, sizeof(gSaveBlock2.battleTower.ereaderTrainer));
|
||||
ValidateEReaderTrainer();
|
||||
StringExpandPlaceholders(gStringVar4, gOtherText_NewTrainerInHoenn);
|
||||
ctx->data[2] = 2;
|
||||
StringExpandPlaceholders(gStringVar4, gText_MysteryEventNewTrainer);
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_enableresetrtc(struct ScriptContext *ctx)
|
||||
{
|
||||
EnableResetRTC();
|
||||
StringExpandPlaceholders(gStringVar4, gSystemText_ClockAdjustmentUsable);
|
||||
ctx->data[2] = 2;
|
||||
StringExpandPlaceholders(gStringVar4, gText_InGameClockUsable);
|
||||
ctx->mStatus = MEVENT_STATUS_SUCCESS;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MEScrCmd_checksum(struct ScriptContext *ctx)
|
||||
{
|
||||
int checksum = ScriptReadWord(ctx);
|
||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
if (checksum != CalcChecksum(data, dataEnd - data))
|
||||
{
|
||||
ctx->data[3] = 0;
|
||||
ctx->data[2] = 1;
|
||||
ctx->mValid = FALSE;
|
||||
ctx->mStatus = MEVENT_STATUS_LOAD_ERROR;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -443,12 +443,12 @@ bool8 MEScrCmd_checksum(struct ScriptContext *ctx)
|
|||
bool8 MEScrCmd_crc(struct ScriptContext *ctx)
|
||||
{
|
||||
int crc = ScriptReadWord(ctx);
|
||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->data[1] + ctx->data[0]);
|
||||
u8 *data = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
u8 *dataEnd = (u8 *)(ScriptReadWord(ctx) - ctx->mOffset + ctx->mScriptBase);
|
||||
if (crc != CalcCRC16(data, dataEnd - data))
|
||||
{
|
||||
ctx->data[3] = 0;
|
||||
ctx->data[2] = 1;
|
||||
ctx->mValid = FALSE;
|
||||
ctx->mStatus = MEVENT_STATUS_LOAD_ERROR;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ void NewGameInitData(void)
|
|||
ResetFanClub();
|
||||
ResetLotteryCorner();
|
||||
WarpToTruck();
|
||||
ScriptContext2_RunNewScript(EventScript_ResetAllMapFlags);
|
||||
RunScriptImmediately(EventScript_ResetAllMapFlags);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static void (*const gUnknown_082166D8[])(struct LinkPlayerObjectEvent *, struct
|
|||
|
||||
static void DoWhiteOut(void)
|
||||
{
|
||||
ScriptContext2_RunNewScript(EventScript_WhiteOut);
|
||||
RunScriptImmediately(EventScript_WhiteOut);
|
||||
gSaveBlock1.money /= 2;
|
||||
ScrSpecial_HealPlayerParty();
|
||||
Overworld_ResetStateAfterWhiteOut();
|
||||
|
|
@ -234,7 +234,7 @@ void Overworld_ResetStateAfterTeleport(void)
|
|||
FlagClear(FLAG_SYS_SAFARI_MODE);
|
||||
FlagClear(FLAG_SYS_USE_STRENGTH);
|
||||
FlagClear(FLAG_SYS_USE_FLASH);
|
||||
ScriptContext2_RunNewScript(EventScript_ResetMrBriney);
|
||||
RunScriptImmediately(EventScript_ResetMrBriney);
|
||||
}
|
||||
|
||||
void Overworld_ResetStateAfterDigEscRope(void)
|
||||
|
|
@ -1202,11 +1202,11 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys)
|
|||
sub_8059204();
|
||||
ClearPlayerFieldInput(&fieldInput);
|
||||
GetPlayerFieldInput(&fieldInput, newKeys, heldKeys);
|
||||
if (!ScriptContext2_IsEnabled())
|
||||
if (!ArePlayerFieldControlsLocked())
|
||||
{
|
||||
if (ProcessPlayerFieldInput(&fieldInput) == 1)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
HideMapNamePopup();
|
||||
}
|
||||
else
|
||||
|
|
@ -1224,7 +1224,7 @@ static void CB1_Overworld(void)
|
|||
|
||||
static void OverworldBasic(void)
|
||||
{
|
||||
ScriptContext2_RunScript();
|
||||
ScriptContext_RunScript();
|
||||
RunTasks();
|
||||
AnimateSprites();
|
||||
CameraUpdate();
|
||||
|
|
@ -1277,8 +1277,8 @@ void CB2_NewGame(void)
|
|||
NewGameInitData();
|
||||
ResetInitialPlayerAvatarState();
|
||||
PlayTimeCounter_Start();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
gFieldCallback = ExecuteTruckSequence;
|
||||
do_load_map_stuff_loop(&gMain.state);
|
||||
SetFieldVBlankCallback();
|
||||
|
|
@ -1295,8 +1295,8 @@ void debug_sub_8058C00(void)
|
|||
ResetSafariZoneFlag_();
|
||||
ResetInitialPlayerAvatarState();
|
||||
PlayTimeCounter_Start();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
|
||||
if (JOY_HELD(R_BUTTON))
|
||||
gFieldCallback = ExecuteTruckSequence;
|
||||
|
|
@ -1322,8 +1322,8 @@ void CB2_WhiteOut(void)
|
|||
ResetSafariZoneFlag_();
|
||||
DoWhiteOut();
|
||||
ResetInitialPlayerAvatarState();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
gFieldCallback = sub_8080B60;
|
||||
val = 0;
|
||||
do_load_map_stuff_loop(&val);
|
||||
|
|
@ -1336,8 +1336,8 @@ void CB2_WhiteOut(void)
|
|||
void CB2_LoadMap(void)
|
||||
{
|
||||
FieldClearVBlankHBlankCallbacks();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
SetMainCallback1(NULL);
|
||||
SetMainCallback2(sub_810CC80);
|
||||
gMain.savedCallback = CB2_LoadMap2;
|
||||
|
|
@ -1356,8 +1356,8 @@ void sub_8054534(void)
|
|||
if (!gMain.state)
|
||||
{
|
||||
FieldClearVBlankHBlankCallbacks();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
SetMainCallback1(NULL);
|
||||
}
|
||||
if (sub_805493C(&gMain.state, 1))
|
||||
|
|
@ -1422,8 +1422,8 @@ void sub_805465C(void)
|
|||
SetMainCallback1(sub_8055354);
|
||||
sub_80543DC(sub_8055390);
|
||||
gFieldCallback = sub_8080A3C;
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
CB2_ReturnToField();
|
||||
}
|
||||
|
||||
|
|
@ -1478,8 +1478,8 @@ void CB2_ContinueSavedGame(void)
|
|||
sub_805308C();
|
||||
InitMapFromSavedGame();
|
||||
PlayTimeCounter_Start();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
if (GetSecretBase2Field_9() == 1)
|
||||
{
|
||||
ClearSecretBase2Field_9();
|
||||
|
|
@ -1537,8 +1537,8 @@ static bool32 sub_805483C(u8 *state)
|
|||
{
|
||||
case 0:
|
||||
FieldClearVBlankHBlankCallbacks();
|
||||
ScriptContext1_Init();
|
||||
ScriptContext2_Disable();
|
||||
ScriptContext_Init();
|
||||
UnlockPlayerFieldControls();
|
||||
sub_8054F70();
|
||||
sub_8054BA8();
|
||||
(*state)++;
|
||||
|
|
@ -2139,7 +2139,7 @@ void sub_8055354(void)
|
|||
|
||||
u16 sub_8055390(u32 a1)
|
||||
{
|
||||
if (ScriptContext2_IsEnabled() == 1)
|
||||
if (ArePlayerFieldControlsLocked() == 1)
|
||||
return 17;
|
||||
if (gLink.recvQueue.count > 4)
|
||||
return 27;
|
||||
|
|
@ -2156,7 +2156,7 @@ u16 sub_80553E0(u32 a1)
|
|||
u16 sub_80553E4(u32 a1)
|
||||
{
|
||||
u16 retVal;
|
||||
if (ScriptContext2_IsEnabled() == 1)
|
||||
if (ArePlayerFieldControlsLocked() == 1)
|
||||
{
|
||||
retVal = 17;
|
||||
}
|
||||
|
|
@ -2178,7 +2178,7 @@ u16 sub_8055408(u32 a1)
|
|||
else
|
||||
{
|
||||
retVal = 26;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
sub_80543DC(sub_80553E0);
|
||||
}
|
||||
return retVal;
|
||||
|
|
@ -2194,7 +2194,7 @@ u16 sub_8055438(u32 a1)
|
|||
else
|
||||
{
|
||||
retVal = 26;
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
sub_80543DC(sub_80553E0);
|
||||
}
|
||||
return retVal;
|
||||
|
|
@ -2233,7 +2233,7 @@ u16 sub_80554BC(u32 a1)
|
|||
{
|
||||
if (sub_8054F88(0x83) == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(gUnknown_081A4508);
|
||||
ScriptContext_SetupScript(gUnknown_081A4508);
|
||||
sub_80543DC(sub_80554B8);
|
||||
}
|
||||
return 17;
|
||||
|
|
@ -2390,41 +2390,41 @@ static u16 sub_8055758(const u8 *script)
|
|||
|
||||
void sub_80557E8(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_80557F4(void)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
sub_8071310();
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void sub_8055808(const u8 *script)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(script);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_8055824(void)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
ScriptContext1_SetupScript(TradeRoom_PromptToCancelLink);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(TradeRoom_PromptToCancelLink);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static void sub_8055840(const u8 *script)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ScriptContext1_SetupScript(script);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(script);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void sub_805585C(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(TradeRoom_TerminateLink);
|
||||
ScriptContext2_Enable();
|
||||
ScriptContext_SetupScript(TradeRoom_TerminateLink);
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
bool32 sub_8055870(void)
|
||||
|
|
|
|||
|
|
@ -291,14 +291,14 @@ static void PlayerPC_TurnOff(u8 taskId)
|
|||
Menu_EraseWindowRect(0, 0, 0x1D, 0x13);
|
||||
|
||||
if (gSaveBlock2.playerGender == MALE)
|
||||
ScriptContext1_SetupScript(gBrendanHouse_TurnPCOff);
|
||||
ScriptContext_SetupScript(gBrendanHouse_TurnPCOff);
|
||||
else
|
||||
ScriptContext1_SetupScript(gMayHouse_TurnPCOff);
|
||||
ScriptContext_SetupScript(gMayHouse_TurnPCOff);
|
||||
}
|
||||
else
|
||||
{
|
||||
Menu_EraseWindowRect(0, 0, 10, 9);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -926,7 +926,7 @@ void debug_sub_80986AC(void)
|
|||
&& IsPlayerSurfingNorth() == TRUE)
|
||||
sub_808AE08();
|
||||
else
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -284,8 +284,8 @@ void Task_PokemonStorageSystem(u8 taskId)
|
|||
case 3:
|
||||
Menu_DestroyCursor();
|
||||
Menu_EraseWindowRect(0, 0, 13, 9);
|
||||
ScriptContext2_Disable();
|
||||
EnableBothScriptContexts();
|
||||
UnlockPlayerFieldControls();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -352,7 +352,7 @@ void ShowPokemonStorageSystem(void)
|
|||
u8 taskId = CreateTask(Task_PokemonStorageSystem, 80);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void FieldCB_ReturnToOverworld(void)
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ void sub_809746C(void)
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
sub_8099310();
|
||||
gPokemonStorageSystemPtr->unk_0004++;
|
||||
break;
|
||||
|
|
@ -1011,7 +1011,7 @@ void sub_8097594(void)
|
|||
sub_8098A5C();
|
||||
if (gUnknown_0203847C)
|
||||
{
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
sub_8099310();
|
||||
gPokemonStorageSystemPtr->unk_0004++;
|
||||
}
|
||||
|
|
@ -1125,7 +1125,7 @@ void sub_8097858(void)
|
|||
switch (gPokemonStorageSystemPtr->unk_0004)
|
||||
{
|
||||
case 0:
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
sub_8099310();
|
||||
gPokemonStorageSystemPtr->unk_0004++;
|
||||
break;
|
||||
|
|
@ -1703,7 +1703,7 @@ bool8 sub_80985CC(void)
|
|||
{
|
||||
gUnknown_0203847C = 0;
|
||||
sub_809954C();
|
||||
party_compaction();
|
||||
CompactPartySlots();
|
||||
sub_809D034(BG_SCREEN_ADDR(15), 21, 0, gPokemonStorageSystemPtr->unk_00a8, 12, 0, 1, 2);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ void sub_8099200(bool8 a0)
|
|||
{
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
// this routine assumes party_compaction has been called
|
||||
// this routine assumes CompactPartySlots has been called
|
||||
gPokemonStorageSystemPtr->unk_1038[i]->y -= 0xa0;
|
||||
gPokemonStorageSystemPtr->unk_1038[i]->invisible = TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,7 @@ void sub_809BD14(void)
|
|||
sBoxCursorPosition = pssData.monIndex;
|
||||
}
|
||||
|
||||
s16 party_compaction(void)
|
||||
s16 CompactPartySlots(void)
|
||||
{
|
||||
s16 retVal = -1;
|
||||
u16 i;
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void Task_RecordMixing_Main(u8 taskId)
|
|||
sub_8055588();
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ void debug_sub_806F908(u8 taskId)
|
|||
RtcCalcLocalTimeOffset(gLocalTime.days, gLocalTime.hours, gLocalTime.minutes, gLocalTime.seconds);
|
||||
DestroyTask(data[1]);
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
@ -625,14 +625,14 @@ void debug_sub_806F99C(void)
|
|||
{
|
||||
RtcCalcLocalTime();
|
||||
CreateTask(debug_sub_806F908, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void debug_sub_806F9B8(void)
|
||||
{
|
||||
gLocalTime = gSaveBlock2.lastBerryTreeUpdate;
|
||||
CreateTask(debug_sub_806F908, 80);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static const u8 sDebugText_Days[] = DTR("にっすう", "days");
|
||||
|
|
@ -683,7 +683,7 @@ void debug_sub_806F9E4(u8 taskId)
|
|||
{
|
||||
Menu_EraseScreen();
|
||||
DestroyTask(taskId);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void task08_080C9820(u8 taskId)
|
|||
{
|
||||
u8 objEventId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objEventId = gPlayerAvatar.objectEventId;
|
||||
if (!ObjectEventIsMovementOverridden(&gObjectEvents[objEventId])
|
||||
|
|
@ -130,7 +130,7 @@ void debug_sub_8120968(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -152,7 +152,7 @@ bool8 SetUpFieldMove_RockSmash(void)
|
|||
static void sub_810B53C(void)
|
||||
{
|
||||
gFieldEffectArguments[0] = gLastFieldPokeMenuOpened;
|
||||
ScriptContext1_SetupScript(S_UseRockSmash);
|
||||
ScriptContext_SetupScript(S_UseRockSmash);
|
||||
}
|
||||
|
||||
int FldEff_RockSmash(void)
|
||||
|
|
@ -169,7 +169,7 @@ static void sub_810B58C(void)
|
|||
{
|
||||
PlaySE(SE_M_ROCK_THROW);
|
||||
FieldEffectActiveListRemove(FLDEFF_USE_ROCK_SMASH);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
int SetUpFieldMove_Dig(void)
|
||||
|
|
|
|||
|
|
@ -1598,7 +1598,7 @@ void sub_81175C0(u8 taskid)
|
|||
unk_203955C[0] = 0;
|
||||
#endif
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskid);
|
||||
}
|
||||
|
||||
|
|
@ -1609,7 +1609,7 @@ void sub_81175DC(u8 taskid)
|
|||
return;
|
||||
gSpecialVar_0x8004 = 1;
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskid);
|
||||
}
|
||||
|
||||
|
|
@ -1783,7 +1783,7 @@ void PlayRoulette(void)
|
|||
{
|
||||
u8 taskid;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
#if DEBUG
|
||||
unk_2039560 = 0;
|
||||
if (unk_203955C[0] != 0)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ bool8 SafariZoneTakeStep(void)
|
|||
gSafariZoneStepCounter--;
|
||||
if (gSafariZoneStepCounter == 0)
|
||||
{
|
||||
ScriptContext1_SetupScript(&gUnknown_081C3448);
|
||||
ScriptContext_SetupScript(&gUnknown_081C3448);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -90,7 +90,7 @@ bool8 SafariZoneTakeStep(void)
|
|||
|
||||
void SafariZoneRetirePrompt(void)
|
||||
{
|
||||
ScriptContext1_SetupScript(&gUnknown_081C342D);
|
||||
ScriptContext_SetupScript(&gUnknown_081C342D);
|
||||
}
|
||||
|
||||
void sub_80C824C(void)
|
||||
|
|
@ -101,15 +101,15 @@ void sub_80C824C(void)
|
|||
}
|
||||
else if (gBattleOutcome == 8)
|
||||
{
|
||||
ScriptContext2_RunNewScript(&gUnknown_081C340A);
|
||||
RunScriptImmediately(&gUnknown_081C340A);
|
||||
WarpIntoMap();
|
||||
gFieldCallback = sub_8080E44;
|
||||
SetMainCallback2(CB2_LoadMap);
|
||||
}
|
||||
else if (gBattleOutcome == 7)
|
||||
{
|
||||
ScriptContext1_SetupScript(&gUnknown_081C3459);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_SetupScript(&gUnknown_081C3459);
|
||||
ScriptContext_Stop();
|
||||
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
src/scrcmd.c
40
src/scrcmd.c
|
|
@ -48,7 +48,7 @@
|
|||
typedef u16 (*SpecialFunc)(void);
|
||||
typedef void (*NativeFunc)(void);
|
||||
|
||||
extern u32 gUnknown_0202E8AC;
|
||||
extern u32 gRamScriptRetAddr;
|
||||
|
||||
static EWRAM_DATA u32 gUnknown_0202E8B0 = 0;
|
||||
static EWRAM_DATA u16 sPauseCounter = 0;
|
||||
|
|
@ -142,7 +142,7 @@ bool8 ScrCmd_callnative(struct ScriptContext *ctx)
|
|||
|
||||
bool8 ScrCmd_waitstate(struct ScriptContext *ctx)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ bool8 ScrCmd_callstd_if(struct ScriptContext *ctx)
|
|||
|
||||
bool8 ScrCmd_gotoram(struct ScriptContext *ctx)
|
||||
{
|
||||
ScriptJump(ctx, (u8 *)gUnknown_0202E8AC);
|
||||
ScriptJump(ctx, (u8 *)gRamScriptRetAddr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -605,7 +605,7 @@ bool8 ScrCmd_incrementgamestat(struct ScriptContext *ctx)
|
|||
bool8 ScrCmd_animateflash(struct ScriptContext *ctx)
|
||||
{
|
||||
sub_8081594(ScriptReadByte(ctx));
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1281,7 +1281,7 @@ bool8 ScrCmd_yesnobox(struct ScriptContext *ctx)
|
|||
|
||||
if (ScriptMenu_YesNo(left, top) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1299,7 +1299,7 @@ bool8 ScrCmd_multichoice(struct ScriptContext *ctx)
|
|||
|
||||
if (ScriptMenu_Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1318,7 +1318,7 @@ bool8 ScrCmd_multichoicedefault(struct ScriptContext *ctx)
|
|||
|
||||
if (ScriptMenu_MultichoiceWithDefault(left, top, multichoiceId, ignoreBPress, defaultChoice) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1348,7 +1348,7 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext *ctx)
|
|||
|
||||
if (ScriptMenu_MultichoiceGrid(left, top, multichoiceId, ignoreBPress, numColumns) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1378,7 +1378,7 @@ bool8 ScrCmd_drawboxtext(struct ScriptContext *ctx)
|
|||
|
||||
if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
||||
{
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1414,7 +1414,7 @@ bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
|
|||
if (v1)
|
||||
SetContestWinnerForPainting(v1);
|
||||
ShowContestWinner();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1748,7 +1748,7 @@ bool8 ScrCmd_setwildbattle(struct ScriptContext *ctx)
|
|||
bool8 ScrCmd_dowildbattle(struct ScriptContext *ctx)
|
||||
{
|
||||
BattleSetup_StartScriptedWildBattle();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1757,7 +1757,7 @@ bool8 ScrCmd_pokemart(struct ScriptContext *ctx)
|
|||
void *ptr = (void *)ScriptReadWord(ctx);
|
||||
|
||||
Shop_CreatePokemartMenu(ptr);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1766,7 +1766,7 @@ bool8 ScrCmd_pokemartdecoration(struct ScriptContext *ctx)
|
|||
void *ptr = (void *)ScriptReadWord(ctx);
|
||||
|
||||
Shop_CreateDecorationShop1Menu(ptr);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1775,7 +1775,7 @@ bool8 ScrCmd_pokemartdecoration2(struct ScriptContext *ctx)
|
|||
void *ptr = (void *)ScriptReadWord(ctx);
|
||||
|
||||
Shop_CreateDecorationShop2Menu(ptr);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1784,7 +1784,7 @@ bool8 ScrCmd_playslotmachine(struct ScriptContext *ctx)
|
|||
u8 v2 = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
PlaySlotMachine(v2, CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1812,28 +1812,28 @@ bool8 ScrCmd_getpricereduction(struct ScriptContext *ctx)
|
|||
bool8 ScrCmd_choosecontestmon(struct ScriptContext *ctx)
|
||||
{
|
||||
sub_80F99CC();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_startcontest(struct ScriptContext *ctx)
|
||||
{
|
||||
sub_80C48C8();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx)
|
||||
{
|
||||
sub_80C4940();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx)
|
||||
{
|
||||
ContestLinkTransfer(gSpecialVar_ContestCategory);
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1987,7 +1987,7 @@ bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx)
|
|||
bool8 ScrCmd_showelevmenu(struct ScriptContext *ctx)
|
||||
{
|
||||
ScriptShowElevatorMenu();
|
||||
ScriptContext1_Stop();
|
||||
ScriptContext_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
202
src/script.c
202
src/script.c
|
|
@ -4,25 +4,29 @@
|
|||
#include "constants/map_scripts.h"
|
||||
|
||||
#define RAM_SCRIPT_MAGIC 51
|
||||
#define SCRIPT_STACK_SIZE 20
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
SCRIPT_MODE_STOPPED,
|
||||
SCRIPT_MODE_BYTECODE,
|
||||
SCRIPT_MODE_NATIVE,
|
||||
};
|
||||
|
||||
EWRAM_DATA const u8 *gUnknown_0202E8AC = NULL;
|
||||
enum {
|
||||
CONTEXT_RUNNING,
|
||||
CONTEXT_WAITING,
|
||||
CONTEXT_SHUTDOWN,
|
||||
};
|
||||
|
||||
static u8 sScriptContext1Status;
|
||||
static struct ScriptContext sScriptContext1;
|
||||
static struct ScriptContext sScriptContext2;
|
||||
static bool8 sScriptContext2Enabled;
|
||||
EWRAM_DATA const u8 *gRamScriptRetAddr = NULL;
|
||||
|
||||
static u8 sGlobalScriptContextStatus;
|
||||
static struct ScriptContext sGlobalScriptContext;
|
||||
static struct ScriptContext sImmediateScriptContext;
|
||||
static bool8 sLockFieldControls;
|
||||
|
||||
extern ScrCmdFunc gScriptCmdTable[];
|
||||
extern ScrCmdFunc gScriptCmdTableEnd[];
|
||||
extern void *gNullScriptPtr;
|
||||
extern void *const gNullScriptPtr;
|
||||
|
||||
void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTableEnd)
|
||||
{
|
||||
|
|
@ -35,11 +39,11 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTable
|
|||
ctx->cmdTable = cmdTable;
|
||||
ctx->cmdTableEnd = cmdTableEnd;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < (int)ARRAY_COUNT(ctx->data); i++)
|
||||
ctx->data[i] = 0;
|
||||
|
||||
for (i = 0; i < SCRIPT_STACK_SIZE; i++)
|
||||
ctx->stack[i] = 0;
|
||||
for (i = 0; i < (int)ARRAY_COUNT(ctx->stack); i++)
|
||||
ctx->stack[i] = NULL;
|
||||
}
|
||||
|
||||
u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr)
|
||||
|
|
@ -71,6 +75,8 @@ bool8 RunScriptCommand(struct ScriptContext *ctx)
|
|||
case SCRIPT_MODE_STOPPED:
|
||||
return FALSE;
|
||||
case SCRIPT_MODE_NATIVE:
|
||||
// Try to call a function in C
|
||||
// Continue to bytecode if no function or it returns TRUE
|
||||
if (ctx->nativePtr)
|
||||
{
|
||||
if (ctx->nativePtr() == TRUE)
|
||||
|
|
@ -78,13 +84,14 @@ bool8 RunScriptCommand(struct ScriptContext *ctx)
|
|||
return TRUE;
|
||||
}
|
||||
ctx->mode = SCRIPT_MODE_BYTECODE;
|
||||
// fallthrough
|
||||
case SCRIPT_MODE_BYTECODE:
|
||||
while (1)
|
||||
{
|
||||
u8 cmdCode;
|
||||
ScrCmdFunc *cmdFunc;
|
||||
ScrCmdFunc *func;
|
||||
|
||||
if (ctx->scriptPtr == NULL)
|
||||
if (!ctx->scriptPtr)
|
||||
{
|
||||
ctx->mode = SCRIPT_MODE_STOPPED;
|
||||
return FALSE;
|
||||
|
|
@ -98,15 +105,15 @@ bool8 RunScriptCommand(struct ScriptContext *ctx)
|
|||
|
||||
cmdCode = *(ctx->scriptPtr);
|
||||
ctx->scriptPtr++;
|
||||
cmdFunc = &ctx->cmdTable[cmdCode];
|
||||
func = &ctx->cmdTable[cmdCode];
|
||||
|
||||
if (cmdFunc >= ctx->cmdTableEnd)
|
||||
if (func >= ctx->cmdTableEnd)
|
||||
{
|
||||
ctx->mode = SCRIPT_MODE_STOPPED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((*cmdFunc)(ctx) == TRUE)
|
||||
if ((*func)(ctx) == TRUE)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -114,21 +121,21 @@ bool8 RunScriptCommand(struct ScriptContext *ctx)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr)
|
||||
static bool8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr)
|
||||
{
|
||||
if (ctx->stackDepth + 1 >= SCRIPT_STACK_SIZE)
|
||||
if (ctx->stackDepth + 1 >= (int)ARRAY_COUNT(ctx->stack))
|
||||
{
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx->stack[ctx->stackDepth] = ptr;
|
||||
ctx->stackDepth++;
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
const u8 *ScriptPop(struct ScriptContext *ctx)
|
||||
static const u8 *ScriptPop(struct ScriptContext *ctx)
|
||||
{
|
||||
if (ctx->stackDepth == 0)
|
||||
return NULL;
|
||||
|
|
@ -137,12 +144,12 @@ const u8 *ScriptPop(struct ScriptContext *ctx)
|
|||
return ctx->stack[ctx->stackDepth];
|
||||
}
|
||||
|
||||
void ScriptJump(struct ScriptContext *ctx, u8 *ptr)
|
||||
void ScriptJump(struct ScriptContext *ctx, const u8 *ptr)
|
||||
{
|
||||
ctx->scriptPtr = ptr;
|
||||
}
|
||||
|
||||
void ScriptCall(struct ScriptContext *ctx, u8 *ptr)
|
||||
void ScriptCall(struct ScriptContext *ctx, const u8 *ptr)
|
||||
{
|
||||
ScriptPush(ctx, ctx->scriptPtr);
|
||||
ctx->scriptPtr = ptr;
|
||||
|
|
@ -169,89 +176,99 @@ u32 ScriptReadWord(struct ScriptContext *ctx)
|
|||
return (((((value3 << 8) + value2) << 8) + value1) << 8) + value0;
|
||||
}
|
||||
|
||||
void ScriptContext2_Enable(void)
|
||||
void LockPlayerFieldControls(void)
|
||||
{
|
||||
sScriptContext2Enabled = TRUE;
|
||||
sLockFieldControls = TRUE;
|
||||
}
|
||||
|
||||
void ScriptContext2_Disable(void)
|
||||
void UnlockPlayerFieldControls(void)
|
||||
{
|
||||
sScriptContext2Enabled = FALSE;
|
||||
sLockFieldControls = FALSE;
|
||||
}
|
||||
|
||||
bool8 ScriptContext2_IsEnabled(void)
|
||||
bool8 ArePlayerFieldControlsLocked(void)
|
||||
{
|
||||
return sScriptContext2Enabled;
|
||||
return sLockFieldControls;
|
||||
}
|
||||
|
||||
void ScriptContext1_Init(void)
|
||||
// Re-initializes the global script context to zero.
|
||||
void ScriptContext_Init(void)
|
||||
{
|
||||
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
sScriptContext1Status = 2;
|
||||
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
sGlobalScriptContextStatus = CONTEXT_SHUTDOWN;
|
||||
}
|
||||
|
||||
bool8 ScriptContext2_RunScript(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)
|
||||
{
|
||||
if (sScriptContext1Status == 2)
|
||||
return 0;
|
||||
if (sGlobalScriptContextStatus == CONTEXT_SHUTDOWN)
|
||||
return FALSE;
|
||||
|
||||
if (sScriptContext1Status == 1)
|
||||
return 0;
|
||||
if (sGlobalScriptContextStatus == CONTEXT_WAITING)
|
||||
return FALSE;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
|
||||
if (!RunScriptCommand(&sScriptContext1))
|
||||
if (!RunScriptCommand(&sGlobalScriptContext))
|
||||
{
|
||||
sScriptContext1Status = 2;
|
||||
ScriptContext2_Disable();
|
||||
return 0;
|
||||
sGlobalScriptContextStatus = CONTEXT_SHUTDOWN;
|
||||
UnlockPlayerFieldControls();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ScriptContext1_SetupScript(const u8 *ptr)
|
||||
// Sets up a new script in the global context and enables the context
|
||||
void ScriptContext_SetupScript(const u8 *ptr)
|
||||
{
|
||||
InitScriptContext(&sScriptContext1, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sScriptContext1, ptr);
|
||||
ScriptContext2_Enable();
|
||||
sScriptContext1Status = 0;
|
||||
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sGlobalScriptContext, ptr);
|
||||
LockPlayerFieldControls();
|
||||
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
||||
}
|
||||
|
||||
void ScriptContext1_Stop(void)
|
||||
// Puts the script into waiting mode; usually called from a wait* script command.
|
||||
void ScriptContext_Stop(void)
|
||||
{
|
||||
sScriptContext1Status = 1;
|
||||
sGlobalScriptContextStatus = CONTEXT_WAITING;
|
||||
}
|
||||
|
||||
void EnableBothScriptContexts()
|
||||
// Puts the script into running mode.
|
||||
void ScriptContext_Enable(void)
|
||||
{
|
||||
sScriptContext1Status = 0;
|
||||
ScriptContext2_Enable();
|
||||
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void ScriptContext2_RunNewScript(const u8 *ptr)
|
||||
// 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)
|
||||
{
|
||||
InitScriptContext(&sScriptContext2, &gScriptCmdTable, &gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sScriptContext2, ptr);
|
||||
while (RunScriptCommand(&sScriptContext2) == 1)
|
||||
;
|
||||
InitScriptContext(&sImmediateScriptContext, &gScriptCmdTable, &gScriptCmdTableEnd);
|
||||
SetupBytecodeScript(&sImmediateScriptContext, ptr);
|
||||
while (RunScriptCommand(&sImmediateScriptContext) == TRUE);
|
||||
}
|
||||
|
||||
static u8 *mapheader_get_tagged_pointer(u8 tag)
|
||||
static u8 *MapHeaderGetScriptTable(u8 tag)
|
||||
{
|
||||
const u8 *mapScripts = gMapHeader.mapScripts;
|
||||
|
||||
if (mapScripts == NULL)
|
||||
if (!mapScripts)
|
||||
return NULL;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (*mapScripts == 0)
|
||||
if (!*mapScripts)
|
||||
return NULL;
|
||||
if (*mapScripts == tag)
|
||||
{
|
||||
mapScripts++;
|
||||
return (u8 *)(mapScripts[0] + (mapScripts[1] << 8) + (mapScripts[2] << 16) + (mapScripts[3] << 24));
|
||||
return T2_READ_PTR(mapScripts);
|
||||
}
|
||||
mapScripts += 5;
|
||||
}
|
||||
|
|
@ -259,14 +276,14 @@ static u8 *mapheader_get_tagged_pointer(u8 tag)
|
|||
|
||||
static void MapHeaderRunScriptType(u8 tag)
|
||||
{
|
||||
u8 *ptr = mapheader_get_tagged_pointer(tag);
|
||||
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||
if (ptr)
|
||||
ScriptContext2_RunNewScript(ptr);
|
||||
RunScriptImmediately(ptr);
|
||||
}
|
||||
|
||||
static u8 *MapHeaderCheckScriptTable(u8 tag)
|
||||
{
|
||||
u8 *ptr = mapheader_get_tagged_pointer(tag);
|
||||
u8 *ptr = MapHeaderGetScriptTable(tag);
|
||||
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
|
@ -275,14 +292,20 @@ static u8 *MapHeaderCheckScriptTable(u8 tag)
|
|||
{
|
||||
u16 varIndex1;
|
||||
u16 varIndex2;
|
||||
varIndex1 = ptr[0] | (ptr[1] << 8);
|
||||
|
||||
// Read first var (or .2byte terminal value)
|
||||
varIndex1 = T1_READ_16(ptr);
|
||||
if (!varIndex1)
|
||||
return NULL;
|
||||
return NULL; // Reached end of table
|
||||
ptr += 2;
|
||||
varIndex2 = ptr[0] | (ptr[1] << 8);
|
||||
|
||||
// Read second var
|
||||
varIndex2 = T1_READ_16(ptr);
|
||||
ptr += 2;
|
||||
|
||||
// Run map script if vars are equal
|
||||
if (VarGet(varIndex1) == VarGet(varIndex2))
|
||||
return (u8 *)(ptr[0] + (ptr[1] << 8) + (ptr[2] << 16) + (ptr[3] << 24));
|
||||
return T2_READ_PTR(ptr);
|
||||
ptr += 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -312,17 +335,17 @@ bool8 TryRunOnFrameMapScript(void)
|
|||
u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_FRAME_TABLE);
|
||||
|
||||
if (!ptr)
|
||||
return 0;
|
||||
return FALSE;
|
||||
|
||||
ScriptContext1_SetupScript(ptr);
|
||||
return 1;
|
||||
ScriptContext_SetupScript(ptr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TryRunOnWarpIntoMapScript(void)
|
||||
{
|
||||
u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE);
|
||||
if (ptr)
|
||||
ScriptContext2_RunNewScript(ptr);
|
||||
RunScriptImmediately(ptr);
|
||||
}
|
||||
|
||||
static u32 CalculateRamScriptChecksum(void)
|
||||
|
|
@ -339,7 +362,7 @@ void ClearRamScript(void)
|
|||
CpuFill32(0, &gSaveBlock1.ramScript, sizeof(struct RamScript));
|
||||
}
|
||||
|
||||
bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId)
|
||||
bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 localId)
|
||||
{
|
||||
struct RamScriptData *scriptData = &gSaveBlock1.ramScript.data;
|
||||
|
||||
|
|
@ -351,27 +374,30 @@ bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objec
|
|||
scriptData->magic = RAM_SCRIPT_MAGIC;
|
||||
scriptData->mapGroup = mapGroup;
|
||||
scriptData->mapNum = mapNum;
|
||||
scriptData->objectId = objectId;
|
||||
scriptData->localId = localId;
|
||||
memcpy(scriptData->script, script, scriptSize);
|
||||
gSaveBlock1.ramScript.checksum = CalculateRamScriptChecksum();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const u8 *GetRamScript(u8 objectId, const u8 *script)
|
||||
const u8 *GetRamScript(u8 localId, const u8 *script)
|
||||
{
|
||||
struct RamScriptData *scriptData = &gSaveBlock1.ramScript.data;
|
||||
gUnknown_0202E8AC = 0;
|
||||
if (scriptData->magic == RAM_SCRIPT_MAGIC
|
||||
&& scriptData->mapGroup == gSaveBlock1.location.mapGroup
|
||||
&& scriptData->mapNum == gSaveBlock1.location.mapNum
|
||||
&& scriptData->objectId == objectId)
|
||||
gRamScriptRetAddr = NULL;
|
||||
if (scriptData->magic != RAM_SCRIPT_MAGIC)
|
||||
return script;
|
||||
if (scriptData->mapGroup != gSaveBlock1.location.mapGroup)
|
||||
return script;
|
||||
if (scriptData->mapNum != gSaveBlock1.location.mapNum)
|
||||
return script;
|
||||
if (scriptData->localId != localId)
|
||||
return script;
|
||||
if (CalculateRamScriptChecksum() != gSaveBlock1.ramScript.checksum)
|
||||
{
|
||||
if (CalculateRamScriptChecksum() == gSaveBlock1.ramScript.checksum)
|
||||
{
|
||||
gUnknown_0202E8AC = script;
|
||||
return scriptData->script;
|
||||
}
|
||||
ClearRamScript();
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
gRamScriptRetAddr = script;
|
||||
return scriptData->script;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@ static void Task_HandleMultichoiceInput(u8 taskId)
|
|||
Menu_DestroyCursor();
|
||||
Menu_EraseWindowRect(gTasks[taskId].tLeft, gTasks[taskId].tTop, gTasks[taskId].tRight, gTasks[taskId].tBottom);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -808,7 +808,7 @@ static void Task_HandleYesNoInput(u8 taskId)
|
|||
|
||||
Menu_EraseWindowRect(left, top, left + 6, top + 5);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 columnCount)
|
||||
|
|
@ -870,7 +870,7 @@ static void Task_HandleMultichoiceGridInput(u8 taskId)
|
|||
Menu_DestroyCursor();
|
||||
Menu_EraseWindowRect(gTasks[taskId].tLeft, gTasks[taskId].tTop, gTasks[taskId].tRight, gTasks[taskId].tBottom);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void sub_80F99CC(void)
|
|||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
taskId = CreateTask((void *)OpenPartyMenuFromScriptContext, 0xA);
|
||||
gTasks[taskId].data[0] = PARTY_MENU_TYPE_CONTEST;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
|
|
@ -43,7 +43,7 @@ void SelectMonForNPCTrade(void)
|
|||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
taskId = CreateTask((void *)OpenPartyMenuFromScriptContext, 0xA);
|
||||
gTasks[taskId].data[0] = PARTY_MENU_TYPE_IN_GAME_TRADE;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
|
|
@ -53,7 +53,7 @@ void SelectMoveTutorMon(void)
|
|||
{
|
||||
u8 taskId;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
taskId = CreateTask((void *)OpenPartyMenuFromScriptContext, 0xA);
|
||||
gTasks[taskId].data[0] = PARTY_MENU_TYPE_MOVE_TUTOR;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ void sub_80BBB50(u8 taskid)
|
|||
ObjectEventTurn(&(gObjectEvents[gPlayerAvatar.objectEventId]), 2);
|
||||
if (IsWeatherNotFadingIn() == 1)
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskid);
|
||||
}
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ void sub_80BBB90(void)
|
|||
{
|
||||
s16 x, y;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
HideMapNamePopup();
|
||||
sub_80BB764(&x, &y, 0x220);
|
||||
MapGridSetMetatileIdAt(x + 7, y + 7, 0xe20);
|
||||
|
|
@ -565,7 +565,7 @@ void sub_80BC038(struct MapPosition *position, const struct MapEvents *events)
|
|||
{
|
||||
SetCurrentSecretBaseFromPosition(position, events);
|
||||
SetCurrentSecretBaseVar();
|
||||
ScriptContext1_SetupScript(gUnknown_081A2E14);
|
||||
ScriptContext_SetupScript(gUnknown_081A2E14);
|
||||
}
|
||||
|
||||
bool8 sub_80BC050(void)
|
||||
|
|
@ -582,7 +582,7 @@ void sub_80BC074(u8 taskid)
|
|||
switch (gTasks[taskid].data[0])
|
||||
{
|
||||
case 0:
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gTasks[taskid].data[0] = 1;
|
||||
break;
|
||||
case 1:
|
||||
|
|
@ -594,7 +594,7 @@ void sub_80BC074(u8 taskid)
|
|||
WarpIntoMap();
|
||||
gFieldCallback = mapldr_default;
|
||||
SetMainCallback2(CB2_LoadMap);
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskid);
|
||||
break;
|
||||
}
|
||||
|
|
@ -808,7 +808,7 @@ void Task_SecretBasePC_Registry(u8 taskId)
|
|||
{
|
||||
s16 *taskData;
|
||||
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
ClearVerticalScrollIndicatorPalettes();
|
||||
LoadScrollIndicatorPalette();
|
||||
|
||||
|
|
@ -1093,9 +1093,9 @@ void sub_80BCC54(u8 taskId)
|
|||
DestroyVerticalScrollIndicator(BOTTOM_ARROW);
|
||||
|
||||
if (curBaseIndex == 0)
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_PCCancel);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_PCCancel);
|
||||
else
|
||||
ScriptContext1_SetupScript(SecretBase_EventScript_ShowRegisterMenu);
|
||||
ScriptContext_SetupScript(SecretBase_EventScript_ShowRegisterMenu);
|
||||
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
|
|
|||
10
src/shop.c
10
src/shop.c
|
|
@ -89,7 +89,7 @@ static const struct YesNoFuncTable sShopPurchaseYesNoFuncs[] =
|
|||
|
||||
static u8 CreateShopMenu(u8 martType)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
gMartInfo.martType = martType;
|
||||
gMartInfo.cursor = 0;
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ static void Task_HandleShopMenuQuit(u8 taskId)
|
|||
Menu_DestroyCursor();
|
||||
Menu_EraseWindowRect(0, 0, 11, 8);
|
||||
sub_80BE3BC();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
|
||||
if (gMartInfo.callback)
|
||||
|
|
@ -1203,21 +1203,21 @@ void Shop_CreatePokemartMenu(u16 *itemList)
|
|||
CreateShopMenu(MART_TYPE_0);
|
||||
SetShopItemsForSale(itemList);
|
||||
ClearItemPurchases();
|
||||
SetShopMenuCallback(EnableBothScriptContexts);
|
||||
SetShopMenuCallback(ScriptContext_Enable);
|
||||
}
|
||||
|
||||
void Shop_CreateDecorationShop1Menu(u16 *itemList)
|
||||
{
|
||||
CreateShopMenu(MART_TYPE_1);
|
||||
SetShopItemsForSale(itemList);
|
||||
SetShopMenuCallback(EnableBothScriptContexts);
|
||||
SetShopMenuCallback(ScriptContext_Enable);
|
||||
}
|
||||
|
||||
void Shop_CreateDecorationShop2Menu(u16 *itemList)
|
||||
{
|
||||
CreateShopMenu(MART_TYPE_2);
|
||||
SetShopItemsForSale(itemList);
|
||||
SetShopMenuCallback(EnableBothScriptContexts);
|
||||
SetShopMenuCallback(ScriptContext_Enable);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ void debug_sub_8075C40(u8 taskId)
|
|||
if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
Menu_EraseScreen();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
break;
|
||||
|
|
@ -208,7 +208,7 @@ void debug_sub_8075C40(u8 taskId)
|
|||
void debug_sub_8075D9C(void)
|
||||
{
|
||||
CreateTask(debug_sub_8075C40, 10);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
void debug_sub_8075DB4(struct BattleTowerEReaderTrainer *ereaderTrainer, const u8 *b, u32 trainerId)
|
||||
|
|
@ -410,7 +410,7 @@ void sub_8071310(void)
|
|||
sub_80597F4();
|
||||
}
|
||||
CreateStartMenuTask(sub_80712B4);
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
}
|
||||
|
||||
static u8 StartMenu_InputProcessCallback(void)
|
||||
|
|
@ -589,7 +589,7 @@ static u8 SaveCallback2(void)
|
|||
case SAVE_ERROR:
|
||||
Menu_EraseScreen();
|
||||
ScriptUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
UnlockPlayerFieldControls();
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -645,7 +645,7 @@ static void Task_SaveDialog(u8 taskId)
|
|||
return;
|
||||
}
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static void sub_8071700(void)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ const u8 gExpandedPlaceholder_Brendan[] = _("BRENDAN");
|
|||
const u8 gExpandedPlaceholder_May[] = _("MAY");
|
||||
|
||||
// system text
|
||||
const u8 gSystemText_Egg[] = _("EGG");
|
||||
const u8 gSystemText_Pokemon2[] = _("POKéMON");
|
||||
const u8 gText_EggNickname[] = _("EGG");
|
||||
const u8 gText_Pokemon[] = _("POKéMON");
|
||||
|
||||
// main menu text
|
||||
const u8 gMainMenuString_NewGame[] = _("NEW GAME");
|
||||
|
|
@ -926,7 +926,7 @@ const u8 gSystemText_ClockResetDataSave[] = _("The clock has been reset.\nData w
|
|||
const u8 gSystemText_SaveCompleted[] = _("Save completed.");
|
||||
const u8 gSystemText_SaveFailed[] = _("Save failed...");
|
||||
const u8 gSystemText_NoSaveFileNoTime[] = _("There is no save file, so the time\ncan't be set.");
|
||||
const u8 gSystemText_ClockAdjustmentUsable[] = _("The in-game clock adjustment system\nis now useable.");
|
||||
const u8 gText_InGameClockUsable[] = _("The in-game clock adjustment system\nis now useable.");
|
||||
const u8 gSystemText_Saving[] = _("SAVING...\nDON'T TURN OFF THE POWER.");
|
||||
|
||||
#elif GERMAN
|
||||
|
|
@ -947,8 +947,8 @@ const u8 gExpandedPlaceholder_Brendan[] = _("BRIX");
|
|||
const u8 gExpandedPlaceholder_May[] = _("MAIKE");
|
||||
|
||||
// system text
|
||||
const u8 gSystemText_Egg[] = _("EI");
|
||||
const u8 gSystemText_Pokemon2[] = _("POKéMON");
|
||||
const u8 gText_EggNickname[] = _("EI");
|
||||
const u8 gText_Pokemon[] = _("POKéMON");
|
||||
|
||||
// main menu text
|
||||
const u8 gMainMenuString_NewGame[] = _("NEUES SPIEL");
|
||||
|
|
@ -1851,6 +1851,6 @@ const u8 gSystemText_ClockResetDataSave[] = _("Die Uhr wurde zurückgestellt. Da
|
|||
const u8 gSystemText_SaveCompleted[] = _("Speichern beendet.");
|
||||
const u8 gSystemText_SaveFailed[] = _("Speichern fehlgeschlagen.");
|
||||
const u8 gSystemText_NoSaveFileNoTime[] = _("Es existiert kein Speicherstand. Uhr-\nzeit kann nicht eingestellt werden.");
|
||||
const u8 gSystemText_ClockAdjustmentUsable[] = _("Das spielinterne Zeiteingabe-\nSystem ist jetzt verfügbar.");
|
||||
const u8 gText_InGameClockUsable[] = _("Das spielinterne Zeiteingabe-\nSystem ist jetzt verfügbar.");
|
||||
const u8 gSystemText_Saving[] = _("SPEICHERVORGANG...\nGERÄT NICHT AUSSCHALTEN!");
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ static void Task_WaitWeather(u8 taskId)
|
|||
{
|
||||
if (IsWeatherChangeComplete())
|
||||
{
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5200,7 +5200,7 @@ static void sub_804E144(void)
|
|||
|
||||
void DoInGameTradeScene(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
LockPlayerFieldControls();
|
||||
CreateTask(sub_804E1A0, 10);
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ void sub_8109B34(u8 taskId, u8 decorationId)
|
|||
Menu_DestroyCursor();
|
||||
Menu_EraseWindowRect(0, 1, 12, 12);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void Task_HandleGetDecorationMenuInput(u8 taskId)
|
||||
|
|
@ -232,7 +232,7 @@ void sub_8109D04(u8 taskId)
|
|||
gSpecialVar_0x8006 = 0xFFFF;
|
||||
}
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void sub_8109DAC(u8 taskId)
|
||||
|
|
@ -241,7 +241,7 @@ void sub_8109DAC(u8 taskId)
|
|||
Menu_EraseWindowRect(0, 0, 29, 19);
|
||||
gSpecialVar_0x8006 = 0;
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
void ScrSpecial_TraderDoDecorationTrade(void)
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ void EndTrainerApproach(void)
|
|||
static void Task_DestroyTrainerApproachTask(u8 taskId)
|
||||
{
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
static const struct OamData gOamData_839B4D8 = {
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ bool8 UpdateRepelCounter(void)
|
|||
VarSet(VAR_REPEL_STEP_COUNT, steps);
|
||||
if (steps == 0)
|
||||
{
|
||||
ScriptContext1_SetupScript(S_RepelWoreOff);
|
||||
ScriptContext_SetupScript(S_RepelWoreOff);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user