summaryrefslogtreecommitdiff
path: root/src/script.c
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2019-03-23 09:39:46 -0500
committerMarcus Huderle <huderlem@gmail.com>2019-03-23 09:39:46 -0500
commit65391a1eb2979dc050dd4a98afea02bb0ef310ea (patch)
treee31a90d0966cec7e8713ead9ca8083d439c8d9b5 /src/script.c
parenteb48cc2f7eefc1e56c2dcec21c38381b4534b897 (diff)
parentabe56579c107af58e6f3a43968ba2257ff358189 (diff)
Merge remote-tracking branch 'upstream/master' into use_pokeblock
# Conflicts: # src/use_pokeblock.c
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);
}