Moving documentation comments per request

from the discord chat.
This commit is contained in:
tustin2121 2022-08-15 16:37:38 -04:00
parent 1cb659df8c
commit ec73158f16
2 changed files with 15 additions and 23 deletions

View File

@ -31,39 +31,16 @@ void ScriptCall(struct ScriptContext *ctx, const u8 *ptr);
void ScriptReturn(struct ScriptContext *ctx);
u16 ScriptReadHalfword(struct ScriptContext *ctx);
u32 ScriptReadWord(struct ScriptContext *ctx);
// 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);

View File

@ -194,6 +194,10 @@ bool8 ArePlayerFieldControlsLocked(void)
return sLockFieldControls;
}
// The ScriptContext_* functions work with the primary script context,
// which yields control back to native code should the script make a wait call.
// Checks if the global script context is able to be run right now.
bool8 ScriptContext_IsEnabled(void)
{
if (sGlobalScriptContextStatus == CONTEXT_RUNNING)
@ -202,12 +206,17 @@ bool8 ScriptContext_IsEnabled(void)
return FALSE;
}
// Re-initializes the global script context to zero.
void ScriptContext_Init(void)
{
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
sGlobalScriptContextStatus = CONTEXT_SHUTDOWN;
}
// 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 (sGlobalScriptContextStatus == CONTEXT_SHUTDOWN)
@ -228,6 +237,7 @@ bool8 ScriptContext_RunScript(void)
return TRUE;
}
// Sets up a new script in the global context and enables the context
void ScriptContext_SetupScript(const u8 *ptr)
{
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
@ -236,17 +246,22 @@ void ScriptContext_SetupScript(const u8 *ptr)
sGlobalScriptContextStatus = CONTEXT_RUNNING;
}
// Puts the script into waiting mode; usually called from a wait* script command.
void ScriptContext_Stop(void)
{
sGlobalScriptContextStatus = CONTEXT_WAITING;
}
// Puts the script into running mode.
void ScriptContext_Enable(void)
{
sGlobalScriptContextStatus = CONTEXT_RUNNING;
LockPlayerFieldControls();
}
// 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(&sImmediateScriptContext, gScriptCmdTable, gScriptCmdTableEnd);