diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2020-07-20 18:02:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-20 18:02:50 -0400 |
commit | aeeff84462973b267e62031a945603d96afed716 (patch) | |
tree | 046ce2a73b467844e95a490b1cfa9cdda5e5f4df /src/script.c | |
parent | d3bfb6cfc63f9f64295cbd864f98df9cf4c643b4 (diff) | |
parent | f0bf1e641cb8532611c97354beaf46afaca7c417 (diff) |
Merge pull request #780 from GriffinRichards/sync-scripts
Sync some scripts with pokeemerald
Diffstat (limited to 'src/script.c')
-rw-r--r-- | src/script.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/script.c b/src/script.c index 2c6495552..cd4816a52 100644 --- a/src/script.c +++ b/src/script.c @@ -1,6 +1,7 @@ #include "global.h" #include "script.h" #include "event_data.h" +#include "constants/map_scripts.h" #define RAM_SCRIPT_MAGIC 51 #define SCRIPT_STACK_SIZE 20 @@ -256,14 +257,14 @@ static u8 *mapheader_get_tagged_pointer(u8 tag) } } -static void mapheader_run_script_by_tag(u8 tag) +static void MapHeaderRunScriptType(u8 tag) { u8 *ptr = mapheader_get_tagged_pointer(tag); if (ptr) ScriptContext2_RunNewScript(ptr); } -static u8 *mapheader_get_first_match_from_tagged_ptr_list(u8 tag) +static u8 *MapHeaderCheckScriptTable(u8 tag) { u8 *ptr = mapheader_get_tagged_pointer(tag); @@ -286,29 +287,29 @@ static 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_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; @@ -317,9 +318,9 @@ bool8 mapheader_run_first_tag2_script_list_match(void) return 1; } -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); } |