summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle_factory_screen.c4
-rw-r--r--src/battle_pyramid.c2
-rwxr-xr-xsrc/cable_car.c8
-rw-r--r--src/contest_link_80F57C4.c6
-rw-r--r--src/egg_hatch.c2
-rw-r--r--src/field_control_avatar.c2
-rw-r--r--src/field_screen_effect.c10
-rw-r--r--src/field_specials.c5
-rw-r--r--src/field_weather.c15
-rw-r--r--src/field_weather_effect.c103
-rw-r--r--src/fieldmap.c6
-rw-r--r--src/graphics.c14
-rw-r--r--src/overworld.c20
-rwxr-xr-xsrc/party_menu.c6
-rw-r--r--src/pokemon.c24
-rw-r--r--src/pokemon_storage_system.c4
-rw-r--r--src/pokemon_summary_screen.c427
-rw-r--r--src/rom_8011DC0.c4
-rw-r--r--src/script.c43
-rw-r--r--src/start_menu.c18
-rw-r--r--src/trade.c4
-rw-r--r--src/trainer_hill.c2
-rw-r--r--src/tv.c2
23 files changed, 367 insertions, 364 deletions
diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c
index bb9fe8e28..e48dbd30b 100644
--- a/src/battle_factory_screen.c
+++ b/src/battle_factory_screen.c
@@ -1183,7 +1183,7 @@ static void CB2_InitSelectScreen(void)
break;
case 5:
if (sFactorySelectScreen->fromSummaryScreen == TRUE)
- sFactorySelectScreen->cursorPos = gUnknown_0203CF20;
+ sFactorySelectScreen->cursorPos = gLastViewedMonIndex;
Select_InitMonsData();
Select_InitAllSprites();
if (sFactorySelectScreen->fromSummaryScreen == TRUE)
@@ -3172,7 +3172,7 @@ static void CB2_InitSwapScreen(void)
break;
case 5:
if (sFactorySwapScreen->fromSummaryScreen == TRUE)
- sFactorySwapScreen->cursorPos = gUnknown_0203CF20;
+ sFactorySwapScreen->cursorPos = gLastViewedMonIndex;
gMain.state++;
break;
case 6:
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/cable_car.c b/src/cable_car.c
index 207a0c22d..420bdd30f 100755
--- a/src/cable_car.c
+++ b/src/cable_car.c
@@ -358,7 +358,7 @@ static void CleanupCableCar(void)
HideBg(3);
sub_8150B6C(0);
gSpriteCoordOffsetX = 0;
- sub_80AB130(WEATHER_NONE);
+ SetCurrentAndNextWeatherNoDelay(WEATHER_NONE);
for (i = 0; i < 20; i++)
gWeatherPtr->sprites.s2.ashSprites[i] = NULL;
@@ -394,7 +394,7 @@ static void sub_81503E4(u8 taskId)
case 0:
if (sCableCar->timer == sCableCar->unk4)
{
- ChangeWeather(sCableCar->weather);
+ SetNextWeather(sCableCar->weather);
sCableCar->state = 1;
}
break;
@@ -798,7 +798,7 @@ static void LoadCableCarSprites(void)
gSprites[spriteId].data[1] = 99;
sCableCar->weather = WEATHER_ASH;
sCableCar->unk4 = 0x15e;
- sub_80AB130(WEATHER_SUNNY);
+ SetCurrentAndNextWeatherNoDelay(WEATHER_SUNNY);
break;
case 1:
CopyToBgTilemapBufferRect_ChangePalette(0, sCableCar->mtChimneyTilemap + 0x24, 24, 26, 12, 3, 17);
@@ -822,7 +822,7 @@ static void LoadCableCarSprites(void)
gSprites[spriteId].data[1] = 0x41;
sCableCar->weather = WEATHER_SUNNY;
sCableCar->unk4 = 0x109;
- sub_80AB130(WEATHER_ASH);
+ SetCurrentAndNextWeatherNoDelay(WEATHER_ASH);
break;
}
for (i = 0; i < 9; i++)
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/egg_hatch.c b/src/egg_hatch.c
index e1d94889a..ba1020669 100644
--- a/src/egg_hatch.c
+++ b/src/egg_hatch.c
@@ -574,7 +574,7 @@ static void Task_EggHatchPlayBGM(u8 taskID)
if (gTasks[taskID].data[0] == 0)
{
StopMapMusic();
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
}
if (gTasks[taskID].data[0] == 1)
PlayBGM(MUS_ME_SHINKA);
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/field_screen_effect.c b/src/field_screen_effect.c
index 93017f125..0a4f3212b 100644
--- a/src/field_screen_effect.c
+++ b/src/field_screen_effect.c
@@ -503,7 +503,7 @@ void DoWarp(void)
ScriptContext2_Enable();
TryFadeOutOldMapMusic();
WarpFadeScreen();
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
PlaySE(SE_KAIDAN);
gFieldCallback = mapldr_default;
CreateTask(sub_80AFA0C, 10);
@@ -514,7 +514,7 @@ void DoDiveWarp(void)
ScriptContext2_Enable();
TryFadeOutOldMapMusic();
WarpFadeScreen();
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
gFieldCallback = mapldr_default;
CreateTask(sub_80AFA0C, 10);
}
@@ -524,7 +524,7 @@ void sub_80AF79C(void)
ScriptContext2_Enable();
TryFadeOutOldMapMusic();
FadeScreen(FADE_TO_WHITE, 8);
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
gFieldCallback = sub_80AF3B0;
CreateTask(sub_80AFA0C, 10);
}
@@ -734,7 +734,7 @@ static void sub_80AFA88(u8 taskId)
case 4:
TryFadeOutOldMapMusic();
WarpFadeScreen();
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
task->data[0] = 0;
task->func = sub_80AFA0C;
break;
@@ -771,7 +771,7 @@ void sub_80AFC60(void)
ScriptContext2_Enable();
TryFadeOutOldMapMusic();
WarpFadeScreen();
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
PlaySE(SE_KAIDAN);
gFieldCallback = sub_80AF3C8;
CreateTask(task0A_fade_n_map_maybe, 10);
diff --git a/src/field_specials.c b/src/field_specials.c
index 3c26085dd..307f81399 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -54,6 +54,7 @@
#include "constants/moves.h"
#include "constants/vars.h"
#include "constants/battle_frontier.h"
+#include "constants/weather.h"
EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
EWRAM_DATA u8 gBikeCollisions = 0;
@@ -3527,9 +3528,9 @@ bool8 sub_813B3B0(void)
}
}
-void sub_813B484(void)
+void Unused_SetWeatherSunny(void)
{
- sub_80AB104(2);
+ SetCurrentAndNextWeather(WEATHER_SUNNY);
}
bool32 sub_813B490(void)
diff --git a/src/field_weather.c b/src/field_weather.c
index 0db635c60..9913e9a61 100644
--- a/src/field_weather.c
+++ b/src/field_weather.c
@@ -186,11 +186,11 @@ void StartWeather(void)
}
}
-void ChangeWeather(u8 weather)
+void SetNextWeather(u8 weather)
{
if (weather != WEATHER_RAIN_LIGHT && weather != WEATHER_RAIN_MED && weather != WEATHER_RAIN_HEAVY)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
}
if (gWeatherPtr->nextWeather != weather && gWeatherPtr->currWeather == weather)
@@ -203,18 +203,19 @@ void ChangeWeather(u8 weather)
gWeatherPtr->finishStep = 0;
}
-void sub_80AB104(u8 weather)
+void SetCurrentAndNextWeather(u8 weather)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
gWeatherPtr->currWeather = weather;
gWeatherPtr->nextWeather = weather;
}
-void sub_80AB130(u8 weather)
+void SetCurrentAndNextWeatherNoDelay(u8 weather)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
gWeatherPtr->currWeather = weather;
gWeatherPtr->nextWeather = weather;
+ // Overrides the normal delay during screen fading.
gWeatherPtr->readyForInit = TRUE;
}
@@ -1053,7 +1054,7 @@ void SetRainStrengthFromSoundEffect(u16 soundEffect)
}
}
-void PlayRainSoundEffect(void)
+void PlayRainStoppingSoundEffect(void)
{
if (IsSpecialSEPlaying())
{
diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c
index 2ec51a722..be8fdc6cb 100644
--- a/src/field_weather_effect.c
+++ b/src/field_weather_effect.c
@@ -16,8 +16,8 @@
void sub_80AC6B4(struct Sprite *);
// EWRAM
-EWRAM_DATA static u8 gUnknown_02038BC4 = 0;
-EWRAM_DATA static u16 gUnknown_02038BC6 = 0;
+EWRAM_DATA static u8 gCurrentAlternatingWeather = 0;
+EWRAM_DATA static u16 gUnusedWeatherRelated = 0;
// CONST
const u16 gUnknown_0854C290[] = INCBIN_U16("graphics/weather/1.gbapal");
@@ -2286,13 +2286,14 @@ void unc_0807DAB4(struct Sprite *sprite)
//------------------------------------------------------------------------------
-static void sub_80AEC94(u32 a0, u32 a1)
+// Unused function.
+static void UnusedSetCurrentAlternatingWeather(u32 a0, u32 a1)
{
- gUnknown_02038BC4 = a0;
- gUnknown_02038BC6 = a1;
+ gCurrentAlternatingWeather = a0;
+ gUnusedWeatherRelated = a1;
}
-static void sub_80AECA8(u8 taskId)
+static void Task_DoAlternatingWeather(u8 taskId)
{
s16 *data = gTasks[taskId].data;
@@ -2301,8 +2302,8 @@ static void sub_80AECA8(u8 taskId)
case 0:
if (data[15]-- <= 0)
{
- ChangeWeather(data[1]);
- gUnknown_02038BC4 = data[1];
+ SetNextWeather(data[1]);
+ gCurrentAlternatingWeather = data[1];
data[15] = 600;
data[0]++;
}
@@ -2310,8 +2311,8 @@ static void sub_80AECA8(u8 taskId)
case 1:
if (data[15]-- <= 0)
{
- ChangeWeather(data[2]);
- gUnknown_02038BC4 = data[2];
+ SetNextWeather(data[2]);
+ gCurrentAlternatingWeather = data[2];
data[15] = 600;
data[0] = 0;
}
@@ -2319,25 +2320,25 @@ static void sub_80AECA8(u8 taskId)
}
}
-static void sub_80AED28(void)
+static void CreateAlternatingWeatherTask(void)
{
- u8 taskId = CreateTask(sub_80AECA8, 0);
+ u8 taskId = CreateTask(Task_DoAlternatingWeather, 0);
s16 *data = gTasks[taskId].data;
data[15] = 600;
- if (gUnknown_02038BC4 == WEATHER_RAIN_HEAVY)
+ if (gCurrentAlternatingWeather == WEATHER_RAIN_HEAVY)
{
data[1] = WEATHER_DROUGHT;
data[2] = WEATHER_RAIN_HEAVY;
}
- else if (gUnknown_02038BC4 == WEATHER_DROUGHT)
+ else if (gCurrentAlternatingWeather == WEATHER_DROUGHT)
{
data[1] = WEATHER_RAIN_HEAVY;
data[2] = WEATHER_DROUGHT;
}
else
{
- gUnknown_02038BC4 = WEATHER_RAIN_HEAVY;
+ gCurrentAlternatingWeather = WEATHER_RAIN_HEAVY;
data[1] = WEATHER_DROUGHT;
data[2] = WEATHER_RAIN_HEAVY;
}
@@ -2368,51 +2369,51 @@ void SetSav1WeatherFromCurrMapHeader(void)
void SetWeather(u32 weather)
{
SetSav1Weather(weather);
- ChangeWeather(GetSav1Weather());
+ SetNextWeather(GetSav1Weather());
}
void SetWeather_Unused(u32 weather)
{
SetSav1Weather(weather);
- sub_80AB104(GetSav1Weather());
+ SetCurrentAndNextWeather(GetSav1Weather());
}
void DoCurrentWeather(void)
{
u8 weather = GetSav1Weather();
- if (weather == WEATHER_15)
+ if (weather == WEATHER_ALTERNATING)
{
- if (!FuncIsActiveTask(sub_80AECA8))
- sub_80AED28();
- weather = gUnknown_02038BC4;
+ if (!FuncIsActiveTask(Task_DoAlternatingWeather))
+ CreateAlternatingWeatherTask();
+ weather = gCurrentAlternatingWeather;
}
else
{
- if (FuncIsActiveTask(sub_80AECA8))
- DestroyTask(FindTaskIdByFunc(sub_80AECA8));
- gUnknown_02038BC4 = WEATHER_RAIN_HEAVY;
+ if (FuncIsActiveTask(Task_DoAlternatingWeather))
+ DestroyTask(FindTaskIdByFunc(Task_DoAlternatingWeather));
+ gCurrentAlternatingWeather = WEATHER_RAIN_HEAVY;
}
- ChangeWeather(weather);
+ SetNextWeather(weather);
}
-void sub_80AEE84(void)
+void ResumePausedWeather(void)
{
u8 weather = GetSav1Weather();
- if (weather == WEATHER_15)
+ if (weather == WEATHER_ALTERNATING)
{
- if (!FuncIsActiveTask(sub_80AECA8))
- sub_80AED28();
- weather = gUnknown_02038BC4;
+ if (!FuncIsActiveTask(Task_DoAlternatingWeather))
+ CreateAlternatingWeatherTask();
+ weather = gCurrentAlternatingWeather;
}
else
{
- if (FuncIsActiveTask(sub_80AECA8))
- DestroyTask(FindTaskIdByFunc(sub_80AECA8));
- gUnknown_02038BC4 = WEATHER_RAIN_HEAVY;
+ if (FuncIsActiveTask(Task_DoAlternatingWeather))
+ DestroyTask(FindTaskIdByFunc(Task_DoAlternatingWeather));
+ gCurrentAlternatingWeather = WEATHER_RAIN_HEAVY;
}
- sub_80AB104(weather);
+ SetCurrentAndNextWeather(weather);
}
static const u8 sWeatherCycleRoute119[] =
@@ -2434,25 +2435,25 @@ static u8 TranslateWeatherNum(u8 weather)
{
switch (weather)
{
- case WEATHER_NONE: return WEATHER_NONE;
- case WEATHER_CLOUDS: return WEATHER_CLOUDS;
- case WEATHER_SUNNY: return WEATHER_SUNNY;
- case WEATHER_RAIN_LIGHT: return WEATHER_RAIN_LIGHT;
- case WEATHER_SNOW: return WEATHER_SNOW;
- case WEATHER_RAIN_MED: return WEATHER_RAIN_MED;
- case WEATHER_FOG_1: return WEATHER_FOG_1;
- case WEATHER_ASH: return WEATHER_ASH;
- case WEATHER_SANDSTORM: return WEATHER_SANDSTORM;
- case WEATHER_FOG_2: return WEATHER_FOG_2;
- case WEATHER_FOG_3: return WEATHER_FOG_3;
- case WEATHER_SHADE: return WEATHER_SHADE;
- case WEATHER_DROUGHT: return WEATHER_DROUGHT;
- case WEATHER_RAIN_HEAVY: return WEATHER_RAIN_HEAVY;
- case WEATHER_BUBBLES: return WEATHER_BUBBLES;
- case WEATHER_15: return WEATHER_15;
+ case WEATHER_NONE: return WEATHER_NONE;
+ case WEATHER_CLOUDS: return WEATHER_CLOUDS;
+ case WEATHER_SUNNY: return WEATHER_SUNNY;
+ case WEATHER_RAIN_LIGHT: return WEATHER_RAIN_LIGHT;
+ case WEATHER_SNOW: return WEATHER_SNOW;
+ case WEATHER_RAIN_MED: return WEATHER_RAIN_MED;
+ case WEATHER_FOG_1: return WEATHER_FOG_1;
+ case WEATHER_ASH: return WEATHER_ASH;
+ case WEATHER_SANDSTORM: return WEATHER_SANDSTORM;
+ case WEATHER_FOG_2: return WEATHER_FOG_2;
+ case WEATHER_FOG_3: return WEATHER_FOG_3;
+ case WEATHER_SHADE: return WEATHER_SHADE;
+ case WEATHER_DROUGHT: return WEATHER_DROUGHT;
+ case WEATHER_RAIN_HEAVY: return WEATHER_RAIN_HEAVY;
+ case WEATHER_BUBBLES: return WEATHER_BUBBLES;
+ case WEATHER_ALTERNATING: return WEATHER_ALTERNATING;
case WEATHER_ROUTE119_CYCLE: return sWeatherCycleRoute119[gSaveBlock1Ptr->weatherCycleStage];
case WEATHER_ROUTE123_CYCLE: return sWeatherCycleRoute123[gSaveBlock1Ptr->weatherCycleStage];
- default: return WEATHER_NONE;
+ default: return WEATHER_NONE;
}
}
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/graphics.c b/src/graphics.c
index c6af13477..a3b9eb913 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1152,16 +1152,16 @@ const u32 gStatusPal_Icons[] = INCBIN_U32("graphics/interface/status_icons.gbapa
const u32 gMoveTypes_Gfx[] = INCBIN_U32("graphics/types/move_types.4bpp.lz");
const u32 gMoveTypes_Pal[] = INCBIN_U32("graphics/types/move_types.gbapal.lz");
-const u32 gUnknown_08D97BEC[] = INCBIN_U32("graphics/interface/summary_frames.4bpp.lz");
+const u32 gMoveSelectorBitmap[] = INCBIN_U32("graphics/interface/summary_frames.4bpp.lz");
const u32 gUnknown_08D97CF4[] = INCBIN_U32("graphics/interface/summary_frames.gbapal.lz");
-const u32 gUnknown_08D97D0C[] = INCBIN_U32("graphics/interface/status_screen.4bpp.lz");
-const u32 gUnknown_08D9853C[] = INCBIN_U32("graphics/interface/status_screen.gbapal.lz");
-const u32 gUnknown_08D9862C[] = INCBIN_U32("graphics/interface/status_screen.bin.lz");
+const u32 gStatusScreenBitmap[] = INCBIN_U32("graphics/interface/status_screen.4bpp.lz");
+const u32 gStatusScreenPalette[] = INCBIN_U32("graphics/interface/status_screen.gbapal.lz");
+const u32 gPageInfoTilemap[] = INCBIN_U32("graphics/interface/status_screen.bin.lz");
-const u32 gUnknown_08D987FC[] = INCBIN_U32("graphics/interface/status_tilemap1.bin.lz");
-const u32 gUnknown_08D9898C[] = INCBIN_U32("graphics/interface/status_tilemap2.bin.lz");
-const u32 gUnknown_08D98B28[] = INCBIN_U32("graphics/interface/status_tilemap3.bin.lz");
+const u32 gPageSkillsTilemap[] = INCBIN_U32("graphics/interface/status_tilemap1.bin.lz");
+const u32 gPageBattleMovesTilemap[] = INCBIN_U32("graphics/interface/status_tilemap2.bin.lz");
+const u32 gPageContestMovesTilemap[] = INCBIN_U32("graphics/interface/status_tilemap3.bin.lz");
const u32 gUnknown_08D98CC8[] = INCBIN_U32("graphics/interface/status_tilemap0.bin.lz");
const u32 gBagMaleTiles[] = INCBIN_U32("graphics/misc/bag_male.4bpp.lz");
diff --git a/src/overworld.c b/src/overworld.c
index 08fd94c1b..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)
@@ -2123,10 +2123,10 @@ static void sub_8086988(u32 a1)
FieldEffectActiveListClear();
StartWeather();
- sub_80AEE84();
+ 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/party_menu.c b/src/party_menu.c
index 15b5d24d8..645390aff 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -3833,7 +3833,7 @@ static void sub_81B3828(void)
static void sub_81B3894(void)
{
gPaletteFade.bufferTransferDisabled = TRUE;
- gUnknown_0203CEC8.unk9 = gUnknown_0203CF20;
+ gUnknown_0203CEC8.unk9 = gLastViewedMonIndex;
InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.exitCallback);
}
@@ -7319,9 +7319,9 @@ static void sub_81B97DC(struct Pokemon *mon, u8 slotTo, u8 slotFrom)
u8 pp1 = GetMonData(mon, MON_DATA_PP1 + slotTo);
u8 pp0 = GetMonData(mon, MON_DATA_PP1 + slotFrom);
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
- u8 ppBonusMask1 = gUnknown_08329D22[slotTo];
+ u8 ppBonusMask1 = gPPUpGetMask[slotTo];
u8 ppBonusMove1 = (ppBonuses & ppBonusMask1) >> (slotTo * 2);
- u8 ppBonusMask2 = gUnknown_08329D22[slotFrom];
+ u8 ppBonusMask2 = gPPUpGetMask[slotFrom];
u8 ppBonusMove2 = (ppBonuses & ppBonusMask2) >> (slotFrom * 2);
ppBonuses &= ~ppBonusMask1;
ppBonuses &= ~ppBonusMask2;
diff --git a/src/pokemon.c b/src/pokemon.c
index 9553fdf17..a35033d49 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -2227,9 +2227,9 @@ static const u8 sMonAnimationDelayTable[] =
[SPECIES_CHIMECHO - 1] = 0x00,
};
-const u8 gUnknown_08329D22[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values
-const u8 gUnknown_08329D26[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count
-const u8 gUnknown_08329D2A[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count
+const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values
+const u8 gPPUpSetMask[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count
+const u8 gPPUpAddMask[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count
const u8 gStatStageRatios[][2] =
{
@@ -4914,19 +4914,19 @@ void GetSpeciesName(u8 *name, u16 species)
u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex)
{
u8 basePP = gBattleMoves[move].pp;
- return basePP + ((basePP * 20 * ((gUnknown_08329D22[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100);
+ return basePP + ((basePP * 20 * ((gPPUpGetMask[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100);
}
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex)
{
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
- ppBonuses &= gUnknown_08329D26[moveIndex];
+ ppBonuses &= gPPUpSetMask[moveIndex];
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
}
void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex)
{
- mon->ppBonuses &= gUnknown_08329D26[moveIndex];
+ mon->ppBonuses &= gPPUpSetMask[moveIndex];
}
void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
@@ -5169,11 +5169,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (r10 & 0x20)
{
r10 &= ~0x20;
- dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gUnknown_08329D22[moveIndex]) >> (moveIndex * 2);
+ dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
var_38 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (dataUnsigned <= 2 && var_38 > 4)
{
- dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gUnknown_08329D2A[moveIndex];
+ dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex];
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - var_38;
@@ -5429,13 +5429,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
var_3C++;
break;
case 4:
- dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gUnknown_08329D22[moveIndex]) >> (moveIndex * 2);
+ dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
r5 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (dataUnsigned < 3 && r5 > 4)
{
dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
- dataUnsigned &= gUnknown_08329D26[moveIndex];
- dataUnsigned += gUnknown_08329D2A[moveIndex] * 3;
+ dataUnsigned &= gPPUpSetMask[moveIndex];
+ dataUnsigned += gPPUpAddMask[moveIndex] * 3;
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - r5;
@@ -7025,7 +7025,7 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF
}
}
-void sub_806EE98(void)
+void StopPokemonAnimationDelayTask(void)
{
u8 delayTaskId = FindTaskIdByFunc(Task_PokemonSummaryAnimateAfterDelay);
if (delayTaskId != 0xFF)
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index c1ebe91b4..cdfc4ba6b 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -1218,7 +1218,7 @@ static const u16 gWallpaperPalettes_Plain[][16] =
static const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz");
static const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz");
-// 12×18 tilemap
+// 12x18 tilemap
static const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin");
static const u16 gUnknown_08577574[][2] =
@@ -6654,7 +6654,7 @@ static void sub_80CE8E4(void)
if (sIsMonBeingMoved)
sub_80CE790();
else
- sBoxCursorPosition = gUnknown_0203CF20;
+ sBoxCursorPosition = gLastViewedMonIndex;
}
s16 CompactPartySlots(void)
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index 46bdc9ef3..bd1ae7802 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -97,25 +97,22 @@ static EWRAM_DATA struct PssData
u8 currPageIndex;
u8 minPageIndex;
u8 maxPageIndex;
- bool8 unk40C3;
+ bool8 lockMonFlag; // This is used to prevent the player from changing pokemon in the move deleter select, etc, but it is not needed because the input is handled differently there
u16 newMove;
u8 firstMoveIndex;
u8 secondMoveIndex;
bool8 unk40C8;
- u8 unk40C9;
+ u8 bgDisplayOrder; // Determines the order page backgrounds are loaded while scrolling between them
u8 filler40CA;
u8 windowIds[8];
u8 spriteIds[28];
bool8 unk40EF;
- s16 unk40F0;
+ s16 switchCounter; // Used for various switch statement cases that decompress/load graphics or pokemon data
u8 unk_filler4[6];
} *pssData = NULL;
-EWRAM_DATA u8 gUnknown_0203CF20 = 0;
-static EWRAM_DATA u8 gUnknown_0203CF21 = 0;
-static EWRAM_DATA u8 gFiller_0203CF22[2] = {0};
-static EWRAM_DATA u8 sUnknownTaskId = 0;
-static EWRAM_DATA u8 gFiller_0203CF25[3] = {0};
-
+EWRAM_DATA u8 gLastViewedMonIndex = 0;
+static EWRAM_DATA u8 sUnknown_0203CF21 = 0;
+ALIGNED(4) static EWRAM_DATA u8 sUnknownTaskId = 0;
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
struct UnkStruct_61CC04
@@ -144,11 +141,11 @@ static s8 sub_81C08F8(s8 a);
static s8 sub_81C09B4(s8 a);
static bool8 sub_81C0A50(struct Pokemon* mon);
static void ChangePage(u8 taskId, s8 a);
-static void sub_81C0B8C(u8 taskId);
-static void sub_81C0C68(u8 taskId);
-static void sub_81C0CC4(u8 taskId);
-static void sub_81C0D44(u8 taskId);
-static void sub_81C0E24(void);
+static void PssScrollRight(u8 taskId);
+static void PssScrollRightEnd(u8 taskId);
+static void PssScrollLeft(u8 taskId);
+static void PssScrollLeftEnd(u8 taskId);
+static void CheckExperienceProgressBar(void);
static void sub_81C0E48(u8 taskId);
static void HandleInput_MoveSelect(u8 taskId);
static bool8 sub_81C1040(void);
@@ -160,11 +157,11 @@ static void sub_81C13B0(u8 taskId, bool8 b);
static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2);
static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2);
static void sub_81C171C(u8 taskId);
-static void sub_81C174C(u8 taskId);
-static bool8 sub_81C18A8(void);
-static void sub_81C18F4(u8 a);
-static void sub_81C1940(u8 taskId);
-static void sub_81C1BA0(void);
+static void HandleReplaceMoveInput(u8 taskId);
+static bool8 CanReplaceMove(void);
+static void ShowHMMovesCantBeForgottenWindow(u8 a);
+static void HandleHMMovesCantBeForgottenInput(u8 taskId);
+static void DrawPagination(void);
static void sub_81C1DA4(u16 a, s16 b);
static void sub_81C1E20(u8 taskId);
static void sub_81C1EFC(u16 a, s16 b, u16 c);
@@ -172,10 +169,10 @@ static void sub_81C1F80(u8 taskId);
static void sub_81C2074(u16 a, s16 b);
static void sub_81C20F0(u8 taskId);
static void sub_81C2194(u16 *a, u16 b, u8 c);
-static void sub_81C2228(struct Pokemon* mon);
+static void DrawPokerusCuredSymbol(struct Pokemon* mon);
static void DrawExperienceProgressBar(struct Pokemon* mon);
static void DrawContestMoveHearts(u16 move);
-static void sub_81C2524(void);
+static void LimitEggSummaryPageDisplay(void);
static void ResetWindows(void);
static void sub_81C25E8(void);
static void sub_81C2628(void);
@@ -237,7 +234,7 @@ static void sub_81C4568(u8 a, u8 b);
static u8 CreatePokemonSprite(struct Pokemon *a, s16 *b);
static u8 sub_81C47B4(struct Pokemon *unused);
static void SpriteCB_Pokemon(struct Sprite *);
-static void sub_81C48F0(void);
+static void StopPokemonAnimations(void);
static void CreateMonMarkingsSprite(struct Pokemon *mon);
static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon);
static void CreateCaughtBallSprite(struct Pokemon *mon);
@@ -252,7 +249,7 @@ static void sub_81C4D18(u8 a);
#include "data/text/move_descriptions.h"
#include "data/text/nature_names.h"
-static const struct BgTemplate gUnknown_0861CBB4[] =
+ALIGNED(4) static const struct BgTemplate sUnknown_0861CBB4[] =
{
{
.bg = 0,
@@ -292,25 +289,25 @@ static const struct BgTemplate gUnknown_0861CBB4[] =
},
};
-static const u16 gUnknown_0861CBC4[] = INCBIN_U16("graphics/interface/unk_tilemap2.bin");
-static const struct UnkStruct_61CC04 gUnknown_0861CBEC =
+static const u16 sUnknown_0861CBC4[] = INCBIN_U16("graphics/interface/unk_tilemap2.bin");
+static const struct UnkStruct_61CC04 sUnknown_0861CBEC =
{
- gUnknown_0861CBC4, 1, 10, 2, 0, 18
+ sUnknown_0861CBC4, 1, 10, 2, 0, 18
};
-static const struct UnkStruct_61CC04 gUnknown_0861CBF8 =
+static const struct UnkStruct_61CC04 sUnknown_0861CBF8 =
{
- gUnknown_0861CBC4, 1, 10, 2, 0, 50
+ sUnknown_0861CBC4, 1, 10, 2, 0, 50
};
-static const struct UnkStruct_61CC04 gUnknown_0861CC04 =
+static const struct UnkStruct_61CC04 sUnknown_0861CC04 =
{
gSummaryScreenPowAcc_Tilemap, 0, 10, 7, 0, 45
};
-static const struct UnkStruct_61CC04 gUnknown_0861CC10 =
+static const struct UnkStruct_61CC04 sUnknown_0861CC10 =
{
gUnknown_08DC3C34, 0, 10, 7, 0, 45
};
static const s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5};
-static const struct WindowTemplate gUnknown_0861CC24[] =
+static const struct WindowTemplate sSummaryTemplate[] =
{
{//Text for Pokemon Info
.bg = 0,
@@ -494,7 +491,7 @@ static const struct WindowTemplate gUnknown_0861CC24[] =
},
DUMMY_WIN_TEMPLATE
};
-static const struct WindowTemplate gUnknown_0861CCCC[] =
+static const struct WindowTemplate sPageInfoTemplate[] =
{
{//Original Trainer
.bg = 0,
@@ -533,7 +530,7 @@ static const struct WindowTemplate gUnknown_0861CCCC[] =
.baseBlock = 557,
},
};
-static const struct WindowTemplate gUnknown_0861CCEC[] =
+static const struct WindowTemplate sPageSkillsTemplate[] =
{
{//Held Item string
.bg = 0,
@@ -581,7 +578,7 @@ static const struct WindowTemplate gUnknown_0861CCEC[] =
.baseBlock = 543,
},
};
-static const struct WindowTemplate gUnknown_0861CD14[] =
+static const struct WindowTemplate sPageMovesTemplate[] = // This is used for both battle and contest moves
{
{//Move names?
.bg = 0,
@@ -628,8 +625,8 @@ static const u8 sTextColors_861CD2C[][3] =
{0, 7, 8}
};
-static const u8 gUnknown_0861CD53[] = INCBIN_U8("graphics/interface/summary_a_button.4bpp");
-static const u8 gUnknown_0861CDD3[] = INCBIN_U8("graphics/interface/summary_b_button.4bpp");
+static const u8 sSummaryAButtonBitmap[] = INCBIN_U8("graphics/interface/summary_a_button.4bpp");
+static const u8 sSummaryBButtonBitmap[] = INCBIN_U8("graphics/interface/summary_b_button.4bpp");
static void (*const sTextPrinterFunctions[])(void) =
{
@@ -647,11 +644,11 @@ static void (*const sTextPrinterTasks[])(u8 taskId) =
Task_PrintContestMoves
};
-static const u8 gUnknown_0861CE74[] = _("{COLOR LIGHT_RED}{SHADOW GREEN}");
-static const u8 gUnknown_0861CE7B[] = _("{COLOR WHITE}{SHADOW DARK_GREY}");
-static const u8 gUnknown_0861CE82[] = _("{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}\n{SPECIAL_F7 0x03}");
-static const u8 gUnknown_0861CE8E[] = _("{SPECIAL_F7 0x00}\n{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}");
-static const u8 gUnknown_0861CE97[] = _("{PP}{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}");
+static const u8 sMemoNatureTextColor[] = _("{COLOR LIGHT_RED}{SHADOW GREEN}");
+static const u8 sMemoMiscTextColor[] = _("{COLOR WHITE}{SHADOW DARK_GREY}"); // This is also affected by palettes, apparently
+static const u8 sStatsLeftColumnLayout[] = _("{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}\n{SPECIAL_F7 0x03}");
+static const u8 sStatsRightColumnLayout[] = _("{SPECIAL_F7 0x00}\n{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}");
+static const u8 sMovesPPLayout[] = _("{PP}{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}");
#define TAG_MOVE_TYPES 30002
@@ -847,61 +844,61 @@ static const struct OamData gOamData_861CFF4 =
.paletteNum = 0,
.affineParam = 0,
};
-static const union AnimCmd gSpriteAnim_861CFFC[] = {
+static const union AnimCmd sSpriteAnim_861CFFC[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D004[] = {
+static const union AnimCmd sSpriteAnim_861D004[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D00C[] = {
+static const union AnimCmd sSpriteAnim_861D00C[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D014[] = {
+static const union AnimCmd sSpriteAnim_861D014[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D01C[] = {
+static const union AnimCmd sSpriteAnim_861D01C[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D024[] = {
+static const union AnimCmd sSpriteAnim_861D024[] = {
ANIMCMD_FRAME(16, 0, TRUE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D02C[] = {
+static const union AnimCmd sSpriteAnim_861D02C[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D034[] = {
+static const union AnimCmd sSpriteAnim_861D034[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D03C[] = {
+static const union AnimCmd sSpriteAnim_861D03C[] = {
ANIMCMD_FRAME(24, 0, TRUE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D044[] = {
+static const union AnimCmd sSpriteAnim_861D044[] = {
ANIMCMD_FRAME(28, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd *const gSpriteAnimTable_861D04C[] = {
- gSpriteAnim_861CFFC,
- gSpriteAnim_861D004,
- gSpriteAnim_861D00C,
- gSpriteAnim_861D014,
- gSpriteAnim_861D01C,
- gSpriteAnim_861D024,
- gSpriteAnim_861D02C,
- gSpriteAnim_861D034,
- gSpriteAnim_861D03C,
- gSpriteAnim_861D044,
+static const union AnimCmd *const sSpriteAnimTable_861D04C[] = {
+ sSpriteAnim_861CFFC,
+ sSpriteAnim_861D004,
+ sSpriteAnim_861D00C,
+ sSpriteAnim_861D014,
+ sSpriteAnim_861D01C,
+ sSpriteAnim_861D024,
+ sSpriteAnim_861D02C,
+ sSpriteAnim_861D034,
+ sSpriteAnim_861D03C,
+ sSpriteAnim_861D044,
};
-static const struct CompressedSpriteSheet gUnknown_0861D074 =
+static const struct CompressedSpriteSheet sMoveSelectorSpriteSheet =
{
- .data = gUnknown_08D97BEC,
+ .data = gMoveSelectorBitmap,
.size = 0x400,
.tag = 30000
};
@@ -915,7 +912,7 @@ static const struct SpriteTemplate gUnknown_0861D084 =
.tileTag = 30000,
.paletteTag = 30000,
.oam = &gOamData_861CFF4,
- .anims = gSpriteAnimTable_861D04C,
+ .anims = sSpriteAnimTable_861D04C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
@@ -994,7 +991,7 @@ static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
-static const u16 gUnknown_0861D120[] = INCBIN_U16("graphics/interface/summary_markings.gbapal");
+static const u16 sSummaryMarkingsPalette[] = INCBIN_U16("graphics/interface/summary_markings.gbapal");
// code
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void))
@@ -1026,7 +1023,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex,
case PSS_MODE_SELECT_MOVE:
pssData->minPageIndex = 2;
pssData->maxPageIndex = 3;
- pssData->unk40C3 = TRUE;
+ pssData->lockMonFlag = TRUE;
break;
}
@@ -1101,7 +1098,7 @@ static bool8 SummaryScreen_LoadGraphics(void)
break;
case 5:
InitBGs();
- pssData->unk40F0 = 0;
+ pssData->switchCounter = 0;
gMain.state++;
break;
case 6:
@@ -1113,12 +1110,12 @@ static bool8 SummaryScreen_LoadGraphics(void)
gMain.state++;
break;
case 8:
- sub_81C1BA0();
+ DrawPagination();
gMain.state++;
break;
case 9:
CopyMonToSummaryStruct(&pssData->currentMon);
- pssData->unk40F0 = 0;
+ pssData->switchCounter = 0;
gMain.state++;
break;
case 10:
@@ -1148,14 +1145,14 @@ static bool8 SummaryScreen_LoadGraphics(void)
case 16:
ResetSpriteIds();
CreateMoveTypeIcons();
- pssData->unk40F0 = 0;
+ pssData->switchCounter = 0;
gMain.state++;
break;
case 17:
- pssData->spriteIds[0] = CreatePokemonSprite(&pssData->currentMon, &pssData->unk40F0);
+ pssData->spriteIds[0] = CreatePokemonSprite(&pssData->currentMon, &pssData->switchCounter);
if (pssData->spriteIds[0] != 0xFF)
{
- pssData->unk40F0 = 0;
+ pssData->switchCounter = 0;
gMain.state++;
}
break;
@@ -1202,7 +1199,7 @@ static bool8 SummaryScreen_LoadGraphics(void)
static void InitBGs(void)
{
ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_0861CBB4, ARRAY_COUNT(gUnknown_0861CBB4));
+ InitBgsFromTemplates(0, sUnknown_0861CBB4, ARRAY_COUNT(sUnknown_0861CBB4));
SetBgTilemapBuffer(1, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]);
SetBgTilemapBuffer(2, pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0]);
SetBgTilemapBuffer(3, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0]);
@@ -1220,64 +1217,64 @@ static void InitBGs(void)
static bool8 SummaryScreen_DecompressGraphics(void)
{
- switch (pssData->unk40F0)
+ switch (pssData->switchCounter)
{
case 0:
reset_temp_tile_data_buffers();
- decompress_and_copy_tile_data_to_vram(1, &gUnknown_08D97D0C, 0, 0, 0);
- pssData->unk40F0++;
+ decompress_and_copy_tile_data_to_vram(1, &gStatusScreenBitmap, 0, 0, 0);
+ pssData->switchCounter++;
break;
case 1:
if (free_temp_tile_data_buffers_if_possible() != 1)
{
- LZDecompressWram(gUnknown_08D9862C, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0]);
- pssData->unk40F0++;
+ LZDecompressWram(gPageInfoTilemap, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0]);
+ pssData->switchCounter++;
}
break;
case 2:
LZDecompressWram(gUnknown_08D98CC8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][1]);
- pssData->unk40F0++;
+ pssData->switchCounter++;
break;
case 3:
- LZDecompressWram(gUnknown_08D987FC, pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1]);
- pssData->unk40F0++;
+ LZDecompressWram(gPageSkillsTilemap, pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1]);
+ pssData->switchCounter++;
break;
case 4:
- LZDecompressWram(gUnknown_08D9898C, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][1]);
- pssData->unk40F0++;
+ LZDecompressWram(gPageBattleMovesTilemap, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][1]);
+ pssData->switchCounter++;
break;
case 5:
- LZDecompressWram(gUnknown_08D98B28, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]);
- pssData->unk40F0++;
+ LZDecompressWram(gPageContestMovesTilemap, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]);
+ pssData->switchCounter++;
break;
case 6:
- LoadCompressedPalette(gUnknown_08D9853C, 0, 0x100);
+ LoadCompressedPalette(gStatusScreenPalette, 0, 0x100);
LoadPalette(&gUnknown_08D85620, 0x81, 0x1E);
- pssData->unk40F0++;
+ pssData->switchCounter++;
break;
case 7:
LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes);
- pssData->unk40F0++;
+ pssData->switchCounter++;
break;
case 8:
- LoadCompressedSpriteSheet(&gUnknown_0861D074);
- pssData->unk40F0++;
+ LoadCompressedSpriteSheet(&sMoveSelectorSpriteSheet);
+ pssData->switchCounter++;
break;
case 9:
LoadCompressedSpriteSheet(&sStatusIconsSpriteSheet);
- pssData->unk40F0++;
+ pssData->switchCounter++;
break;
case 10:
LoadCompressedSpritePalette(&sStatusIconsSpritePalette);
- pssData->unk40F0++;
+ pssData->switchCounter++;
break;
case 11:
LoadCompressedSpritePalette(&gUnknown_0861D07C);
- pssData->unk40F0++;
+ pssData->switchCounter++;
break;
case 12:
LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60);
- pssData->unk40F0 = 0;
+ pssData->switchCounter = 0;
return TRUE;
}
return FALSE;
@@ -1301,7 +1298,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
{
u32 i;
struct PokeSummary *sum = &pssData->summary;
- switch (pssData->unk40F0)
+ switch (pssData->switchCounter)
{
case 0:
sum->species = GetMonData(a, MON_DATA_SPECIES);
@@ -1366,7 +1363,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
sum->ribbonCount = GetMonData(a, MON_DATA_RIBBON_COUNT);
return TRUE;
}
- pssData->unk40F0++;
+ pssData->switchCounter++;
return FALSE;
}
@@ -1397,8 +1394,8 @@ static void sub_81C0348(void)
if (pssData->currPageIndex != PSS_PAGE_BATTLE_MOVES && pssData->currPageIndex != PSS_PAGE_CONTEST_MOVES)
PutWindowTilemap(13);
}
- sub_81C2524();
- sub_81C2228(&pssData->currentMon);
+ LimitEggSummaryPageDisplay();
+ DrawPokerusCuredSymbol(&pssData->currentMon);
}
static void sub_81C0434(void)
@@ -1418,7 +1415,7 @@ static void CloseSummaryScreen(u8 taskId)
if (sub_81221EC() != TRUE && !gPaletteFade.active)
{
SetMainCallback2(pssData->callback);
- gUnknown_0203CF20 = pssData->curMonIndex;
+ gLastViewedMonIndex = pssData->curMonIndex;
SummaryScreen_DestroyUnknownTask();
ResetSpriteData();
FreeAllSpritePalettes();
@@ -1457,7 +1454,7 @@ static void HandleInput(u8 taskId)
{
if (pssData->currPageIndex == PSS_PAGE_INFO)
{
- sub_81C48F0();
+ StopPokemonAnimations();
PlaySE(SE_SELECT);
BeginCloseSummaryScreen(taskId);
}
@@ -1470,7 +1467,7 @@ static void HandleInput(u8 taskId)
}
else if (gMain.newKeys & B_BUTTON)
{
- sub_81C48F0();
+ StopPokemonAnimations();
PlaySE(SE_SELECT);
BeginCloseSummaryScreen(taskId);
}
@@ -1481,7 +1478,7 @@ static void ChangePokemon(u8 taskId, s8 a)
{
s8 r4_2;
- if (!pssData->unk40C3)
+ if (!pssData->lockMonFlag)
{
if (pssData->isBoxMon == TRUE)
{
@@ -1545,7 +1542,7 @@ static void sub_81C0704(u8 taskId)
break;
case 3:
CopyMonToSummaryStruct(&pssData->currentMon);
- pssData->unk40F0 = 0;
+ pssData->switchCounter = 0;
break;
case 4:
if (ExtractMonDataToSummaryStruct(&pssData->currentMon) == FALSE)
@@ -1560,7 +1557,7 @@ static void sub_81C0704(u8 taskId)
case 7:
if (pssData->summary.unk7)
sub_81C2074(10, -2);
- sub_81C2228(&pssData->currentMon);
+ DrawPokerusCuredSymbol(&pssData->currentMon);
data[1] = 0;
break;
case 8:
@@ -1568,7 +1565,7 @@ static void sub_81C0704(u8 taskId)
if (pssData->spriteIds[0] == 0xFF)
return;
gSprites[pssData->spriteIds[0]].data[2] = 1;
- sub_81C0E24();
+ CheckExperienceProgressBar();
data[1] = 0;
break;
case 9:
@@ -1579,7 +1576,7 @@ static void sub_81C0704(u8 taskId)
break;
case 11:
PrintPageSpecificText(pssData->currPageIndex);
- sub_81C2524();
+ LimitEggSummaryPageDisplay();
break;
case 12:
gSprites[pssData->spriteIds[0]].data[2] = 0;
@@ -1678,19 +1675,19 @@ static void ChangePage(u8 taskId, s8 b)
pssData->currPageIndex += b;
data[0] = 0;
if (b == 1)
- SetTaskFuncWithFollowupFunc(taskId, sub_81C0B8C, gTasks[taskId].func);
+ SetTaskFuncWithFollowupFunc(taskId, PssScrollRight, gTasks[taskId].func);
else
- SetTaskFuncWithFollowupFunc(taskId, sub_81C0CC4, gTasks[taskId].func);
+ SetTaskFuncWithFollowupFunc(taskId, PssScrollLeft, gTasks[taskId].func);
CreateTextPrinterTask(pssData->currPageIndex);
HidePageSpecificSprites();
}
-static void sub_81C0B8C(u8 taskId)
+static void PssScrollRight(u8 taskId) // Scroll right
{
s16 *data = gTasks[taskId].data;
if (data[0] == 0)
{
- if (pssData->unk40C9 == 0)
+ if (pssData->bgDisplayOrder == 0)
{
data[1] = 1;
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
@@ -1712,28 +1709,28 @@ static void sub_81C0B8C(u8 taskId)
ChangeBgX(data[1], 0x2000, 1);
data[0] += 32;
if (data[0] > 0xFF)
- gTasks[taskId].func = sub_81C0C68;
+ gTasks[taskId].func = PssScrollRightEnd;
}
-static void sub_81C0C68(u8 taskId)
+static void PssScrollRightEnd(u8 taskId) // display right
{
s16 *data = gTasks[taskId].data;
- pssData->unk40C9 ^= 1;
+ pssData->bgDisplayOrder ^= 1;
data[1] = 0;
data[0] = 0;
- sub_81C1BA0();
+ DrawPagination();
CreatePageWindowTilemaps(pssData->currPageIndex);
SetTypeIcons();
- sub_81C0E24();
+ CheckExperienceProgressBar();
SwitchTaskToFollowupFunc(taskId);
}
-static void sub_81C0CC4(u8 taskId)
+static void PssScrollLeft(u8 taskId) // Scroll left
{
s16 *data = gTasks[taskId].data;
if (data[0] == 0)
{
- if (pssData->unk40C9 == 0)
+ if (pssData->bgDisplayOrder == 0)
data[1] = 2;
else
data[1] = 1;
@@ -1742,13 +1739,13 @@ static void sub_81C0CC4(u8 taskId)
ChangeBgX(data[1], 0x2000, 2);
data[0] += 32;
if (data[0] > 0xFF)
- gTasks[taskId].func = sub_81C0D44;
+ gTasks[taskId].func = PssScrollLeftEnd;
}
-static void sub_81C0D44(u8 taskId)
+static void PssScrollLeftEnd(u8 taskId) // display left
{
s16 *data = gTasks[taskId].data;
- if (pssData->unk40C9 == 0)
+ if (pssData->bgDisplayOrder == 0)
{
SetBgAttribute(1, BG_ATTR_PRIORITY, 1);
SetBgAttribute(2, BG_ATTR_PRIORITY, 2);
@@ -1767,17 +1764,17 @@ static void sub_81C0D44(u8 taskId)
}
ShowBg(1);
ShowBg(2);
- pssData->unk40C9 ^= 1;
+ pssData->bgDisplayOrder ^= 1;
data[1] = 0;
data[0] = 0;
- sub_81C1BA0();
+ DrawPagination();
CreatePageWindowTilemaps(pssData->currPageIndex);
SetTypeIcons();
- sub_81C0E24();
+ CheckExperienceProgressBar();
SwitchTaskToFollowupFunc(taskId);
}
-static void sub_81C0E24(void)
+static void CheckExperienceProgressBar(void)
{
if (pssData->currPageIndex == 1)
DrawExperienceProgressBar(&pssData->currentMon);
@@ -2025,9 +2022,9 @@ static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2)
u8 ppBonuses = summary->ppBonuses;
// Calculate PP bonuses
- u8 ppUpMask1 = gUnknown_08329D22[moveIndex1];
+ u8 ppUpMask1 = gPPUpGetMask[moveIndex1];
u8 ppBonusMove1 = (ppBonuses & ppUpMask1) >> (moveIndex1 * 2);
- u8 ppUpMask2 = gUnknown_08329D22[moveIndex2];
+ u8 ppUpMask2 = gPPUpGetMask[moveIndex2];
u8 ppBonusMove2 = (ppBonuses & ppUpMask2) >> (moveIndex2 * 2);
ppBonuses &= ~ppUpMask1;
ppBonuses &= ~ppUpMask2;
@@ -2060,9 +2057,9 @@ static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2
u8 ppBonuses = summary->ppBonuses;
// Calculate PP bonuses
- u8 ppUpMask1 = gUnknown_08329D22[moveIndex1];
+ u8 ppUpMask1 = gPPUpGetMask[moveIndex1];
u8 ppBonusMove1 = (ppBonuses & ppUpMask1) >> (moveIndex1 * 2);
- u8 ppUpMask2 = gUnknown_08329D22[moveIndex2];
+ u8 ppUpMask2 = gPPUpGetMask[moveIndex2];
u8 ppBonusMove2 = (ppBonuses & ppUpMask2) >> (moveIndex2 * 2);
ppBonuses &= ~ppUpMask1;
ppBonuses &= ~ppUpMask2;
@@ -2088,10 +2085,10 @@ static void sub_81C171C(u8 taskId)
{
SetNewMoveTypeIcon();
sub_81C4AF8(8);
- gTasks[taskId].func = sub_81C174C;
+ gTasks[taskId].func = HandleReplaceMoveInput;
}
-static void sub_81C174C(u8 taskId)
+static void HandleReplaceMoveInput(u8 taskId)
{
s16* data = gTasks[taskId].data;
@@ -2119,26 +2116,26 @@ static void sub_81C174C(u8 taskId)
}
else if (gMain.newKeys & A_BUTTON)
{
- if (sub_81C18A8() == TRUE)
+ if (CanReplaceMove() == TRUE)
{
- sub_81C48F0();
+ StopPokemonAnimations();
PlaySE(SE_SELECT);
- gUnknown_0203CF21 = pssData->firstMoveIndex;
- gSpecialVar_0x8005 = gUnknown_0203CF21;
+ sUnknown_0203CF21 = pssData->firstMoveIndex;
+ gSpecialVar_0x8005 = sUnknown_0203CF21;
BeginCloseSummaryScreen(taskId);
}
else
{
PlaySE(SE_HAZURE);
- sub_81C18F4(taskId);
+ ShowHMMovesCantBeForgottenWindow(taskId);
}
}
else if (gMain.newKeys & B_BUTTON)
{
u32 var1;
- sub_81C48F0();
+ StopPokemonAnimations();
PlaySE(SE_SELECT);
- gUnknown_0203CF21 = 4;
+ sUnknown_0203CF21 = 4;
gSpecialVar_0x8005 = 4;
BeginCloseSummaryScreen(taskId);
}
@@ -2146,7 +2143,7 @@ static void sub_81C174C(u8 taskId)
}
}
-static bool8 sub_81C18A8(void)
+static bool8 CanReplaceMove(void)
{
if (pssData->firstMoveIndex == MAX_MON_MOVES || pssData->newMove == MOVE_NONE || IsMoveHm(pssData->summary.moves[pssData->firstMoveIndex]) != 1)
return TRUE;
@@ -2154,7 +2151,7 @@ static bool8 sub_81C18A8(void)
return FALSE;
}
-static void sub_81C18F4(u8 taskId)
+static void ShowHMMovesCantBeForgottenWindow(u8 taskId)
{
ClearWindowTilemap(14);
ClearWindowTilemap(15);
@@ -2162,10 +2159,11 @@ static void sub_81C18F4(u8 taskId)
sub_81C1DA4(0, 3);
sub_81C1EFC(0, 3, 0);
PrintHMMovesCantBeForgotten();
- gTasks[taskId].func = sub_81C1940;
+ gTasks[taskId].func = HandleHMMovesCantBeForgottenInput;
}
-static void sub_81C1940(u8 taskId)
+// This redraws the power/accuracy window when the player scrolls out of the "HM Moves can't be forgotten" message
+static void HandleHMMovesCantBeForgottenInput(u8 taskId)
{
s16* data = gTasks[taskId].data;
u16 move;
@@ -2177,7 +2175,7 @@ static void sub_81C1940(u8 taskId)
data[0] = 4;
sub_81C1070(&data[0], -1, &pssData->firstMoveIndex);
data[1] = 0;
- gTasks[taskId].func = sub_81C174C;
+ gTasks[taskId].func = HandleReplaceMoveInput;
}
else if (gMain.newKeys & DPAD_DOWN)
{
@@ -2185,7 +2183,7 @@ static void sub_81C1940(u8 taskId)
data[0] = 4;
sub_81C1070(&data[0], 1, &pssData->firstMoveIndex);
data[1] = 0;
- gTasks[taskId].func = sub_81C174C;
+ gTasks[taskId].func = HandleReplaceMoveInput;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
{
@@ -2195,7 +2193,7 @@ static void sub_81C1940(u8 taskId)
if (!gSprites[pssData->spriteIds[2]].invisible)
ClearWindowTilemap(13);
move = pssData->summary.moves[pssData->firstMoveIndex];
- gTasks[taskId].func = sub_81C174C;
+ gTasks[taskId].func = HandleReplaceMoveInput;
ChangePage(taskId, -1);
sub_81C1DA4(9, -2);
sub_81C1EFC(9, -2, move);
@@ -2209,7 +2207,7 @@ static void sub_81C1940(u8 taskId)
if (!gSprites[pssData->spriteIds[2]].invisible)
ClearWindowTilemap(13);
move = pssData->summary.moves[pssData->firstMoveIndex];
- gTasks[taskId].func = sub_81C174C;
+ gTasks[taskId].func = HandleReplaceMoveInput;
ChangePage(taskId, 1);
sub_81C1DA4(9, -2);
sub_81C1EFC(9, -2, move);
@@ -2225,17 +2223,17 @@ static void sub_81C1940(u8 taskId)
schedule_bg_copy_tilemap_to_vram(0);
sub_81C1DA4(9, -3);
sub_81C1EFC(9, -3, move);
- gTasks[taskId].func = sub_81C174C;
+ gTasks[taskId].func = HandleReplaceMoveInput;
}
}
}
u8 sub_81C1B94(void)
{
- return gUnknown_0203CF21;
+ return sUnknown_0203CF21;
}
-static void sub_81C1BA0(void)
+static void DrawPagination(void) // Updates the pagination dots at the top of the summary screen
{
u16 *alloced = Alloc(32);
u8 i;
@@ -2333,11 +2331,11 @@ static void sub_81C1CB0(const struct UnkStruct_61CC04 *unkStruct, u16 *dest, u8
static void sub_81C1DA4(u16 a, s16 b)
{
- if (b > gUnknown_0861CC04.field_6)
- b = gUnknown_0861CC04.field_6;
- if (b == 0 || b == gUnknown_0861CC04.field_6)
+ if (b > sUnknown_0861CC04.field_6)
+ b = sUnknown_0861CC04.field_6;
+ if (b == 0 || b == sUnknown_0861CC04.field_6)
{
- sub_81C1CB0(&gUnknown_0861CC04, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], b, 1);
+ sub_81C1CB0(&sUnknown_0861CC04, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], b, 1);
}
else
{
@@ -2359,12 +2357,12 @@ static void sub_81C1E20(u8 taskId)
{
data[1] = 0;
}
- else if (data[1] > gUnknown_0861CC04.field_6)
+ else if (data[1] > sUnknown_0861CC04.field_6)
{
- data[1] = gUnknown_0861CC04.field_6;
+ data[1] = sUnknown_0861CC04.field_6;
}
- sub_81C1CB0(&gUnknown_0861CC04, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], data[1], 1);
- if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6)
+ sub_81C1CB0(&sUnknown_0861CC04, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], data[1], 1);
+ if (data[1] <= 0 || data[1] >= sUnknown_0861CC04.field_6)
{
if (data[0] < 0)
{
@@ -2386,10 +2384,10 @@ static void sub_81C1E20(u8 taskId)
static void sub_81C1EFC(u16 a, s16 b, u16 move)
{
- if (b > gUnknown_0861CC10.field_6)
- b = gUnknown_0861CC10.field_6;
- if (b == 0 || b == gUnknown_0861CC10.field_6)
- sub_81C1CB0(&gUnknown_0861CC10, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], b, 1);
+ if (b > sUnknown_0861CC10.field_6)
+ b = sUnknown_0861CC10.field_6;
+ if (b == 0 || b == sUnknown_0861CC10.field_6)
+ sub_81C1CB0(&sUnknown_0861CC10, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], b, 1);
else
{
u8 taskId = FindTaskIdByFunc(sub_81C1F80);
@@ -2409,16 +2407,16 @@ static void sub_81C1F80(u8 taskId)
{
data[1] = 0;
}
- else if (data[1] > gUnknown_0861CC10.field_6)
+ else if (data[1] > sUnknown_0861CC10.field_6)
{
- data[1] = gUnknown_0861CC10.field_6;
+ data[1] = sUnknown_0861CC10.field_6;
}
- sub_81C1CB0(&gUnknown_0861CC10, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], data[1], 1);
- if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6)
+ sub_81C1CB0(&sUnknown_0861CC10, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], data[1], 1);
+ if (data[1] <= 0 || data[1] >= sUnknown_0861CC10.field_6)
{
if (data[0] < 0)
{
- if (pssData->currPageIndex == 3 && FuncIsActiveTask(sub_81C0B8C) == 0)
+ if (pssData->currPageIndex == 3 && FuncIsActiveTask(PssScrollRight) == 0)
PutWindowTilemap(15);
DrawContestMoveHearts(data[2]);
}
@@ -2439,12 +2437,12 @@ static void sub_81C1F80(u8 taskId)
static void sub_81C2074(u16 a, s16 b)
{
- if (b > gUnknown_0861CBEC.field_6)
- b = gUnknown_0861CBEC.field_6;
- if (b == 0 || b == gUnknown_0861CBEC.field_6)
+ if (b > sUnknown_0861CBEC.field_6)
+ b = sUnknown_0861CBEC.field_6;
+ if (b == 0 || b == sUnknown_0861CBEC.field_6)
{
- sub_81C1CB0(&gUnknown_0861CBEC, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0);
- sub_81C1CB0(&gUnknown_0861CBF8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0);
+ sub_81C1CB0(&sUnknown_0861CBEC, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0);
+ sub_81C1CB0(&sUnknown_0861CBF8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0);
}
else
{
@@ -2460,12 +2458,12 @@ static void sub_81C20F0(u8 taskId)
data[1] += data[0];
if (data[1] < 0)
data[1] = 0;
- else if (data[1] > gUnknown_0861CBEC.field_6)
- data[1] = gUnknown_0861CBEC.field_6;
- sub_81C1CB0(&gUnknown_0861CBEC, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0);
- sub_81C1CB0(&gUnknown_0861CBF8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0);
+ else if (data[1] > sUnknown_0861CBEC.field_6)
+ data[1] = sUnknown_0861CBEC.field_6;
+ sub_81C1CB0(&sUnknown_0861CBEC, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0);
+ sub_81C1CB0(&sUnknown_0861CBF8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0);
schedule_bg_copy_tilemap_to_vram(3);
- if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6)
+ if (data[1] <= 0 || data[1] >= sUnknown_0861CBEC.field_6)
{
if (data[0] < 0)
{
@@ -2505,9 +2503,9 @@ static void sub_81C2194(u16 *output, u16 palette, bool8 c)
}
}
-static void sub_81C2228(struct Pokemon *mon)
+static void DrawPokerusCuredSymbol(struct Pokemon *mon) // This checks if the mon has been cured of pokerus
{
- if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0))
+ if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) // If yes it draws the cured symbol
{
pssData->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x2C;
pssData->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x2C;
@@ -2615,7 +2613,7 @@ static void DrawContestMoveHearts(u16 move)
}
}
-static void sub_81C2524(void)
+static void LimitEggSummaryPageDisplay(void) // If the pokemon is an egg, limit the number of pages displayed to 1
{
if (pssData->summary.isEgg)
ChangeBgX(3, 0x10000, 0);
@@ -2626,7 +2624,7 @@ static void sub_81C2524(void)
static void ResetWindows(void)
{
u8 i;
- InitWindows(gUnknown_0861CC24);
+ InitWindows(sSummaryTemplate);
DeactivateAllTextPrinters();
for (i = 0; i < 20; i++)
@@ -2729,7 +2727,8 @@ static void sub_81C27DC(struct Pokemon *mon, u16 species)
static void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x)
{
- BlitBitmapToWindow(windowId, (bButton) ? gUnknown_0861CDD3 : gUnknown_0861CDD3 - 0x80, x, 0, 16, 16);
+ // sSummaryBButtonBitmap - 0x80 = sSummaryAButtonBitmap
+ BlitBitmapToWindow(windowId, (bButton) ? sSummaryBButtonBitmap : sSummaryBButtonBitmap - 0x80, x, 0, 16, 16);
}
static void PrintPageNamesAndStatsPageToWindows(void)
@@ -2987,7 +2986,7 @@ static void PrintMonOTName(void)
int x;
if (InBattleFactory() != TRUE && sub_81B9E94() != TRUE)
{
- windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0);
+ windowId = AddWindowFromTemplateList(sPageInfoTemplate, 0);
SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1);
x = GetStringWidth(1, gText_OTSlash, 0);
if (pssData->summary.OTGender == 0)
@@ -3004,20 +3003,20 @@ static void PrintMonOTID(void)
{
ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)pssData->summary.OTID, 2, 5);
xPos = GetStringRightAlignXOffset(1, gStringVar1, 56);
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, xPos, 1, 0, 1);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 1), gStringVar1, xPos, 1, 0, 1);
}
}
static void PrintMonAbilityName(void)
{
u8 ability = GetAbilityBySpecies(pssData->summary.species, pssData->summary.altAbility);
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 2), gAbilityNames[ability], 0, 1, 0, 1);
}
static void PrintMonAbilityDescription(void)
{
u8 ability = GetAbilityBySpecies(pssData->summary.species, pssData->summary.altAbility);
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0);
}
static void BufferMonTrainerMemo(void)
@@ -3026,8 +3025,8 @@ static void BufferMonTrainerMemo(void)
const u8 *text;
DynamicPlaceholderTextUtil_Reset();
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_0861CE74);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_0861CE7B);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sMemoNatureTextColor);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, sMemoMiscTextColor);
BufferNatureString();
if (InBattleFactory() == TRUE || sub_81B9E94() == TRUE || IsInGamePartnerMon() == TRUE)
@@ -3074,7 +3073,7 @@ static void BufferMonTrainerMemo(void)
static void PrintMonTrainerMemo(void)
{
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 3), gStringVar4, 0, 1, 0, 0);
}
static void BufferNatureString(void)
@@ -3147,7 +3146,7 @@ static bool8 IsInGamePartnerMon(void)
static void PrintEggOTName(void)
{
- u32 windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0);
+ u32 windowId = AddWindowFromTemplateList(sPageInfoTemplate, 0);
u32 width = GetStringWidth(1, gText_OTSlash, 0);
SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(windowId, gText_FiveMarks, width, 1, 0, 1);
@@ -3159,7 +3158,7 @@ static void PrintEggOTID(void)
StringCopy(gStringVar1, gText_UnkCtrlF907F908);
StringAppend(gStringVar1, gText_FiveMarks);
x = GetStringRightAlignXOffset(1, gStringVar1, 56);
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, x, 1, 0, 1);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 1), gStringVar1, x, 1, 0, 1);
}
static void PrintEggState(void)
@@ -3178,7 +3177,7 @@ static void PrintEggState(void)
else
text = gText_EggWillTakeALongTime;
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), text, 0, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 2), text, 0, 1, 0, 0);
}
static void PrintEggMemo(void)
@@ -3202,7 +3201,7 @@ static void PrintEggMemo(void)
text = gText_OddEggFoundByCouple;
}
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), text, 0, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, 3), text, 0, 1, 0, 0);
}
static void PrintSkillsPageText(void)
@@ -3270,7 +3269,7 @@ static void PrintHeldItemName(void)
}
offset = GetStringCenterAlignXOffset(1, text, 72) + 6;
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 0), text, offset, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, 0), text, offset, 1, 0, 0);
}
static void PrintRibbonCount(void)
@@ -3290,7 +3289,7 @@ static void PrintRibbonCount(void)
}
offset = GetStringCenterAlignXOffset(1, text, 70) + 6;
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 1), text, offset, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, 1), text, offset, 1, 0, 0);
}
static void BufferLeftColumnStats(void)
@@ -3310,7 +3309,7 @@ static void BufferLeftColumnStats(void)
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, maxHPString);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, attackString);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, defenseString);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE82);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsLeftColumnLayout);
Free(currentHPString);
Free(maxHPString);
@@ -3320,7 +3319,7 @@ static void BufferLeftColumnStats(void)
static void PrintLeftColumnStats(void)
{
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, 2), gStringVar4, 4, 1, 0, 0);
}
static void BufferRightColumnStats(void)
@@ -3333,18 +3332,18 @@ static void BufferRightColumnStats(void)
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gStringVar3);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE8E);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sStatsRightColumnLayout);
}
static void PrintRightColumnStats(void)
{
- SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0);
+ SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageSkillsTemplate, 3), gStringVar4, 2, 1, 0, 0);
}
static void PrintExpPointsNextLevel(void)
{
struct PokeSummary *sum = &pssData->summary;
- u8 windowId = AddWindowFromTemplateList(gUnknown_0861CCEC, 4);
+ u8 windowId = AddWindowFromTemplateList(sPageSkillsTemplate, 4);
int offset;
u32 expToNextLevel;
@@ -3436,8 +3435,8 @@ static void PrintMoveNameAndPP(u8 moveIndex)
const u8 *text;
u32 offset;
struct PssData *summaryStruct = pssData;
- u8 moveNameWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
- u8 ppValueWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 1);
+ u8 moveNameWindowId = AddWindowFromTemplateList(sPageMovesTemplate, 0);
+ u8 ppValueWindowId = AddWindowFromTemplateList(sPageMovesTemplate, 1);
u16 move = summaryStruct->summary.moves[moveIndex];
if (move != 0)
@@ -3449,7 +3448,7 @@ static void PrintMoveNameAndPP(u8 moveIndex)
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sMovesPPLayout);
text = gStringVar4;
ppState = GetCurrentPpToMaxPpState(summaryStruct->summary.pp[moveIndex], pp) + 9;
offset = GetStringRightAlignXOffset(1, text, 44);
@@ -3560,14 +3559,14 @@ static void PrintContestMoveDescription(u8 moveSlot)
if (move != MOVE_NONE)
{
- u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2);
+ u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 2);
SummaryScreen_PrintTextOnWindow(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0);
}
}
static void PrintMoveDetails(u16 move)
{
- u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2);
+ u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 2);
FillWindowPixelBuffer(windowId, 0);
if (move != MOVE_NONE)
{
@@ -3592,8 +3591,8 @@ static void PrintMoveDetails(u16 move)
static void PrintNewMoveDetailsOrCancelText(void)
{
- u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
- u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1);
+ u8 windowId1 = AddWindowFromTemplateList(sPageMovesTemplate, 0);
+ u8 windowId2 = AddWindowFromTemplateList(sPageMovesTemplate, 1);
if (pssData->newMove == MOVE_NONE)
{
@@ -3612,22 +3611,22 @@ static void PrintNewMoveDetailsOrCancelText(void)
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar1);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, sMovesPPLayout);
SummaryScreen_PrintTextOnWindow(windowId2, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x2C), 0x41, 0, 12);
}
}
static void sub_81C4064(void)
{
- u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
+ u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 0);
FillWindowPixelRect(windowId, 0, 0, 66, 72, 16);
CopyWindowToVram(windowId, 2);
}
static void sub_81C40A0(u8 moveIndex1, u8 moveIndex2)
{
- u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
- u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1);
+ u8 windowId1 = AddWindowFromTemplateList(sPageMovesTemplate, 0);
+ u8 windowId2 = AddWindowFromTemplateList(sPageMovesTemplate, 1);
FillWindowPixelRect(windowId1, 0, 0, moveIndex1 * 16, 0x48, 0x10);
FillWindowPixelRect(windowId1, 0, 0, moveIndex2 * 16, 0x48, 0x10);
@@ -3641,7 +3640,7 @@ static void sub_81C40A0(u8 moveIndex1, u8 moveIndex2)
static void PrintHMMovesCantBeForgotten(void)
{
- u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2);
+ u8 windowId = AddWindowFromTemplateList(sPageMovesTemplate, 2);
FillWindowPixelBuffer(windowId, 0);
SummaryScreen_PrintTextOnWindow(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0);
}
@@ -3942,14 +3941,14 @@ static bool32 SummaryScreen_DoesSpriteHaveCallback(void)
}
}
-static void sub_81C48F0(void)
+static void StopPokemonAnimations(void) // A subtle effect, this function stops pokemon animations when leaving the PSS
{
u16 i;
u16 paletteIndex;
gSprites[pssData->spriteIds[0]].animPaused = TRUE;
gSprites[pssData->spriteIds[0]].callback = SpriteCallbackDummy;
- sub_806EE98();
+ StopPokemonAnimationDelayTask();
paletteIndex = (gSprites[pssData->spriteIds[0]].oam.paletteNum * 16) | 0x100;
@@ -3961,7 +3960,7 @@ static void sub_81C48F0(void)
static void CreateMonMarkingsSprite(struct Pokemon *mon)
{
- struct Sprite *sprite = sub_811FF94(30003, 30003, gUnknown_0861D120);
+ struct Sprite *sprite = sub_811FF94(30003, 30003, sSummaryMarkingsPalette);
pssData->markingsSprite = sprite;
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/start_menu.c b/src/start_menu.c
index d5eec76d2..6efd7a04a 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -91,7 +91,7 @@ extern void sub_80AF688(void);
extern void var_800D_set_xB(void);
extern void sub_808B864(void);
extern void CB2_Pokedex(void);
-extern void PlayRainSoundEffect(void);
+extern void PlayRainStoppingSoundEffect(void);
extern void CB2_PokeNav(void);
extern void ScriptUnfreezeEventObjects(void);
extern void save_serialize_map(void);
@@ -608,7 +608,7 @@ static bool8 StartMenuPokedexCallback(void)
if (!gPaletteFade.active)
{
IncrementGameStat(GAME_STAT_CHECKED_POKEDEX);
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_Pokedex);
@@ -623,7 +623,7 @@ static bool8 StartMenuPokemonCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_PartyMenuFromStartMenu); // Display party menu
@@ -638,7 +638,7 @@ static bool8 StartMenuBagCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_BagMenuFromStartMenu); // Display bag menu
@@ -653,7 +653,7 @@ static bool8 StartMenuPokeNavCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_PokeNav); // Display PokeNav
@@ -668,7 +668,7 @@ static bool8 StartMenuPlayerNameCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
@@ -699,7 +699,7 @@ static bool8 StartMenuOptionCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_InitOptionMenu); // Display option menu
@@ -732,7 +732,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
CleanupOverworldWindowsAndTilemaps();
ShowTrainerCardInLink(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu);
@@ -761,7 +761,7 @@ static bool8 StartMenuBattlePyramidBagCallback(void)
{
if (!gPaletteFade.active)
{
- PlayRainSoundEffect();
+ PlayRainStoppingSoundEffect();
RemoveExtraStartMenuWindows();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_PyramidBagMenuFromStartMenu);
diff --git a/src/trade.c b/src/trade.c
index 70b57fbc7..6dfb6e2c4 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -1834,9 +1834,9 @@ static void sub_8077B74(void)
}
if (gUnknown_0203229C->tradeMenuCursorPosition < PARTY_SIZE)
- gUnknown_0203229C->tradeMenuCursorPosition = gUnknown_0203CF20;
+ gUnknown_0203229C->tradeMenuCursorPosition = gLastViewedMonIndex;
else
- gUnknown_0203229C->tradeMenuCursorPosition = gUnknown_0203CF20 + PARTY_SIZE;
+ gUnknown_0203229C->tradeMenuCursorPosition = gLastViewedMonIndex + PARTY_SIZE;
gUnknown_0203229C->tradeMenuCursorSpriteIdx = CreateSprite(&gSpriteTemplate_832DC94, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][0] * 8 + 32, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][1] * 8, 2);
gMain.state = 16;
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);
}