Fix overworld snow weather

This commit is contained in:
kittenchilly 2023-08-19 01:40:31 -05:00
parent 5b885a4ddb
commit 0ad3919f22
5 changed files with 24 additions and 29 deletions

View file

@ -202,6 +202,7 @@
#define B_TRAINER_CLASS_POKE_BALLS GEN_LATEST // In Gen7+, trainers will use certain types of Poké Balls depending on their trainer class.
#define B_OBEDIENCE_MECHANICS GEN_7 // In PLA+ (here Gen8+), obedience restrictions also apply to non-outsider Pokémon, albeit based on their level met rather than actual level
#define B_USE_FROSTBITE FALSE // In PLA, Frostbite replaces Freeze. Enabling this flag does the same here. Moves can still be cherry-picked to either Freeze or Frostbite. Freeze-Dry, Secret Power & Tri Attack depend on this config.
#define B_OVERWORLD_SNOW GEN_LATEST // In Gen9+, overworld Snow will summon snow instead of hail.
// Animation Settings
#define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle.

View file

@ -1838,7 +1838,11 @@ const u16 gWeatherStartsStringIds[] =
[WEATHER_SUNNY_CLOUDS] = STRINGID_ITISRAINING,
[WEATHER_SUNNY] = STRINGID_ITISRAINING,
[WEATHER_RAIN] = STRINGID_ITISRAINING,
[WEATHER_SNOW] = STRINGID_ITISRAINING,
#if B_OVERWORLD_SNOW >= GEN_9
[WEATHER_SNOW] = STRINGID_STARTEDSNOW,
#else
[WEATHER_SNOW] = STRINGID_STARTEDHAIL,
#endif
[WEATHER_RAIN_THUNDERSTORM] = STRINGID_ITISRAINING,
[WEATHER_FOG_HORIZONTAL] = STRINGID_ITISRAINING,
[WEATHER_VOLCANIC_ASH] = STRINGID_ITISRAINING,

View file

@ -4238,6 +4238,21 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
break;
case WEATHER_SNOW:
if (!(gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)))
{
#if B_OVERWORLD_SNOW >= GEN_9
gBattleWeather = B_WEATHER_SNOW;
gBattleScripting.animArg1 = B_ANIM_SNOW_CONTINUES;
effect++;
#else
gBattleWeather = B_WEATHER_HAIL;
gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES;
effect++;
#endif
}
break;
}
}
if (effect != 0)

View file

@ -16,6 +16,7 @@
#include "task.h"
#include "trig.h"
#include "gpu_regs.h"
#include "field_camera.h"
#define DROUGHT_COLOR_INDEX(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00))
@ -219,6 +220,7 @@ static void Task_WeatherInit(u8 taskId)
// When the screen fades in, this is set to TRUE.
if (gWeatherPtr->readyForInit)
{
UpdateCameraPanning();
sWeatherFuncs[gWeatherPtr->currWeather].initAll();
gTasks[taskId].func = Task_WeatherMain;
}

View file

@ -940,8 +940,7 @@ static void InitSnowflakeSpriteMovement(struct Sprite *sprite)
static void WaitSnowflakeSprite(struct Sprite *sprite)
{
// Timer is never incremented
if (gWeatherPtr->snowflakeTimer > 18)
if (++gWeatherPtr->snowflakeTimer > 18)
{
sprite->invisible = FALSE;
sprite->callback = UpdateSnowflakeSprite;
@ -970,32 +969,6 @@ static void UpdateSnowflakeSprite(struct Sprite *sprite)
sprite->x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
else if (x > 242)
sprite->x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
y = (sprite->y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF;
if (y > 163 && y < 171)
{
sprite->y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY);
sprite->tPosY = sprite->y * 128;
sprite->tFallCounter = 0;
sprite->tFallDuration = 220;
}
else if (y > 242 && y < 250)
{
sprite->y = 163;
sprite->tPosY = sprite->y * 128;
sprite->tFallCounter = 0;
sprite->tFallDuration = 220;
sprite->invisible = TRUE;
sprite->callback = WaitSnowflakeSprite;
}
if (++sprite->tFallCounter == sprite->tFallDuration)
{
InitSnowflakeSpriteMovement(sprite);
sprite->y = 250;
sprite->invisible = TRUE;
sprite->callback = WaitSnowflakeSprite;
}
}
#undef tPosY