summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhlosioneer <mattmdrr2@gmail.com>2019-02-22 22:20:42 -0500
committerPhlosioneer <mattmdrr2@gmail.com>2019-02-22 22:20:42 -0500
commitb2866fae2126012f7d7b4db8b60e07ba344a5f97 (patch)
treecde82302278e417e69bbb45e90bba3f77edd2ac3 /src
parentb105d20d1e0297d0c858fe99a0946e5c07da81c1 (diff)
Document the weather state functions
All weather types are now documented (including WEATHER_15)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/cable_car.c8
-rw-r--r--src/egg_hatch.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.c71
-rw-r--r--src/overworld.c2
-rw-r--r--src/start_menu.c18
8 files changed, 67 insertions, 64 deletions
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/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_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..b81a8f5d2 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 DoPausedWeather(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[] =
@@ -2449,7 +2450,7 @@ static u8 TranslateWeatherNum(u8 weather)
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_ALTERNATING: return WEATHER_ALTERNATING;
case WEATHER_ROUTE119_CYCLE: return sWeatherCycleRoute119[gSaveBlock1Ptr->weatherCycleStage];
case WEATHER_ROUTE123_CYCLE: return sWeatherCycleRoute123[gSaveBlock1Ptr->weatherCycleStage];
default: return WEATHER_NONE;
diff --git a/src/overworld.c b/src/overworld.c
index 08fd94c1b..6f973f16b 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -2123,7 +2123,7 @@ static void sub_8086988(u32 a1)
FieldEffectActiveListClear();
StartWeather();
- sub_80AEE84();
+ DoPausedWeather();
if (!a1)
SetUpFieldTasks();
mapheader_run_script_with_tag_x5();
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);