summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/field_control_avatar.c2
-rw-r--r--src/fieldmap.c4
-rw-r--r--src/overworld.c14
-rw-r--r--src/script.c29
4 files changed, 25 insertions, 24 deletions
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index bca856e9e..7c74debab 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -228,7 +228,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
#if DEBUG
!input->input_field_1_1 &&
#endif
- mapheader_run_first_tag2_script_list_match() == 1)
+ TryRunOnFrameMapScript() == TRUE)
return TRUE;
if (input->pressedBButton && TrySetupDiveEmergeScript() == TRUE)
diff --git a/src/fieldmap.c b/src/fieldmap.c
index f9b81a173..6ba284810 100644
--- a/src/fieldmap.c
+++ b/src/fieldmap.c
@@ -38,7 +38,7 @@ void not_trainer_hill_battle_pyramid(void)
{
mapheader_copy_mapdata_with_padding(&gMapHeader);
sub_80BB970(gMapHeader.events);
- mapheader_run_script_with_tag_x1();
+ RunOnLoadMapScript();
}
void sub_8055FC0(void)
@@ -47,7 +47,7 @@ void sub_8055FC0(void)
sub_80BBCCC(0);
sub_80BB970(gMapHeader.events);
sub_8056670();
- mapheader_run_script_with_tag_x1();
+ RunOnLoadMapScript();
UpdateTVScreensOnMap(gUnknown_03004870.width, gUnknown_03004870.height);
}
diff --git a/src/overworld.c b/src/overworld.c
index 67bf498c5..072d6d1b3 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -582,7 +582,7 @@ static bool8 SetDiveWarp(u8 direction, u16 x, u16 y)
}
else
{
- mapheader_run_script_with_tag_x6();
+ RunOnDiveWarpMapScript();
if (IsDummyWarp(&gFixedDiveWarp))
return FALSE;
@@ -620,7 +620,7 @@ void sub_80538F0(u8 mapGroup, u8 mapNum)
ChooseAmbientCrySpecies();
SetDefaultFlashLevel();
Overworld_ClearSavedMusic();
- mapheader_run_script_with_tag_x3();
+ RunOnTransitionMapScript();
not_trainer_hill_battle_pyramid();
sub_8056D38(gMapHeader.mapLayout);
apply_map_tileset2_palette(gMapHeader.mapLayout);
@@ -633,7 +633,7 @@ void sub_80538F0(u8 mapGroup, u8 mapNum)
RoamerMove();
DoCurrentWeather();
ResetFieldTasksArgs();
- mapheader_run_script_with_tag_x5();
+ RunOnResumeMapScript();
ShowMapNamePopup();
}
@@ -658,7 +658,7 @@ void sub_8053994(u32 a1)
FlagClear(FLAG_SYS_USE_FLASH);
SetDefaultFlashLevel();
Overworld_ClearSavedMusic();
- mapheader_run_script_with_tag_x3();
+ RunOnTransitionMapScript();
UpdateLocationHistoryForRoamer();
RoamerMoveToOtherLocationSet();
not_trainer_hill_battle_pyramid();
@@ -1829,7 +1829,7 @@ void sub_8054D4C(u32 a1)
sub_8080750();
if (!a1)
SetUpFieldTasks();
- mapheader_run_script_with_tag_x5();
+ RunOnResumeMapScript();
}
void sub_8054D90(void)
@@ -1838,7 +1838,7 @@ void sub_8054D90(void)
gTotalCameraPixelOffsetY = 0;
ResetObjectEvents();
TrySpawnObjectEvents(0, 0);
- mapheader_run_first_tag4_script_list_match();
+ TryRunOnWarpIntoMapScript();
}
void mli4_mapscripts_and_other(void)
@@ -1855,7 +1855,7 @@ void mli4_mapscripts_and_other(void)
ResetInitialPlayerAvatarState();
TrySpawnObjectEvents(0, 0);
ResetBerryTreeSparkleFlags();
- mapheader_run_first_tag4_script_list_match();
+ TryRunOnWarpIntoMapScript();
}
void sub_8054E20(void)
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);
}