Renaming Script Contexts

- Determined how the various script contexts were used and renamed accordingly.
- ScriptContext2_Enable/Disable => Lock/UnlockPlayerFieldControls - The sole purpose of the flag is to make sure the player can't move around in the overworld. It has nothing to do with script contexts.
- ScriptContext1 => ScriptContext - It is the global script context used to set up scripts which run over many frames.
- ScriptContext2_RunNewScript => RunScriptImmediately - ScriptContext2's sole purpose was to run scripts immediately and in a separate context, usually while the global context is waiting for things like map loads or screen changes.
This commit is contained in:
tustin2121
2022-08-15 15:18:12 -04:00
parent 3dc3dc847f
commit 1cb659df8c
65 changed files with 438 additions and 409 deletions

View File

@@ -31,16 +31,39 @@ void ScriptCall(struct ScriptContext *ctx, const u8 *ptr);
void ScriptReturn(struct ScriptContext *ctx);
u16 ScriptReadHalfword(struct ScriptContext *ctx);
u32 ScriptReadWord(struct ScriptContext *ctx);
void ScriptContext2_Enable(void);
void ScriptContext2_Disable(void);
bool8 ScriptContext2_IsEnabled(void);
void ScriptContext1_Init(void);
bool8 ScriptContext1_IsScriptSetUp(void);
bool8 ScriptContext2_RunScript(void);
void ScriptContext1_SetupScript(const u8 *ptr);
void ScriptContext1_Stop(void);
void EnableBothScriptContexts(void);
void ScriptContext2_RunNewScript(const u8 *ptr);
// Formerly ScriptContext2_Enable / Disable / IsEnabled
void LockPlayerFieldControls(void);
void UnlockPlayerFieldControls(void);
bool8 ArePlayerFieldControlsLocked(void);
// Formerly ScriptContext1_*()
// The ScriptContext_* functions work with the primary script context,
// which yields control back to native code should the script make a wait call.
// Re-initializes the global script context to zero.
void ScriptContext_Init(void);
// Checks if the global script context is able to be run right now.
bool8 ScriptContext_IsEnabled(void);
// Runs the script until the script makes a wait* call, then returns true if
// there's more script to run, or false if the script has hit the end.
// This function also returns false if the context is finished
// or waiting (after a call to _Stop)
bool8 ScriptContext_RunScript(void);
// Sets up a new script in the global context and enables the context
void ScriptContext_SetupScript(const u8 *ptr);
// Puts the script into waiting mode; usually called from a wait* script command.
void ScriptContext_Stop(void);
// Puts the script into running mode.
void ScriptContext_Enable(void);
// Formerly ScriptContext2_RunNewScript()
// Sets up and runs a script in its own context immediately. The script will be
// finished when this function returns. Used mainly by all of the map header
// scripts (except the frame table scripts).
void RunScriptImmediately(const u8 *ptr);
u8 *MapHeaderGetScriptTable(u8 tag);
void MapHeaderRunScriptType(u8 tag);
u8 *MapHeaderCheckScriptTable(u8 tag);