summaryrefslogtreecommitdiff
path: root/src/script.c
diff options
context:
space:
mode:
authorPhlosioneer <mattmdrr2@gmail.com>2019-02-26 22:07:29 -0500
committerPhlosioneer <mattmdrr2@gmail.com>2019-02-26 22:07:29 -0500
commit3a44b090d15d5317028827778caa4d768761dd2e (patch)
treed0db5158c041178cdfcf9b82d3b444bb18e38737 /src/script.c
parentaccea672f16cb74b0ec16e0e740cf9f67a651dfb (diff)
parent231355f84dccd11329d81d074fa36135cfad4f94 (diff)
Merge branch 'master' into multiplayer-stuff
Diffstat (limited to 'src/script.c')
-rw-r--r--src/script.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/script.c b/src/script.c
index c61ae7183..c95a1141f 100644
--- a/src/script.c
+++ b/src/script.c
@@ -2,6 +2,7 @@
#include "script.h"
#include "event_data.h"
#include "util.h"
+#include "constants/map_scripts.h"
#define RAM_SCRIPT_MAGIC 51
@@ -241,7 +242,7 @@ void ScriptContext2_RunNewScript(const u8 *ptr)
while (RunScriptCommand(&sScriptContext2) == TRUE);
}
-u8 *mapheader_get_tagged_pointer(u8 tag)
+u8 *MapHeaderGetScriptTable(u8 tag)
{
const u8 *mapScripts = gMapHeader.mapScripts;
@@ -261,16 +262,16 @@ u8 *mapheader_get_tagged_pointer(u8 tag)
}
}
-void mapheader_run_script_by_tag(u8 tag)
+void MapHeaderRunScriptType(u8 tag)
{
- u8 *ptr = mapheader_get_tagged_pointer(tag);
+ u8 *ptr = MapHeaderGetScriptTable(tag);
if (ptr)
ScriptContext2_RunNewScript(ptr);
}
-u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
+u8 *MapHeaderCheckScriptTable(u8 tag)
{
- u8 *ptr = mapheader_get_tagged_pointer(tag);
+ u8 *ptr = MapHeaderGetScriptTable(tag);
if (!ptr)
return NULL;
@@ -291,45 +292,45 @@ u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag)
}
}
-void mapheader_run_script_with_tag_x1(void)
+void RunOnLoadMapScript(void)
{
- mapheader_run_script_by_tag(1);
+ MapHeaderRunScriptType(MAP_SCRIPT_ON_LOAD);
}
-void mapheader_run_script_with_tag_x3(void)
+void RunOnTransitionMapScript(void)
{
- mapheader_run_script_by_tag(3);
+ MapHeaderRunScriptType(MAP_SCRIPT_ON_TRANSITION);
}
-void mapheader_run_script_with_tag_x5(void)
+void RunOnResumeMapScript(void)
{
- mapheader_run_script_by_tag(5);
+ MapHeaderRunScriptType(MAP_SCRIPT_ON_RESUME);
}
-void mapheader_run_script_with_tag_x7(void)
+void RunOnReturnToFieldMapScript(void)
{
- mapheader_run_script_by_tag(7);
+ MapHeaderRunScriptType(MAP_SCRIPT_ON_RETURN_TO_FIELD);
}
-void mapheader_run_script_with_tag_x6(void)
+void RunOnDiveWarpMapScript(void)
{
- mapheader_run_script_by_tag(6);
+ MapHeaderRunScriptType(MAP_SCRIPT_ON_DIVE_WARP);
}
-bool8 mapheader_run_first_tag2_script_list_match(void)
+bool8 TryRunOnFrameMapScript(void)
{
- u8 *ptr = mapheader_get_first_match_from_tagged_ptr_list(2);
+ u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_FRAME_TABLE);
if (!ptr)
- return 0;
+ return FALSE;
ScriptContext1_SetupScript(ptr);
- return 1;
+ return TRUE;
}
-void mapheader_run_first_tag4_script_list_match(void)
+void TryRunOnWarpIntoMapScript(void)
{
- u8 *ptr = mapheader_get_first_match_from_tagged_ptr_list(4);
+ u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE);
if (ptr)
ScriptContext2_RunNewScript(ptr);
}