Update old weather names in field_weather_effect

This commit is contained in:
GriffinR 2019-12-06 13:25:45 -05:00 committed by huderlem
parent 955bfe3f5c
commit 7f22fc9879
7 changed files with 224 additions and 230 deletions

View File

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 928 B

View File

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1018 B

View File

@ -5,14 +5,14 @@
#define WEATHER_SUNNY_CLOUDS 1
#define WEATHER_SUNNY 2
#define WEATHER_RAIN 3
#define WEATHER_SNOW 4
#define WEATHER_SNOW 4 // Unused
#define WEATHER_RAIN_THUNDERSTORM 5
#define WEATHER_FOG_HORIZONTAL 6
#define WEATHER_VOLCANIC_ASH 7
#define WEATHER_SANDSTORM 8
#define WEATHER_FOG_DIAGONAL 9
#define WEATHER_UNDERWATER 10
#define WEATHER_SHADE 11 // original name was closer to WEATHER_CLOUDY/OVERCAST
#define WEATHER_FOG_DIAGONAL 9 // Unused
#define WEATHER_UNDERWATER 10 // Unused
#define WEATHER_SHADE 11 // Original name was closer to WEATHER_CLOUDY/OVERCAST
#define WEATHER_DROUGHT 12
#define WEATHER_DOWNPOUR 13
#define WEATHER_UNDERWATER_BUBBLES 14

View File

@ -5,9 +5,9 @@
#define MAX_RAIN_SPRITES 24
#define NUM_CLOUD_SPRITES 3
#define NUM_FOG1_SPRITES 20
#define NUM_FOG_HORIZONTAL_SPRITES 20
#define NUM_ASH_SPRITES 20
#define NUM_FOG2_SPRITES 20
#define NUM_FOG_DIAGONAL_SPRITES 20
#define NUM_SANDSTORM_SPRITES 20
#define NUM_SWIRL_SANDSTORM_SPRITES 5
@ -42,9 +42,9 @@ struct Weather
struct
{
u8 filler0[0xA0];
struct Sprite *fog1Sprites[NUM_FOG1_SPRITES];
struct Sprite *fogHSprites[NUM_FOG_HORIZONTAL_SPRITES];
struct Sprite *ashSprites[NUM_ASH_SPRITES];
struct Sprite *fog2Sprites[NUM_FOG2_SPRITES];
struct Sprite *fogDSprites[NUM_FOG_DIAGONAL_SPRITES];
struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES];
struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES];
} s2;
@ -75,7 +75,7 @@ struct Weather
u8 targetRainSpriteCount;
u8 rainSpriteCount;
u8 rainSpriteVisibleDelay;
u8 isHeavyRain;
u8 isDownpour;
u8 rainStrength;
/*0x6DE*/ u8 cloudSpritesCreated;
u8 filler_6DF[1];
@ -89,12 +89,12 @@ struct Weather
u8 unknown_6EB;
u8 unknown_6EC;
u8 thunderTriggered;
u16 fog1ScrollPosX;
u16 fog1ScrollCounter;
u16 fog1ScrollOffset;
u16 fogHScrollPosX;
u16 fogHScrollCounter;
u16 fogHScrollOffset;
u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount;
u8 fog1SpritesCreated;
u8 fogHSpritesCreated;
u16 ashBaseSpritesX;
u16 unknown_6FE;
u8 ashSpritesCreated;
@ -108,13 +108,13 @@ struct Weather
u16 sandstormWaveCounter;
u8 sandstormSpritesCreated;
u8 sandstormSwirlSpritesCreated;
u16 fog2BaseSpritesX;
u16 fog2PosY;
u16 fog2ScrollXCounter;
u16 fog2ScrollYCounter;
u16 fog2XOffset;
u16 fog2YOffset;
u8 fog2SpritesCreated;
u16 fogDBaseSpritesX;
u16 fogDPosY;
u16 fogDScrollXCounter;
u16 fogDScrollYCounter;
u16 fogDXOffset;
u16 fogDYOffset;
u8 fogDSpritesCreated;
u8 filler_725[1];
u16 bubblesDelayCounter;
u16 bubblesDelayIndex;
@ -145,7 +145,7 @@ extern struct Weather *const gWeatherPtr;
extern const u16 gUnknown_083970E8[];
// field_weather_effect.c
extern const u8 gWeatherFog1Tiles[];
extern const u8 gWeatherFogHorizontalTiles[];
void StartWeather(void);
void SetNextWeather(u8 weather);
@ -186,22 +186,22 @@ void Sunny_InitVars(void);
void Sunny_Main(void);
void Sunny_InitAll(void);
bool8 Sunny_Finish(void);
void LightRain_InitVars(void);
void LightRain_Main(void);
void LightRain_InitAll(void);
bool8 LightRain_Finish(void);
void Rain_InitVars(void);
void Rain_Main(void);
void Rain_InitAll(void);
bool8 Rain_Finish(void);
void Snow_InitVars(void);
void Snow_Main(void);
void Snow_InitAll(void);
bool8 Snow_Finish(void);
void MedRain_InitVars(void);
void Rain_Main(void);
void MedRain_InitAll(void);
bool8 Rain_Finish(void);
void Fog1_InitVars(void);
void Fog1_Main(void);
void Fog1_InitAll(void);
bool8 Fog1_Finish(void);
void Thunderstorm_InitVars(void);
void Thunderstorm_Main(void);
void Thunderstorm_InitAll(void);
bool8 Thunderstorm_Finish(void);
void FogHorizontal_InitVars(void);
void FogHorizontal_Main(void);
void FogHorizontal_InitAll(void);
bool8 FogHorizontal_Finish(void);
void Ash_InitVars(void);
void Ash_Main(void);
void Ash_InitAll(void);
@ -210,14 +210,10 @@ void Sandstorm_InitVars(void);
void Sandstorm_Main(void);
void Sandstorm_InitAll(void);
bool8 Sandstorm_Finish(void);
void Fog2_InitVars(void);
void Fog2_Main(void);
void Fog2_InitAll(void);
bool8 Fog2_Finish(void);
void Fog1_InitVars(void);
void Fog1_Main(void);
void Fog1_InitAll(void);
bool8 Fog1_Finish(void);
void FogDiagonal_InitVars(void);
void FogDiagonal_Main(void);
void FogDiagonal_InitAll(void);
bool8 FogDiagonal_Finish(void);
void Shade_InitVars(void);
void Shade_Main(void);
void Shade_InitAll(void);
@ -226,10 +222,8 @@ void Drought_InitVars(void);
void Drought_Main(void);
void Drought_InitAll(void);
bool8 Drought_Finish(void);
void HeavyRain_InitVars(void);
void Rain_Main(void);
void HeavyRain_InitAll(void);
bool8 Rain_Finish(void);
void Downpour_InitVars(void);
void Downpour_InitAll(void);
void Bubbles_InitVars(void);
void Bubbles_Main(void);
void Bubbles_InitAll(void);

View File

@ -56,7 +56,7 @@ static void ApplyDroughtGammaShiftWithBlend(s8 gammaIndex, u8 blendCoeff, u16 bl
static void ApplyFogBlend(u8 blendCoeff, u16 blendColor);
static bool8 FadeInScreen_RainShowShade(void);
static bool8 FadeInScreen_Drought(void);
static bool8 FadeInScreen_Fog1(void);
static bool8 FadeInScreen_FogHorizontal(void);
static void FadeInScreenWithWeather(void);
static void DoNothing(void);
static void Task_WeatherInit(u8 taskId);
@ -89,29 +89,29 @@ struct Weather *const gWeatherPtr = &gWeather;
static const struct WeatherCallbacks sWeatherFuncs[] =
{
{None_Init, None_Main, None_Init, None_Finish},
{Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_Finish},
{Sunny_InitVars, Sunny_Main, Sunny_InitAll, Sunny_Finish},
{LightRain_InitVars, LightRain_Main, LightRain_InitAll, LightRain_Finish},
{Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish},
{MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish},
{Fog1_InitVars, Fog1_Main, Fog1_InitAll, Fog1_Finish},
{Ash_InitVars, Ash_Main, Ash_InitAll, Ash_Finish},
{Sandstorm_InitVars, Sandstorm_Main, Sandstorm_InitAll, Sandstorm_Finish},
{Fog2_InitVars, Fog2_Main, Fog2_InitAll, Fog2_Finish},
{Fog1_InitVars, Fog1_Main, Fog1_InitAll, Fog1_Finish},
{Shade_InitVars, Shade_Main, Shade_InitAll, Shade_Finish},
{Drought_InitVars, Drought_Main, Drought_InitAll, Drought_Finish},
{HeavyRain_InitVars, Rain_Main, HeavyRain_InitAll, Rain_Finish},
{Bubbles_InitVars, Bubbles_Main, Bubbles_InitAll, Bubbles_Finish},
[WEATHER_NONE] = {None_Init, None_Main, None_Init, None_Finish},
[WEATHER_SUNNY_CLOUDS] = {Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_Finish},
[WEATHER_SUNNY] = {Sunny_InitVars, Sunny_Main, Sunny_InitAll, Sunny_Finish},
[WEATHER_RAIN] = {Rain_InitVars, Rain_Main, Rain_InitAll, Rain_Finish},
[WEATHER_SNOW] = {Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish},
[WEATHER_RAIN_THUNDERSTORM] = {Thunderstorm_InitVars, Thunderstorm_Main, Thunderstorm_InitAll, Thunderstorm_Finish},
[WEATHER_FOG_HORIZONTAL] = {FogHorizontal_InitVars, FogHorizontal_Main, FogHorizontal_InitAll, FogHorizontal_Finish},
[WEATHER_VOLCANIC_ASH] = {Ash_InitVars, Ash_Main, Ash_InitAll, Ash_Finish},
[WEATHER_SANDSTORM] = {Sandstorm_InitVars, Sandstorm_Main, Sandstorm_InitAll, Sandstorm_Finish},
[WEATHER_FOG_DIAGONAL] = {FogDiagonal_InitVars, FogDiagonal_Main, FogDiagonal_InitAll, FogDiagonal_Finish},
[WEATHER_UNDERWATER] = {FogHorizontal_InitVars, FogHorizontal_Main, FogHorizontal_InitAll, FogHorizontal_Finish},
[WEATHER_SHADE] = {Shade_InitVars, Shade_Main, Shade_InitAll, Shade_Finish},
[WEATHER_DROUGHT] = {Drought_InitVars, Drought_Main, Drought_InitAll, Drought_Finish},
[WEATHER_DOWNPOUR] = {Downpour_InitVars, Thunderstorm_Main, Downpour_InitAll, Thunderstorm_Finish},
[WEATHER_UNDERWATER_BUBBLES] = {Bubbles_InitVars, Bubbles_Main, Bubbles_InitAll, Bubbles_Finish},
};
void (*const gWeatherPalStateFuncs[])(void) =
{
UpdateWeatherGammaShift, // WEATHER_PAL_STATE_CHANGING_WEATHER
FadeInScreenWithWeather, // WEATHER_PAL_STATE_SCREEN_FADING_IN
DoNothing, // WEATHER_PAL_STATE_SCREEN_FADING_OUT
DoNothing, // WEATHER_PAL_STATE_IDLE
[WEATHER_PAL_STATE_CHANGING_WEATHER] = UpdateWeatherGammaShift,
[WEATHER_PAL_STATE_SCREEN_FADING_IN] = FadeInScreenWithWeather,
[WEATHER_PAL_STATE_SCREEN_FADING_OUT] = DoNothing,
[WEATHER_PAL_STATE_IDLE] = DoNothing,
};
// This table specifies which of the gamma shift tables should be
@ -171,8 +171,8 @@ void StartWeather(void)
gWeatherPtr->cloudSpritesCreated = 0;
gWeatherPtr->snowflakeSpriteCount = 0;
gWeatherPtr->ashSpritesCreated = 0;
gWeatherPtr->fog1SpritesCreated = 0;
gWeatherPtr->fog2SpritesCreated = 0;
gWeatherPtr->fogHSpritesCreated = 0;
gWeatherPtr->fogDSpritesCreated = 0;
gWeatherPtr->sandstormSpritesCreated = 0;
gWeatherPtr->sandstormSwirlSpritesCreated = 0;
gWeatherPtr->bubblesSpritesCreated = 0;
@ -390,7 +390,7 @@ static void FadeInScreenWithWeather(void)
}
break;
case WEATHER_FOG_HORIZONTAL:
if (FadeInScreen_Fog1() == FALSE)
if (FadeInScreen_FogHorizontal() == FALSE)
{
gWeatherPtr->gammaIndex = 0;
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_IDLE;
@ -442,7 +442,7 @@ static bool8 FadeInScreen_Drought(void)
return TRUE;
}
static bool8 FadeInScreen_Fog1(void)
static bool8 FadeInScreen_FogHorizontal(void)
{
if (gWeatherPtr->fadeScreenCounter == 16)
return FALSE;

View File

@ -20,8 +20,8 @@ EWRAM_DATA static u16 gUnusedWeatherRelated = 0;
// CONST
const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal");
const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal");
const u8 gWeatherFog2Tiles[] = INCBIN_U8("graphics/weather/fog2.4bpp");
const u8 gWeatherFog1Tiles[] = INCBIN_U8("graphics/weather/fog1.4bpp");
const u8 gWeatherFogDiagonalTiles[] = INCBIN_U8("graphics/weather/fog_diagonal.4bpp");
const u8 gWeatherFogHorizontalTiles[] = INCBIN_U8("graphics/weather/fog_horizontal.4bpp");
const u8 gWeatherCloudTiles[] = INCBIN_U8("graphics/weather/cloud.4bpp");
const u8 gWeatherSnow1Tiles[] = INCBIN_U8("graphics/weather/snow0.4bpp");
const u8 gWeatherSnow2Tiles[] = INCBIN_U8("graphics/weather/snow1.4bpp");
@ -31,7 +31,7 @@ const u8 gWeatherRainTiles[] = INCBIN_U8("graphics/weather/rain.4bpp");
const u8 gWeatherSandstormTiles[] = INCBIN_U8("graphics/weather/sandstorm.4bpp");
//------------------------------------------------------------------------------
// Clouds
// WEATHER_SUNNY_CLOUDS
//------------------------------------------------------------------------------
static void CreateCloudSprites(void);
@ -227,7 +227,7 @@ static void UpdateCloudSprite(struct Sprite *sprite)
}
//------------------------------------------------------------------------------
// Drought
// WEATHER_DROUGHT
//------------------------------------------------------------------------------
static void UpdateDroughtBlend(u8);
@ -352,7 +352,7 @@ static void UpdateDroughtBlend(u8 taskId)
#undef tWinRange
//------------------------------------------------------------------------------
// Light Rain
// WEATHER_RAIN
//------------------------------------------------------------------------------
static void LoadRainSpriteSheet(void);
@ -469,27 +469,27 @@ static const struct SpriteSheet sRainSpriteSheet =
.tag = 0x1206,
};
void LightRain_InitVars(void)
void Rain_InitVars(void)
{
gWeatherPtr->initStep = 0;
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->rainSpriteVisibleCounter = 0;
gWeatherPtr->rainSpriteVisibleDelay = 8;
gWeatherPtr->isHeavyRain = 0;
gWeatherPtr->isDownpour = FALSE;
gWeatherPtr->targetRainSpriteCount = 10;
gWeatherPtr->gammaTargetIndex = 3;
gWeatherPtr->gammaStepDelay = 20;
SetRainStrengthFromSoundEffect(SE_T_KOAME);
}
void LightRain_InitAll(void)
void Rain_InitAll(void)
{
LightRain_InitVars();
Rain_InitVars();
while (!gWeatherPtr->weatherGfxLoaded)
LightRain_Main();
Rain_Main();
}
void LightRain_Main(void)
void Rain_Main(void)
{
switch (gWeatherPtr->initStep)
{
@ -511,7 +511,7 @@ void LightRain_Main(void)
}
}
bool8 LightRain_Finish(void)
bool8 Rain_Finish(void)
{
switch (gWeatherPtr->finishStep)
{
@ -563,7 +563,7 @@ static void StartRainSpriteFall(struct Sprite *sprite)
rand = sprite->tRandom * 1103515245 + 12345;
sprite->tRandom = ((rand & 0x7FFF0000) >> 16) % 600;
numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][0];
numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isDownpour][0];
tileX = sprite->tRandom % 30;
sprite->tPosX = tileX * 8; // Useless assignment, leftover from before fixed-point values were used
@ -578,8 +578,8 @@ static void StartRainSpriteFall(struct Sprite *sprite)
sprite->tPosY <<= 7; // This is tileX * 8, using a fixed-point value with 4 decimal places
// "Rewind" the rain sprites, from their ending position.
sprite->tPosX -= sRainSpriteMovement[gWeatherPtr->isHeavyRain][0] * numFallingFrames;
sprite->tPosY -= sRainSpriteMovement[gWeatherPtr->isHeavyRain][1] * numFallingFrames;
sprite->tPosX -= sRainSpriteMovement[gWeatherPtr->isDownpour][0] * numFallingFrames;
sprite->tPosY -= sRainSpriteMovement[gWeatherPtr->isDownpour][1] * numFallingFrames;
StartSpriteAnim(sprite, 0);
sprite->tState = 0;
@ -592,8 +592,8 @@ static void UpdateRainSprite(struct Sprite *sprite)
if (sprite->tState == 0)
{
// Raindrop is in its "falling" motion.
sprite->tPosX += sRainSpriteMovement[gWeatherPtr->isHeavyRain][0];
sprite->tPosY += sRainSpriteMovement[gWeatherPtr->isHeavyRain][1];
sprite->tPosX += sRainSpriteMovement[gWeatherPtr->isDownpour][0];
sprite->tPosY += sRainSpriteMovement[gWeatherPtr->isDownpour][1];
sprite->pos1.x = sprite->tPosX >> 4;
sprite->pos1.y = sprite->tPosY >> 4;
@ -607,7 +607,7 @@ static void UpdateRainSprite(struct Sprite *sprite)
if (--sprite->tCounter == 0)
{
// Make raindrop splash on the ground
StartSpriteAnim(sprite, gWeatherPtr->isHeavyRain + 1);
StartSpriteAnim(sprite, gWeatherPtr->isDownpour + 1);
sprite->tState = 1;
sprite->pos1.x -= gSpriteCoordOffsetX;
sprite->pos1.y -= gSpriteCoordOffsetY;
@ -637,9 +637,9 @@ static void WaitRainSprite(struct Sprite *sprite)
static void InitRainSpriteMovement(struct Sprite *sprite, u16 val)
{
u16 numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][0];
u16 numAdvanceRng = val / (sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][1] + numFallingFrames);
u16 frameVal = val % (sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][1] + numFallingFrames);
u16 numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isDownpour][0];
u16 numAdvanceRng = val / (sRainSpriteFallingDurations[gWeatherPtr->isDownpour][1] + numFallingFrames);
u16 frameVal = val % (sRainSpriteFallingDurations[gWeatherPtr->isDownpour][1] + numFallingFrames);
while (--numAdvanceRng != 0xFFFF)
StartRainSpriteFall(sprite);
@ -1009,16 +1009,16 @@ static void UpdateSnowflakeSprite(struct Sprite *sprite)
#undef tDeltaY2
//------------------------------------------------------------------------------
// Medium Rain
// WEATHER_RAIN_THUNDERSTORM
//------------------------------------------------------------------------------
void MedRain_InitVars(void)
void Thunderstorm_InitVars(void)
{
gWeatherPtr->initStep = 0;
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->rainSpriteVisibleCounter = 0;
gWeatherPtr->rainSpriteVisibleDelay = 4;
gWeatherPtr->isHeavyRain = 0;
gWeatherPtr->isDownpour = FALSE;
gWeatherPtr->targetRainSpriteCount = 16;
gWeatherPtr->gammaTargetIndex = 3;
gWeatherPtr->gammaStepDelay = 20;
@ -1027,27 +1027,27 @@ void MedRain_InitVars(void)
SetRainStrengthFromSoundEffect(SE_T_AME);
}
void MedRain_InitAll(void)
void Thunderstorm_InitAll(void)
{
MedRain_InitVars();
Thunderstorm_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
Rain_Main();
Thunderstorm_Main();
}
//------------------------------------------------------------------------------
// Heavy Rain
// WEATHER_DOWNPOUR
//------------------------------------------------------------------------------
static void UpdateThunderSound(void);
static void SetThunderCounter(u16);
void HeavyRain_InitVars(void)
void Downpour_InitVars(void)
{
gWeatherPtr->initStep = 0;
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->rainSpriteVisibleCounter = 0;
gWeatherPtr->rainSpriteVisibleDelay = 4;
gWeatherPtr->isHeavyRain = 1;
gWeatherPtr->isDownpour = TRUE;
gWeatherPtr->targetRainSpriteCount = 24;
gWeatherPtr->gammaTargetIndex = 3;
gWeatherPtr->gammaStepDelay = 20;
@ -1055,14 +1055,14 @@ void HeavyRain_InitVars(void)
SetRainStrengthFromSoundEffect(SE_T_OOAME);
}
void HeavyRain_InitAll(void)
void Downpour_InitAll(void)
{
HeavyRain_InitVars();
Downpour_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
Rain_Main();
Thunderstorm_Main();
}
void Rain_Main(void)
void Thunderstorm_Main(void)
{
UpdateThunderSound();
switch (gWeatherPtr->initStep)
@ -1166,7 +1166,7 @@ void Rain_Main(void)
}
}
bool8 Rain_Finish(void)
bool8 Thunderstorm_Finish(void)
{
switch (gWeatherPtr->finishStep)
{
@ -1175,7 +1175,7 @@ bool8 Rain_Finish(void)
gWeatherPtr->finishStep++;
// fall through
case 1:
Rain_Main();
Thunderstorm_Main();
if (gWeatherPtr->unknown_6EA)
{
if (gWeatherPtr->nextWeather == WEATHER_RAIN
@ -1235,7 +1235,7 @@ static void UpdateThunderSound(void)
}
//------------------------------------------------------------------------------
// Fog 1
// WEATHER_FOG_HORIZONTAL and WEATHER_UNDERWATER
//------------------------------------------------------------------------------
// unused data
@ -1315,8 +1315,8 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_839AB8C[] =
gSpriteAffineAnim_839AB7C,
};
static void Fog1SpriteCallback(struct Sprite *);
static const struct SpriteTemplate sFog1SpriteTemplate =
static void FogHorizontalSpriteCallback(struct Sprite *);
static const struct SpriteTemplate sFogHorizontalSpriteTemplate =
{
.tileTag = 0x1201,
.paletteTag = 0x1200,
@ -1324,47 +1324,47 @@ static const struct SpriteTemplate sFog1SpriteTemplate =
.anims = gSpriteAnimTable_839AB64,
.images = NULL,
.affineAnims = gSpriteAffineAnimTable_839AB8C,
.callback = Fog1SpriteCallback,
.callback = FogHorizontalSpriteCallback,
};
void Fog1_Main(void);
static void CreateFog1Sprites(void);
static void DestroyFog1Sprites(void);
void FogHorizontal_Main(void);
static void CreateFogHorizontalSprites(void);
static void DestroyFogHorizontalSprites(void);
void Fog1_InitVars(void)
void FogHorizontal_InitVars(void)
{
gWeatherPtr->initStep = 0;
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->gammaTargetIndex = 0;
gWeatherPtr->gammaStepDelay = 20;
if (gWeatherPtr->fog1SpritesCreated == 0)
if (gWeatherPtr->fogHSpritesCreated == 0)
{
gWeatherPtr->fog1ScrollCounter = 0;
gWeatherPtr->fog1ScrollOffset = 0;
gWeatherPtr->fog1ScrollPosX = 0;
gWeatherPtr->fogHScrollCounter = 0;
gWeatherPtr->fogHScrollOffset = 0;
gWeatherPtr->fogHScrollPosX = 0;
Weather_SetBlendCoeffs(0, 16);
}
}
void Fog1_InitAll(void)
void FogHorizontal_InitAll(void)
{
Fog1_InitVars();
FogHorizontal_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
Fog1_Main();
FogHorizontal_Main();
}
void Fog1_Main(void)
void FogHorizontal_Main(void)
{
gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fog1ScrollOffset) & 0xFF;
if (++gWeatherPtr->fog1ScrollCounter > 3)
gWeatherPtr->fogHScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fogHScrollOffset) & 0xFF;
if (++gWeatherPtr->fogHScrollCounter > 3)
{
gWeatherPtr->fog1ScrollCounter = 0;
gWeatherPtr->fog1ScrollOffset++;
gWeatherPtr->fogHScrollCounter = 0;
gWeatherPtr->fogHScrollOffset++;
}
switch (gWeatherPtr->initStep)
{
case 0:
CreateFog1Sprites();
CreateFogHorizontalSprites();
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL)
Weather_SetTargetBlendCoeffs(12, 8, 3);
else
@ -1381,13 +1381,13 @@ void Fog1_Main(void)
}
}
bool8 Fog1_Finish(void)
bool8 FogHorizontal_Finish(void)
{
gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fog1ScrollOffset) & 0xFF;
if (++gWeatherPtr->fog1ScrollCounter > 3)
gWeatherPtr->fogHScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fogHScrollOffset) & 0xFF;
if (++gWeatherPtr->fogHScrollCounter > 3)
{
gWeatherPtr->fog1ScrollCounter = 0;
gWeatherPtr->fog1ScrollOffset++;
gWeatherPtr->fogHScrollCounter = 0;
gWeatherPtr->fogHScrollOffset++;
}
switch (gWeatherPtr->finishStep)
@ -1401,7 +1401,7 @@ bool8 Fog1_Finish(void)
gWeatherPtr->finishStep++;
break;
case 2:
DestroyFog1Sprites();
DestroyFogHorizontalSprites();
gWeatherPtr->finishStep++;
break;
default:
@ -1412,73 +1412,73 @@ bool8 Fog1_Finish(void)
#define tSpriteColumn data[0]
static void Fog1SpriteCallback(struct Sprite *sprite)
static void FogHorizontalSpriteCallback(struct Sprite *sprite)
{
sprite->pos2.y = (u8)gSpriteCoordOffsetY;
sprite->pos1.x = gWeatherPtr->fog1ScrollPosX + 32 + sprite->tSpriteColumn * 64;
sprite->pos1.x = gWeatherPtr->fogHScrollPosX + 32 + sprite->tSpriteColumn * 64;
if (sprite->pos1.x > 271)
{
sprite->pos1.x = 480 + gWeatherPtr->fog1ScrollPosX - (4 - sprite->tSpriteColumn) * 64;
sprite->pos1.x = 480 + gWeatherPtr->fogHScrollPosX - (4 - sprite->tSpriteColumn) * 64;
sprite->pos1.x &= 0x1FF;
}
}
static void CreateFog1Sprites(void)
static void CreateFogHorizontalSprites(void)
{
u16 i;
u8 spriteId;
struct Sprite *sprite;
if (!gWeatherPtr->fog1SpritesCreated)
if (!gWeatherPtr->fogHSpritesCreated)
{
struct SpriteSheet fog1SpriteSheet = {
.data = gWeatherFog1Tiles,
.size = sizeof(gWeatherFog1Tiles),
struct SpriteSheet fogHorizontalSpriteSheet = {
.data = gWeatherFogHorizontalTiles,
.size = sizeof(gWeatherFogHorizontalTiles),
.tag = 0x1201,
};
LoadSpriteSheet(&fog1SpriteSheet);
for (i = 0; i < NUM_FOG1_SPRITES; i++)
LoadSpriteSheet(&fogHorizontalSpriteSheet);
for (i = 0; i < NUM_FOG_HORIZONTAL_SPRITES; i++)
{
spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF);
spriteId = CreateSpriteAtEnd(&sFogHorizontalSpriteTemplate, 0, 0, 0xFF);
if (spriteId != MAX_SPRITES)
{
sprite = &gSprites[spriteId];
sprite->tSpriteColumn = i % 5;
sprite->pos1.x = (i % 5) * 64 + 32;
sprite->pos1.y = (i / 5) * 64 + 32;
gWeatherPtr->sprites.s2.fog1Sprites[i] = sprite;
gWeatherPtr->sprites.s2.fogHSprites[i] = sprite;
}
else
{
gWeatherPtr->sprites.s2.fog1Sprites[i] = NULL;
gWeatherPtr->sprites.s2.fogHSprites[i] = NULL;
}
}
gWeatherPtr->fog1SpritesCreated = TRUE;
gWeatherPtr->fogHSpritesCreated = TRUE;
}
}
static void DestroyFog1Sprites(void)
static void DestroyFogHorizontalSprites(void)
{
u16 i;
if (gWeatherPtr->fog1SpritesCreated)
if (gWeatherPtr->fogHSpritesCreated)
{
for (i = 0; i < NUM_FOG1_SPRITES; i++)
for (i = 0; i < NUM_FOG_HORIZONTAL_SPRITES; i++)
{
if (gWeatherPtr->sprites.s2.fog1Sprites[i] != NULL)
DestroySprite(gWeatherPtr->sprites.s2.fog1Sprites[i]);
if (gWeatherPtr->sprites.s2.fogHSprites[i] != NULL)
DestroySprite(gWeatherPtr->sprites.s2.fogHSprites[i]);
}
FreeSpriteTilesByTag(0x1201);
gWeatherPtr->fog1SpritesCreated = 0;
gWeatherPtr->fogHSpritesCreated = 0;
}
}
#undef tSpriteColumn
//------------------------------------------------------------------------------
// Volcanic ash
// WEATHER_VOLCANIC_ASH
//------------------------------------------------------------------------------
static void LoadAshSpriteSheet(void);
@ -1688,48 +1688,48 @@ static void UpdateAshSprite(struct Sprite *sprite)
#undef tSpriteRow
//------------------------------------------------------------------------------
// Fog 2
// WEATHER_FOG_DIAGONAL
//------------------------------------------------------------------------------
static void UpdateFog2Movement(void);
static void CreateFog2Sprites(void);
static void DestroyFog2Sprites(void);
static void UpdateFog2Sprite(struct Sprite *);
static void UpdateFogDiagonalMovement(void);
static void CreateFogDiagonalSprites(void);
static void DestroyFogDiagonalSprites(void);
static void UpdateFogDiagonalSprite(struct Sprite *);
void Fog2_InitVars(void)
void FogDiagonal_InitVars(void)
{
gWeatherPtr->initStep = 0;
gWeatherPtr->weatherGfxLoaded = 0;
gWeatherPtr->gammaTargetIndex = 0;
gWeatherPtr->gammaStepDelay = 20;
gWeatherPtr->fog1ScrollCounter = 0;
gWeatherPtr->fog1ScrollOffset = 1;
if (!gWeatherPtr->fog2SpritesCreated)
gWeatherPtr->fogHScrollCounter = 0;
gWeatherPtr->fogHScrollOffset = 1;
if (!gWeatherPtr->fogDSpritesCreated)
{
gWeatherPtr->fog2ScrollXCounter = 0;
gWeatherPtr->fog2ScrollYCounter = 0;
gWeatherPtr->fog2XOffset = 0;
gWeatherPtr->fog2YOffset = 0;
gWeatherPtr->fog2BaseSpritesX = 0;
gWeatherPtr->fog2PosY = 0;
gWeatherPtr->fogDScrollXCounter = 0;
gWeatherPtr->fogDScrollYCounter = 0;
gWeatherPtr->fogDXOffset = 0;
gWeatherPtr->fogDYOffset = 0;
gWeatherPtr->fogDBaseSpritesX = 0;
gWeatherPtr->fogDPosY = 0;
Weather_SetBlendCoeffs(0, 16);
}
}
void Fog2_InitAll(void)
void FogDiagonal_InitAll(void)
{
Fog2_InitVars();
FogDiagonal_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
Fog2_Main();
FogDiagonal_Main();
}
void Fog2_Main(void)
void FogDiagonal_Main(void)
{
UpdateFog2Movement();
UpdateFogDiagonalMovement();
switch (gWeatherPtr->initStep)
{
case 0:
CreateFog2Sprites();
CreateFogDiagonalSprites();
gWeatherPtr->initStep++;
break;
case 1:
@ -1745,9 +1745,9 @@ void Fog2_Main(void)
}
}
bool8 Fog2_Finish(void)
bool8 FogDiagonal_Finish(void)
{
UpdateFog2Movement();
UpdateFogDiagonalMovement();
switch (gWeatherPtr->finishStep)
{
case 0:
@ -1760,7 +1760,7 @@ bool8 Fog2_Finish(void)
gWeatherPtr->finishStep++;
break;
case 2:
DestroyFog2Sprites();
DestroyFogDiagonalSprites();
gWeatherPtr->finishStep++;
break;
default:
@ -1769,32 +1769,32 @@ bool8 Fog2_Finish(void)
return TRUE;
}
static void UpdateFog2Movement(void)
static void UpdateFogDiagonalMovement(void)
{
if (++gWeatherPtr->fog2ScrollXCounter > 2)
if (++gWeatherPtr->fogDScrollXCounter > 2)
{
gWeatherPtr->fog2XOffset++;
gWeatherPtr->fog2ScrollXCounter = 0;
gWeatherPtr->fogDXOffset++;
gWeatherPtr->fogDScrollXCounter = 0;
}
if (++gWeatherPtr->fog2ScrollYCounter > 4)
if (++gWeatherPtr->fogDScrollYCounter > 4)
{
gWeatherPtr->fog2YOffset++;
gWeatherPtr->fog2ScrollYCounter = 0;
gWeatherPtr->fogDYOffset++;
gWeatherPtr->fogDScrollYCounter = 0;
}
gWeatherPtr->fog2BaseSpritesX = (gSpriteCoordOffsetX - gWeatherPtr->fog2XOffset) & 0xFF;
gWeatherPtr->fog2PosY = gSpriteCoordOffsetY + gWeatherPtr->fog2YOffset;
gWeatherPtr->fogDBaseSpritesX = (gSpriteCoordOffsetX - gWeatherPtr->fogDXOffset) & 0xFF;
gWeatherPtr->fogDPosY = gSpriteCoordOffsetY + gWeatherPtr->fogDYOffset;
}
static const struct SpriteSheet gFog2SpriteSheet =
static const struct SpriteSheet gFogDiagonalSpriteSheet =
{
.data = gWeatherFog2Tiles,
.size = sizeof(gWeatherFog2Tiles),
.data = gWeatherFogDiagonalTiles,
.size = sizeof(gWeatherFogDiagonalTiles),
.tag = 0x1203,
};
static const struct OamData sFog2SpriteOamData =
static const struct OamData sFogDiagonalSpriteOamData =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -1808,86 +1808,86 @@ static const struct OamData sFog2SpriteOamData =
.paletteNum = 0,
};
static const union AnimCmd sFog2SpriteAnimCmd0[] =
static const union AnimCmd sFogDiagonalSpriteAnimCmd0[] =
{
ANIMCMD_FRAME(0, 16),
ANIMCMD_END,
};
static const union AnimCmd *const sFog2SpriteAnimCmds[] =
static const union AnimCmd *const sFogDiagonalSpriteAnimCmds[] =
{
sFog2SpriteAnimCmd0,
sFogDiagonalSpriteAnimCmd0,
};
static const struct SpriteTemplate sFog2SpriteTemplate =
static const struct SpriteTemplate sFogDiagonalSpriteTemplate =
{
.tileTag = 0x1203,
.paletteTag = 0x1200,
.oam = &sFog2SpriteOamData,
.anims = sFog2SpriteAnimCmds,
.oam = &sFogDiagonalSpriteOamData,
.anims = sFogDiagonalSpriteAnimCmds,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = UpdateFog2Sprite,
.callback = UpdateFogDiagonalSprite,
};
#define tSpriteColumn data[0]
#define tSpriteRow data[1]
static void CreateFog2Sprites(void)
static void CreateFogDiagonalSprites(void)
{
u16 i;
struct SpriteSheet fog2SpriteSheet;
struct SpriteSheet fogDiagonalSpriteSheet;
u8 spriteId;
struct Sprite *sprite;
if (!gWeatherPtr->fog2SpritesCreated)
if (!gWeatherPtr->fogDSpritesCreated)
{
fog2SpriteSheet = gFog2SpriteSheet;
LoadSpriteSheet(&fog2SpriteSheet);
for (i = 0; i < NUM_FOG2_SPRITES; i++)
fogDiagonalSpriteSheet = gFogDiagonalSpriteSheet;
LoadSpriteSheet(&fogDiagonalSpriteSheet);
for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++)
{
spriteId = CreateSpriteAtEnd(&sFog2SpriteTemplate, 0, (i / 5) * 64, 0xFF);
spriteId = CreateSpriteAtEnd(&sFogDiagonalSpriteTemplate, 0, (i / 5) * 64, 0xFF);
if (spriteId != MAX_SPRITES)
{
sprite = &gSprites[spriteId];
sprite->tSpriteColumn = i % 5;
sprite->tSpriteRow = i / 5;
gWeatherPtr->sprites.s2.fog2Sprites[i] = sprite;
gWeatherPtr->sprites.s2.fogDSprites[i] = sprite;
}
else
{
gWeatherPtr->sprites.s2.fog2Sprites[i] = NULL;
gWeatherPtr->sprites.s2.fogDSprites[i] = NULL;
}
}
gWeatherPtr->fog2SpritesCreated = TRUE;
gWeatherPtr->fogDSpritesCreated = TRUE;
}
}
static void DestroyFog2Sprites(void)
static void DestroyFogDiagonalSprites(void)
{
u16 i;
if (gWeatherPtr->fog2SpritesCreated)
if (gWeatherPtr->fogDSpritesCreated)
{
for (i = 0; i < NUM_FOG2_SPRITES; i++)
for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++)
{
if (gWeatherPtr->sprites.s2.fog2Sprites[i])
DestroySprite(gWeatherPtr->sprites.s2.fog2Sprites[i]);
if (gWeatherPtr->sprites.s2.fogDSprites[i])
DestroySprite(gWeatherPtr->sprites.s2.fogDSprites[i]);
}
FreeSpriteTilesByTag(0x1203);
gWeatherPtr->fog2SpritesCreated = FALSE;
gWeatherPtr->fogDSpritesCreated = FALSE;
}
}
static void UpdateFog2Sprite(struct Sprite *sprite)
static void UpdateFogDiagonalSprite(struct Sprite *sprite)
{
sprite->pos2.y = gWeatherPtr->fog2PosY;
sprite->pos1.x = gWeatherPtr->fog2BaseSpritesX + 32 + sprite->tSpriteColumn * 64;
sprite->pos2.y = gWeatherPtr->fogDPosY;
sprite->pos1.x = gWeatherPtr->fogDBaseSpritesX + 32 + sprite->tSpriteColumn * 64;
if (sprite->pos1.x > 271)
{
sprite->pos1.x = gWeatherPtr->fog2BaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64;
sprite->pos1.x = gWeatherPtr->fogDBaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64;
sprite->pos1.x &= 0x1FF;
}
}
@ -1896,7 +1896,7 @@ static void UpdateFog2Sprite(struct Sprite *sprite)
#undef tSpriteRow
//------------------------------------------------------------------------------
// Sandstorm
// WEATHER_SANDSTORM
//------------------------------------------------------------------------------
static void UpdateSandstormWaveIndex(void);
@ -2205,7 +2205,7 @@ static void UpdateSandstormSwirlSprite(struct Sprite *sprite)
#undef tEntranceDelay
//------------------------------------------------------------------------------
// Shade
// WEATHER_SHADE
//------------------------------------------------------------------------------
void Shade_InitVars(void)
@ -2230,7 +2230,7 @@ bool8 Shade_Finish(void)
}
//------------------------------------------------------------------------------
// Bubbles
// WEATHER_UNDERWATER_BUBBLES
//------------------------------------------------------------------------------
static void CreateBubbleSprite(u16);
@ -2265,7 +2265,7 @@ static const s16 sBubbleStartCoords[][2] =
void Bubbles_InitVars(void)
{
Fog1_InitVars();
FogHorizontal_InitVars();
if (!gWeatherPtr->bubblesSpritesCreated)
{
LoadSpriteSheet(&sWeatherBubbleSpriteSheet);
@ -2285,7 +2285,7 @@ void Bubbles_InitAll(void)
void Bubbles_Main(void)
{
Fog1_Main();
FogHorizontal_Main();
if (++gWeatherPtr->bubblesDelayCounter > sBubbleStartDelays[gWeatherPtr->bubblesDelayIndex])
{
gWeatherPtr->bubblesDelayCounter = 0;
@ -2300,7 +2300,7 @@ void Bubbles_Main(void)
bool8 Bubbles_Finish(void)
{
if (!Fog1_Finish())
if (!FogHorizontal_Finish())
{
DestroyBubbleSprites();
return FALSE;

View File

@ -998,7 +998,7 @@ void AnimTask_Haze1(u8 taskId)
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
sub_80A6B30(&animBg);
LoadBgTiles(animBg.bgId, gWeatherFog1Tiles, 0x800, animBg.tilesOffset);
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
sub_80A6D60(&animBg, gBattleAnimFogTilemap, 0);
LoadPalette(&gUnknown_083970E8, animBg.paletteId * 16, 32);
@ -1105,7 +1105,7 @@ void AnimTask_LoadMistTiles(u8 taskId)
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
sub_80A6B30(&animBg);
LoadBgTiles(animBg.bgId, gWeatherFog1Tiles, 0x800, animBg.tilesOffset);
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
sub_80A6D60(&animBg, gBattleAnimFogTilemap, 0);
LoadPalette(&gUnknown_083970E8, animBg.paletteId * 16, 32);