mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Moving documentation comments per request
from the discord chat.
This commit is contained in:
parent
1cb659df8c
commit
ec73158f16
@ -31,39 +31,16 @@ void ScriptCall(struct ScriptContext *ctx, const u8 *ptr);
|
|||||||
void ScriptReturn(struct ScriptContext *ctx);
|
void ScriptReturn(struct ScriptContext *ctx);
|
||||||
u16 ScriptReadHalfword(struct ScriptContext *ctx);
|
u16 ScriptReadHalfword(struct ScriptContext *ctx);
|
||||||
u32 ScriptReadWord(struct ScriptContext *ctx);
|
u32 ScriptReadWord(struct ScriptContext *ctx);
|
||||||
|
|
||||||
// Formerly ScriptContext2_Enable / Disable / IsEnabled
|
|
||||||
|
|
||||||
void LockPlayerFieldControls(void);
|
void LockPlayerFieldControls(void);
|
||||||
void UnlockPlayerFieldControls(void);
|
void UnlockPlayerFieldControls(void);
|
||||||
bool8 ArePlayerFieldControlsLocked(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);
|
void ScriptContext_Init(void);
|
||||||
// Checks if the global script context is able to be run right now.
|
|
||||||
bool8 ScriptContext_IsEnabled(void);
|
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);
|
bool8 ScriptContext_RunScript(void);
|
||||||
// Sets up a new script in the global context and enables the context
|
|
||||||
void ScriptContext_SetupScript(const u8 *ptr);
|
void ScriptContext_SetupScript(const u8 *ptr);
|
||||||
// Puts the script into waiting mode; usually called from a wait* script command.
|
|
||||||
void ScriptContext_Stop(void);
|
void ScriptContext_Stop(void);
|
||||||
// Puts the script into running mode.
|
|
||||||
void ScriptContext_Enable(void);
|
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);
|
void RunScriptImmediately(const u8 *ptr);
|
||||||
|
|
||||||
u8 *MapHeaderGetScriptTable(u8 tag);
|
u8 *MapHeaderGetScriptTable(u8 tag);
|
||||||
void MapHeaderRunScriptType(u8 tag);
|
void MapHeaderRunScriptType(u8 tag);
|
||||||
u8 *MapHeaderCheckScriptTable(u8 tag);
|
u8 *MapHeaderCheckScriptTable(u8 tag);
|
||||||
|
15
src/script.c
15
src/script.c
@ -194,6 +194,10 @@ bool8 ArePlayerFieldControlsLocked(void)
|
|||||||
return sLockFieldControls;
|
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)
|
bool8 ScriptContext_IsEnabled(void)
|
||||||
{
|
{
|
||||||
if (sGlobalScriptContextStatus == CONTEXT_RUNNING)
|
if (sGlobalScriptContextStatus == CONTEXT_RUNNING)
|
||||||
@ -202,12 +206,17 @@ bool8 ScriptContext_IsEnabled(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-initializes the global script context to zero.
|
||||||
void ScriptContext_Init(void)
|
void ScriptContext_Init(void)
|
||||||
{
|
{
|
||||||
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||||
sGlobalScriptContextStatus = CONTEXT_SHUTDOWN;
|
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)
|
bool8 ScriptContext_RunScript(void)
|
||||||
{
|
{
|
||||||
if (sGlobalScriptContextStatus == CONTEXT_SHUTDOWN)
|
if (sGlobalScriptContextStatus == CONTEXT_SHUTDOWN)
|
||||||
@ -228,6 +237,7 @@ bool8 ScriptContext_RunScript(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets up a new script in the global context and enables the context
|
||||||
void ScriptContext_SetupScript(const u8 *ptr)
|
void ScriptContext_SetupScript(const u8 *ptr)
|
||||||
{
|
{
|
||||||
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||||
@ -236,17 +246,22 @@ void ScriptContext_SetupScript(const u8 *ptr)
|
|||||||
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Puts the script into waiting mode; usually called from a wait* script command.
|
||||||
void ScriptContext_Stop(void)
|
void ScriptContext_Stop(void)
|
||||||
{
|
{
|
||||||
sGlobalScriptContextStatus = CONTEXT_WAITING;
|
sGlobalScriptContextStatus = CONTEXT_WAITING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Puts the script into running mode.
|
||||||
void ScriptContext_Enable(void)
|
void ScriptContext_Enable(void)
|
||||||
{
|
{
|
||||||
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
sGlobalScriptContextStatus = CONTEXT_RUNNING;
|
||||||
LockPlayerFieldControls();
|
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)
|
void RunScriptImmediately(const u8 *ptr)
|
||||||
{
|
{
|
||||||
InitScriptContext(&sImmediateScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
InitScriptContext(&sImmediateScriptContext, gScriptCmdTable, gScriptCmdTableEnd);
|
||||||
|
Loading…
Reference in New Issue
Block a user