Fix overworld snow weather + make overworld fog cause misty terrain (#3241)

This commit is contained in:
ghoulslash 2023-09-11 09:28:44 -04:00 committed by GitHub
commit b861f6dd9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 33 deletions

View File

@ -170,6 +170,7 @@
// Terrain settings
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
#define B_THUNDERSTORM_TERRAIN TRUE // If TRUE, overworld Thunderstorm generates Rain and Electric Terrain as in Gen 8.
#define B_FOG_TERRAIN TRUE // If TRUE, overworld Fog generates Misty Terrain as in Gen 8.
#define B_TERRAIN_TYPE_BOOST GEN_LATEST // In Gen8, damage is boosted by 30% instead of 50%.
#define B_SECRET_POWER_EFFECT GEN_LATEST // Secret Power's effects change depending on terrain and generation. See GetSecretPowerMoveEffect.
#define B_SECRET_POWER_ANIMATION GEN_LATEST // Secret Power's animations change depending on terrain and generation.
@ -204,6 +205,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

@ -1845,7 +1845,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

@ -4195,6 +4195,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
#endif
#if B_FOG_TERRAIN == TRUE
else if ((GetCurrentWeather() == WEATHER_FOG_HORIZONTAL || GetCurrentWeather() == WEATHER_FOG_DIAGONAL) && !(gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN))
{
gFieldStatuses = (STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain);
effect++;
}
#endif
break;
case ABILITYEFFECT_SWITCH_IN_WEATHER:
gBattleScripting.battler = battler;
@ -4228,6 +4237,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;
}
@ -380,7 +382,6 @@ static void FadeInScreenWithWeather(void)
case WEATHER_RAIN:
case WEATHER_RAIN_THUNDERSTORM:
case WEATHER_DOWNPOUR:
case WEATHER_SNOW:
case WEATHER_SHADE:
if (FadeInScreen_RainShowShade() == FALSE)
{
@ -402,6 +403,7 @@ static void FadeInScreenWithWeather(void)
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_IDLE;
}
break;
case WEATHER_SNOW:
case WEATHER_VOLCANIC_ASH:
case WEATHER_SANDSTORM:
case WEATHER_FOG_DIAGONAL:
@ -772,7 +774,6 @@ void FadeScreen(u8 mode, s8 delay)
case WEATHER_RAIN:
case WEATHER_RAIN_THUNDERSTORM:
case WEATHER_DOWNPOUR:
case WEATHER_SNOW:
case WEATHER_FOG_HORIZONTAL:
case WEATHER_SHADE:
case WEATHER_DROUGHT:

View File

@ -768,7 +768,7 @@ void Snow_InitVars(void)
{
gWeatherPtr->initStep = 0;
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->targetColorMapIndex = 3;
gWeatherPtr->targetColorMapIndex = 0;
gWeatherPtr->colorMapStepDelay = 20;
gWeatherPtr->targetSnowflakeSpriteCount = 16;
gWeatherPtr->snowflakeVisibleCounter = 0;
@ -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