summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle_pyramid.c2
-rw-r--r--src/contest_link_80F57C4.c6
-rw-r--r--src/field_control_avatar.c2
-rw-r--r--src/fieldmap.c6
-rw-r--r--src/overworld.c18
-rw-r--r--src/rom_8011DC0.c4
-rw-r--r--src/script.c43
-rw-r--r--src/trainer_hill.c2
-rw-r--r--src/tv.c2
9 files changed, 43 insertions, 42 deletions
diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c
index a2fa4120f..340c17c59 100644
--- a/src/battle_pyramid.c
+++ b/src/battle_pyramid.c
@@ -1590,7 +1590,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
layoutMap += mapLayout->width;
}
}
- mapheader_run_script_with_tag_x1();
+ RunOnLoadMapScript();
free(floorLayoutOffsets);
}
diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c
index 485065d71..c0a79af81 100644
--- a/src/contest_link_80F57C4.c
+++ b/src/contest_link_80F57C4.c
@@ -372,12 +372,12 @@ static void sub_80F5CE4(u8 taskId)
sub_80DEDA8(0xFE);
gUnknown_02039F5C = 1;
gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
- var = VarGet(VAR_0x4086);
- VarSet(VAR_0x4086, 0);
+ var = VarGet(VAR_LINK_CONTEST_ROOM_STATE);
+ VarSet(VAR_LINK_CONTEST_ROOM_STATE, 0);
SetContinueGameWarpStatusToDynamicWarp();
TrySavingData(SAVE_LINK);
ClearContinueGameWarpStatus2();
- VarSet(VAR_0x4086, var);
+ VarSet(VAR_LINK_CONTEST_ROOM_STATE, var);
gTasks[taskId].data[0]++;
break;
case 1:
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index 00dce4c7d..cffafaf9f 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -147,7 +147,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
if (CheckForTrainersWantingBattle() == TRUE)
return TRUE;
- if (mapheader_run_first_tag2_script_list_match() == 1)
+ if (TryRunOnFrameMapScript() == TRUE)
return TRUE;
if (input->pressedBButton && TrySetupDiveEmergeScript() == TRUE)
diff --git a/src/fieldmap.c b/src/fieldmap.c
index 7d9d079fc..cf5f0356e 100644
--- a/src/fieldmap.c
+++ b/src/fieldmap.c
@@ -53,7 +53,7 @@ void InitMap(void)
{
InitMapLayoutData(&gMapHeader);
sub_80E8EE0(gMapHeader.events);
- mapheader_run_script_with_tag_x1();
+ RunOnLoadMapScript();
}
void InitMapFromSavedGame(void)
@@ -62,7 +62,7 @@ void InitMapFromSavedGame(void)
sub_80E9238(0);
sub_80E8EE0(gMapHeader.events);
LoadSavedMapView();
- mapheader_run_script_with_tag_x1();
+ RunOnLoadMapScript();
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
}
@@ -775,7 +775,7 @@ bool8 CameraMove(int x, int y)
old_y = gSaveBlock1Ptr->pos.y;
connection = sub_8088950(direction, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
sub_80887F8(connection, direction, x, y);
- mliX_load_map(connection->mapGroup, connection->mapNum);
+ LoadMapFromCameraTransition(connection->mapGroup, connection->mapNum);
gCamera.active = TRUE;
gCamera.x = old_x - gSaveBlock1Ptr->pos.x;
gCamera.y = old_y - gSaveBlock1Ptr->pos.y;
diff --git a/src/overworld.c b/src/overworld.c
index 2650a619c..a10d1e17a 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -761,7 +761,7 @@ static bool8 SetDiveWarp(u8 dir, u16 x, u16 y)
}
else
{
- mapheader_run_script_with_tag_x6();
+ RunOnDiveWarpMapScript();
if (IsDummyWarp(&gFixedDiveWarp))
return FALSE;
SetWarpDestinationToDiveWarp();
@@ -779,7 +779,7 @@ bool8 SetDiveWarpDive(u16 x, u16 y)
return SetDiveWarp(CONNECTION_DIVE, x, y);
}
-void mliX_load_map(u8 mapGroup, u8 mapNum)
+void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
{
s32 paletteIndex;
@@ -800,7 +800,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
ChooseAmbientCrySpecies();
SetDefaultFlashLevel();
Overworld_ClearSavedMusic();
- mapheader_run_script_with_tag_x3();
+ RunOnTransitionMapScript();
InitMap();
copy_map_tileset2_to_vram_2(gMapHeader.mapLayout);
apply_map_tileset2_palette(gMapHeader.mapLayout);
@@ -813,7 +813,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
RoamerMove();
DoCurrentWeather();
ResetFieldTasksArgs();
- mapheader_run_script_with_tag_x5();
+ RunOnResumeMapScript();
if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER || gMapHeader.regionMapSectionId != sLastMapSectionId)
ShowMapNamePopup();
@@ -852,7 +852,7 @@ static void mli0_load_map(u32 a1)
FlagClear(FLAG_SYS_USE_FLASH);
SetDefaultFlashLevel();
Overworld_ClearSavedMusic();
- mapheader_run_script_with_tag_x3();
+ RunOnTransitionMapScript();
UpdateLocationHistoryForRoamer();
RoamerMoveToOtherLocationSet();
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
@@ -2126,7 +2126,7 @@ static void sub_8086988(u32 a1)
ResumePausedWeather();
if (!a1)
SetUpFieldTasks();
- mapheader_run_script_with_tag_x5();
+ RunOnResumeMapScript();
TryStartMirageTowerPulseBlendEffect();
}
@@ -2136,7 +2136,7 @@ static void sub_80869DC(void)
gTotalCameraPixelOffsetY = 0;
ResetEventObjects();
TrySpawnEventObjects(0, 0);
- mapheader_run_first_tag4_script_list_match();
+ TryRunOnWarpIntoMapScript();
}
static void mli4_mapscripts_and_other(void)
@@ -2153,14 +2153,14 @@ static void mli4_mapscripts_and_other(void)
SetPlayerAvatarTransitionFlags(player->transitionFlags);
ResetInitialPlayerAvatarState();
TrySpawnEventObjects(0, 0);
- mapheader_run_first_tag4_script_list_match();
+ TryRunOnWarpIntoMapScript();
}
static void sub_8086A68(void)
{
sub_808E16C(0, 0);
RotatingGate_InitPuzzleAndGraphics();
- mapheader_run_script_with_tag_x7();
+ RunOnReturnToFieldMapScript();
}
static void sub_8086A80(void)
diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c
index baed26cf8..c8adfbe0b 100644
--- a/src/rom_8011DC0.c
+++ b/src/rom_8011DC0.c
@@ -1630,7 +1630,7 @@ void sub_8014210(u16 battleFlags)
void sub_8014290(u16 arg0, u16 x, u16 y)
{
- VarSet(VAR_0x4087, arg0);
+ VarSet(VAR_CABLE_CLUB_STATE, arg0);
SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
SetDynamicWarpWithCoords(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
WarpIntoMap();
@@ -1639,7 +1639,7 @@ void sub_8014290(u16 arg0, u16 x, u16 y)
void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
{
gSpecialVar_0x8004 = arg4;
- VarSet(VAR_0x4087, arg4);
+ VarSet(VAR_CABLE_CLUB_STATE, arg4);
gFieldLinkPlayerCount = GetLinkPlayerCount();
gUnknown_03005DB4 = GetMultiplayerId();
SetCableClubWarp();
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);
}
diff --git a/src/trainer_hill.c b/src/trainer_hill.c
index efe11b0c7..42b196abd 100644
--- a/src/trainer_hill.c
+++ b/src/trainer_hill.c
@@ -796,7 +796,7 @@ void sub_81D5FB4(u16 *mapArg)
dst += 31;
}
- mapheader_run_script_with_tag_x1();
+ RunOnLoadMapScript();
FreeDataStruct();
}
diff --git a/src/tv.c b/src/tv.c
index 5904efeb8..248721083 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -3603,7 +3603,7 @@ void GetMomOrDadStringForTVMessage(void)
void sub_80F01B8(void)
{
- VarSet(VAR_0x40BC, 0);
+ VarSet(VAR_BRAVO_TRAINER_BATTLE_TOWER_ON, 0);
RemoveEventObjectByLocalIdAndMap(5, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
FlagSet(FLAG_HIDE_BATTLE_TOWER_REPORTER);
}