diff options
-rw-r--r-- | data/event_scripts.s | 8 | ||||
-rw-r--r-- | data/maps/SkyPillar_Outside/scripts.inc | 2 | ||||
-rw-r--r-- | data/maps/SootopolisCity/scripts.inc | 4 | ||||
-rw-r--r-- | data/specials.inc | 2 | ||||
-rw-r--r-- | include/constants/weather.h | 2 | ||||
-rw-r--r-- | include/field_weather.h | 10 | ||||
-rwxr-xr-x | src/cable_car.c | 8 | ||||
-rw-r--r-- | src/egg_hatch.c | 2 | ||||
-rw-r--r-- | src/field_screen_effect.c | 10 | ||||
-rw-r--r-- | src/field_specials.c | 5 | ||||
-rw-r--r-- | src/field_weather.c | 15 | ||||
-rw-r--r-- | src/field_weather_effect.c | 71 | ||||
-rw-r--r-- | src/overworld.c | 2 | ||||
-rw-r--r-- | src/start_menu.c | 18 |
14 files changed, 81 insertions, 78 deletions
diff --git a/data/event_scripts.s b/data/event_scripts.s index 1b8807ed7..4e7fa1622 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -2031,7 +2031,7 @@ Route130_EventScript_27207A:: @ 827207A Route131_EventScript_27207A:: @ 827207A SkyPillar_Outside_EventScript_27207A:: @ 827207A SootopolisCity_EventScript_27207A:: @ 827207A - setweather 15 + setweather WEATHER_ALTERNATING return DewfordTown_Gym_EventScript_27207E:: @ 827207E @@ -3655,14 +3655,14 @@ Route105_EventScript_273D17:: @ 8273D17 Route125_EventScript_273D17:: @ 8273D17 Route127_EventScript_273D17:: @ 8273D17 Route129_EventScript_273D17:: @ 8273D17 - setweather 13 + setweather WEATHER_RAIN_HEAVY return Route114_EventScript_273D1B:: @ 8273D1B Route115_EventScript_273D1B:: @ 8273D1B Route116_EventScript_273D1B:: @ 8273D1B Route118_EventScript_273D1B:: @ 8273D1B - setweather 12 + setweather WEATHER_DROUGHT return gUnknown_08273D1F:: @ 8273D1F @@ -3677,7 +3677,7 @@ gUnknown_08273D1F:: @ 8273D1F Route105_EventScript_273D31:: @ 8273D31 closemessage fadescreenswapbuffers 1 - setweather 2 + setweather WEATHER_SUNNY doweather call Route105_EventScript_273D6D special DrawWholeMapView diff --git a/data/maps/SkyPillar_Outside/scripts.inc b/data/maps/SkyPillar_Outside/scripts.inc index eb57d1227..abf8a6730 100644 --- a/data/maps/SkyPillar_Outside/scripts.inc +++ b/data/maps/SkyPillar_Outside/scripts.inc @@ -72,7 +72,7 @@ SkyPillar_Outside_EventScript_239304:: @ 8239304 msgbox SkyPillar_Outside_Text_23950C, MSGBOX_DEFAULT closemessage setflag FLAG_SYS_WEATHER_CTRL - setweather WEATHER_15 + setweather WEATHER_ALTERNATING doweather special WaitWeather waitstate diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc index 1cd4611e9..3ec8ebb80 100644 --- a/data/maps/SootopolisCity/scripts.inc +++ b/data/maps/SootopolisCity/scripts.inc @@ -214,7 +214,7 @@ SootopolisCity_EventScript_1E5946:: @ 81E5946 special RemoveCameraObject delay 60 fadescreenspeed 1, 8 - setweather WEATHER_15 + setweather WEATHER_ALTERNATING doweather setvar VAR_0x8004, 0 special sub_813B7D8 @@ -314,7 +314,7 @@ SootopolisCity_EventScript_1E5A82:: @ 81E5A82 special RemoveCameraObject delay 60 fadescreenspeed 1, 8 - setweather WEATHER_15 + setweather WEATHER_ALTERNATING doweather setvar VAR_0x8004, 0 special sub_813B7D8 diff --git a/data/specials.inc b/data/specials.inc index cbbd81dc1..965bef117 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -503,7 +503,7 @@ gSpecials:: @ 81DBA64 def_special sub_813B374 def_special sub_813B490 def_special sub_80A08CC - def_special sub_813B484 + def_special Unused_SetWeatherSunny def_special sub_81AFDA0 def_special sub_813B4E0 def_special ShouldDoBrailleRegicePuzzle diff --git a/include/constants/weather.h b/include/constants/weather.h index d0a81c34c..d62e07474 100644 --- a/include/constants/weather.h +++ b/include/constants/weather.h @@ -16,7 +16,7 @@ #define WEATHER_DROUGHT 12 #define WEATHER_RAIN_HEAVY 13 #define WEATHER_BUBBLES 14 -#define WEATHER_15 15 +#define WEATHER_ALTERNATING 15 #define WEATHER_ROUTE119_CYCLE 20 #define WEATHER_ROUTE123_CYCLE 21 diff --git a/include/field_weather.h b/include/field_weather.h index 2d73f2b94..ced8e255c 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -140,9 +140,9 @@ extern const u16 gUnknown_083970E8[]; extern const u8 gWeatherFog1Tiles[]; void StartWeather(void); -void ChangeWeather(u8 weather); -void sub_80AB104(u8 weather); -void sub_80AB130(u8 weather); +void SetNextWeather(u8 weather); +void SetCurrentAndNextWeather(u8 weather); +void SetCurrentAndNextWeatherNoDelay(u8 weather); void sub_80ABC48(s8 gammaIndex); void sub_80ABC7C(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay); void FadeScreen(u8 mode, s8 delay); @@ -162,7 +162,7 @@ bool8 Weather_UpdateBlend(void); void sub_80AC274(u8 a); u8 GetCurrentWeather(void); void SetRainStrengthFromSoundEffect(u16 soundEffect); -void PlayRainSoundEffect(void); +void PlayRainStoppingSoundEffect(void); u8 IsWeatherChangeComplete(void); void SetWeatherScreenFadeOut(void); void sub_80AC3E4(void); @@ -233,6 +233,6 @@ void SetSav1WeatherFromCurrMapHeader(void); void SetWeather(u32 weather); void DoCurrentWeather(void); void UpdateWeatherPerDay(u16 increment); -void sub_80AEE84(void); +void DoPausedWeather(void); #endif // GUARD_WEATHER_H 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); |