Address review comments

This commit is contained in:
PikalaxALT 2020-03-17 08:28:09 -04:00
parent e7a288189d
commit 39587fe2bc
11 changed files with 73 additions and 80 deletions

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -31,11 +31,11 @@ struct Weather
u8 gammaStepDelay;
u8 gammaStepFrameCounter;
u16 fadeDestColor;
/*0x6C6*/ u8 palProcessingState;
/*0x6C7*/ u8 fadeScreenCounter;
/*0x6C8*/ bool8 readyForInit;
/*0x6C9*/ u8 taskId;
/*0x6CA*/ u8 unknown_6CA;
u8 palProcessingState;
u8 fadeScreenCounter;
bool8 readyForInit;
u8 taskId;
u8 unknown_6CA;
u8 unknown_6CB;
u16 initStep;
u16 finishStep;
@ -52,8 +52,7 @@ struct Weather
u8 rainSpriteVisibleDelay;
u8 isDownpour;
u8 rainStrength;
/*0x6DE*/ u8 cloudSpritesCreated;
u8 filler_6DF[1];
bool8 cloudSpritesCreated;
u16 snowflakeVisibleCounter;
u16 unknown_6E2;
u8 snowflakeSpriteCount;
@ -63,17 +62,16 @@ struct Weather
u8 unknown_6EA;
u8 unknown_6EB;
u8 unknown_6EC;
u8 thunderTriggered;
bool8 thunderTriggered;
u16 fogHScrollPosX;
u16 fogHScrollCounter;
u16 fogHScrollOffset;
u8 lightenedFogSpritePals[6];
u8 lightenedFogSpritePalsCount;
u8 fogHSpritesCreated;
bool8 fogHSpritesCreated;
u16 ashBaseSpritesX;
u16 unknown_6FE;
u8 ashSpritesCreated;
u8 filler_701[3];
bool8 ashSpritesCreated;
u32 sandstormXOffset;
u32 sandstormYOffset;
u8 filler_70C[2];
@ -81,22 +79,20 @@ struct Weather
u16 sandstormPosY;
u16 sandstormWaveIndex;
u16 sandstormWaveCounter;
u8 sandstormSpritesCreated;
u8 sandstormSwirlSpritesCreated;
bool8 sandstormSpritesCreated;
bool8 sandstormSwirlSpritesCreated;
u16 fogDBaseSpritesX;
u16 fogDPosY;
u16 fogDScrollXCounter;
u16 fogDScrollYCounter;
u16 fogDXOffset;
u16 fogDYOffset;
u8 fogDSpritesCreated;
u8 filler_725[1];
bool8 fogDSpritesCreated;
u16 bubblesDelayCounter;
u16 bubblesDelayIndex;
u16 bubblesCoordsIndex;
u16 bubblesSpriteCount;
u8 bubblesSpritesCreated;
u8 filler_72F;
bool8 bubblesSpritesCreated;
u16 currBlendEVA;
u16 currBlendEVB;
u16 targetBlendEVA;
@ -104,7 +100,6 @@ struct Weather
u8 blendUpdateCounter;
u8 blendFrameCounter;
u8 blendDelay;
u8 filler_73B[0x3C-0x3B];
s16 unknown_73C;
s16 unknown_73E;
s16 unknown_740;

View File

@ -40,7 +40,7 @@ struct WeatherCallbacks
bool8 (*finish)(void);
};
static EWRAM_DATA struct Weather gWeather = {};
static EWRAM_DATA struct Weather sWeather = {};
static EWRAM_DATA u8 sFieldEffectPaletteGammaTypes[32] = {};
static EWRAM_DATA const u8 *sPaletteGammaTypes = NULL;
static EWRAM_DATA u16 gUnknown_20386A8 = 0;
@ -63,7 +63,7 @@ static void DoNothing(void);
static void ApplyFogBlend(u8 blendCoeff, u16 blendColor);
static bool8 LightenSpritePaletteInFog(u8 paletteIndex);
struct Weather *const gWeatherPtr = &gWeather;
struct Weather *const gWeatherPtr = &sWeather;
static const struct WeatherCallbacks sWeatherFuncs[] = {
{None_Init, None_Main, None_Init, None_Finish},
@ -83,7 +83,7 @@ static const struct WeatherCallbacks sWeatherFuncs[] = {
{Bubbles_InitVars, Bubbles_Main, Bubbles_InitAll, Bubbles_Finish},
};
static void (*const gWeatherPalStateFuncs[])(void) = {
static void (*const sWeatherPalStateFuncs[])(void) = {
UpdateWeatherGammaShift,
FadeInScreenWithWeather,
DoNothing,
@ -153,17 +153,17 @@ void StartWeather(void)
gWeatherPtr->weatherPicSpritePalIndex = index;
gWeatherPtr->rainSpriteCount = 0;
gWeatherPtr->curRainSpriteIndex = 0;
gWeatherPtr->cloudSpritesCreated = 0;
gWeatherPtr->cloudSpritesCreated = FALSE;
gWeatherPtr->snowflakeSpriteCount = 0;
gWeatherPtr->ashSpritesCreated = 0;
gWeatherPtr->fogHSpritesCreated = 0;
gWeatherPtr->fogDSpritesCreated = 0;
gWeatherPtr->sandstormSpritesCreated = 0;
gWeatherPtr->sandstormSwirlSpritesCreated = 0;
gWeatherPtr->bubblesSpritesCreated = 0;
gWeatherPtr->ashSpritesCreated = FALSE;
gWeatherPtr->fogHSpritesCreated = FALSE;
gWeatherPtr->fogDSpritesCreated = FALSE;
gWeatherPtr->sandstormSpritesCreated = FALSE;
gWeatherPtr->sandstormSwirlSpritesCreated = FALSE;
gWeatherPtr->bubblesSpritesCreated = FALSE;
gWeatherPtr->lightenedFogSpritePalsCount = 0;
Weather_SetBlendCoeffs(16, 0);
gWeatherPtr->currWeather = 0;
gWeatherPtr->currWeather = WEATHER_NONE;
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_IDLE;
gWeatherPtr->readyForInit = FALSE;
gWeatherPtr->weatherChangeComplete = TRUE;
@ -236,7 +236,7 @@ static void Task_WeatherMain(u8 taskId)
sWeatherFuncs[gWeatherPtr->currWeather].main();
}
gWeatherPalStateFuncs[gWeatherPtr->palProcessingState]();
sWeatherPalStateFuncs[gWeatherPtr->palProcessingState]();
}

View File

@ -38,7 +38,7 @@ static const struct OamData sCloudSpriteOamData = {
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_BLEND,
.mosaic = 0,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
@ -75,14 +75,14 @@ void Clouds_InitVars(void)
gWeatherPtr->gammaStepDelay = 20;
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->initStep = 0;
if (gWeatherPtr->cloudSpritesCreated == FALSE)
if (!gWeatherPtr->cloudSpritesCreated)
Weather_SetBlendCoeffs(0, 16);
}
void Clouds_InitAll(void)
{
Clouds_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
Clouds_Main();
}
@ -219,7 +219,7 @@ void Drought_InitVars(void)
void Drought_InitAll(void)
{
Drought_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
Drought_Main();
}
@ -236,7 +236,7 @@ void Drought_Main(void)
gWeatherPtr->initStep++;
break;
case 2:
if (LoadDroughtWeatherPalettes() == FALSE)
if (!LoadDroughtWeatherPalettes())
gWeatherPtr->initStep++;
break;
case 3:
@ -368,7 +368,7 @@ static const struct OamData sRainSpriteOamData = {
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x32),
.x = 0,
@ -406,7 +406,7 @@ static const union AnimCmd *const sRainSpriteAnimCmds[] = {
};
static const struct SpriteTemplate sRainSpriteTemplate = {
.tileTag = 4614,
.tileTag = 0x1206,
.paletteTag = 0x1200,
.oam = &sRainSpriteOamData,
.anims = sRainSpriteAnimCmds,
@ -615,13 +615,13 @@ static void InitRainSpriteMovement(struct Sprite *sprite, u16 val)
while (--frameVal != 0xFFFF)
UpdateRainSprite(sprite);
sprite->tWaiting = 0;
sprite->tWaiting = FALSE;
}
else
{
sprite->tCounter = frameVal - numFallingFrames;
sprite->invisible = TRUE;
sprite->tWaiting = 1;
sprite->tWaiting = TRUE;
}
}
@ -747,7 +747,7 @@ void Snow_InitAll(void)
u16 i;
Snow_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
{
Snow_Main();
for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++)
@ -806,7 +806,7 @@ static const struct OamData sSnowflakeSpriteOamData = {
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(8x8),
.x = 0,
@ -983,14 +983,14 @@ void Thunderstorm_InitVars(void)
gWeatherPtr->gammaTargetIndex = 3;
gWeatherPtr->gammaStepDelay = 20;
gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment
gWeatherPtr->thunderTriggered = 0;
gWeatherPtr->thunderTriggered = FALSE;
SetRainStrengthFromSoundEffect(SE_T_AME);
}
void Thunderstorm_InitAll(void)
{
Thunderstorm_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
Thunderstorm_Main();
}
@ -1018,7 +1018,7 @@ void Downpour_InitVars(void)
void Downpour_InitAll(void)
{
Downpour_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
Thunderstorm_Main();
}
@ -1151,7 +1151,7 @@ bool8 Thunderstorm_Finish(void)
if (!UpdateVisibleRainSprites())
{
DestroyRainSprites();
gWeatherPtr->thunderTriggered = 0;
gWeatherPtr->thunderTriggered = FALSE;
gWeatherPtr->finishStep++;
return FALSE;
}
@ -1164,16 +1164,16 @@ bool8 Thunderstorm_Finish(void)
static void SetThunderCounter(u16 max)
{
if (gWeatherPtr->thunderTriggered == 0)
if (!gWeatherPtr->thunderTriggered)
{
gWeatherPtr->thunderCounter = Random() % max;
gWeatherPtr->thunderTriggered = 1;
gWeatherPtr->thunderTriggered = TRUE;
}
}
static void UpdateThunderSound(void)
{
if (gWeatherPtr->thunderTriggered == 1)
if (gWeatherPtr->thunderTriggered == TRUE)
{
if (gWeatherPtr->thunderCounter == 0)
{
@ -1185,7 +1185,7 @@ static void UpdateThunderSound(void)
else
PlaySE(SE_T_KAMI2);
gWeatherPtr->thunderTriggered = 0;
gWeatherPtr->thunderTriggered = FALSE;
}
else
{
@ -1205,7 +1205,7 @@ static const struct OamData gOamData_839AB2C = {
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_BLEND,
.mosaic = 0,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
@ -1276,7 +1276,6 @@ static const struct SpriteTemplate sFogHorizontalSpriteTemplate = {
.callback = FogHorizontalSpriteCallback,
};
void FogHorizontal_Main(void);
static void CreateFogHorizontalSprites(void);
static void DestroyFogHorizontalSprites(void);
@ -1286,7 +1285,7 @@ void FogHorizontal_InitVars(void)
gWeatherPtr->weatherGfxLoaded = FALSE;
gWeatherPtr->gammaTargetIndex = 0;
gWeatherPtr->gammaStepDelay = 20;
if (gWeatherPtr->fogHSpritesCreated == 0)
if (!gWeatherPtr->fogHSpritesCreated)
{
gWeatherPtr->fogHScrollCounter = 0;
gWeatherPtr->fogHScrollOffset = 0;
@ -1298,7 +1297,7 @@ void FogHorizontal_InitVars(void)
void FogHorizontal_InitAll(void)
{
FogHorizontal_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
FogHorizontal_Main();
}
@ -1420,7 +1419,7 @@ static void DestroyFogHorizontalSprites(void)
}
FreeSpriteTilesByTag(0x1201);
gWeatherPtr->fogHSpritesCreated = 0;
gWeatherPtr->fogHSpritesCreated = FALSE;
}
}
@ -1452,7 +1451,7 @@ void Ash_InitVars(void)
void Ash_InitAll(void)
{
Ash_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
Ash_Main();
}
@ -1548,7 +1547,7 @@ static const union AnimCmd *const sAshSpriteAnimCmds[] = {
};
static const struct SpriteTemplate sAshSpriteTemplate = {
.tileTag = 4610,
.tileTag = 0x1202,
.paletteTag = 0x1200,
.oam = &sAshSpriteOamData,
.anims = sAshSpriteAnimCmds,
@ -1663,7 +1662,7 @@ void FogDiagonal_InitVars(void)
void FogDiagonal_InitAll(void)
{
FogDiagonal_InitVars();
while (gWeatherPtr->weatherGfxLoaded == FALSE)
while (!gWeatherPtr->weatherGfxLoaded)
FogDiagonal_Main();
}
@ -2220,11 +2219,11 @@ void Bubbles_Main(void)
if (++gWeatherPtr->bubblesDelayCounter > sBubbleStartDelays[gWeatherPtr->bubblesDelayIndex])
{
gWeatherPtr->bubblesDelayCounter = 0;
if (++gWeatherPtr->bubblesDelayIndex > ARRAY_COUNT(sBubbleStartDelays) - 1)
if (++gWeatherPtr->bubblesDelayIndex > NELEMS(sBubbleStartDelays) - 1)
gWeatherPtr->bubblesDelayIndex = 0;
CreateBubbleSprite(gWeatherPtr->bubblesCoordsIndex);
if (++gWeatherPtr->bubblesCoordsIndex > ARRAY_COUNT(sBubbleStartCoords) - 1)
if (++gWeatherPtr->bubblesCoordsIndex > NELEMS(sBubbleStartCoords) - 1)
gWeatherPtr->bubblesCoordsIndex = 0;
}
}

View File

@ -51,20 +51,19 @@ void ResumePausedWeather(void)
SetCurrentAndNextWeather(weather);
}
const u8 sWeatherCycleRoute119[] =
{
WEATHER_SUNNY,
WEATHER_RAIN,
WEATHER_RAIN_THUNDERSTORM,
WEATHER_RAIN,
};
const u8 sWeatherCycleRoute123[] =
{
WEATHER_SUNNY,
WEATHER_SUNNY,
WEATHER_RAIN,
WEATHER_SUNNY,
};
static const u8 sWeatherCycleRoute119[] = {
WEATHER_SUNNY,
WEATHER_RAIN,
WEATHER_RAIN_THUNDERSTORM,
WEATHER_RAIN,
};
static const u8 sWeatherCycleRoute123[] = {
WEATHER_SUNNY,
WEATHER_SUNNY,
WEATHER_RAIN,
WEATHER_SUNNY,
};
static u8 TranslateWeatherNum(u8 weather)
{

View File

@ -305,14 +305,14 @@ static const u16 gUnknown_LG_83BFA10[] = {
};
#endif
const u32 gUnknown_83BFBE4[] = INCBIN_U32("graphics/field_effects/unk_83BFBE4.bin.lz");
const u32 gUnknown_83C0408[] = INCBIN_U32("graphics/field_effects/unk_83C0408.bin.lz");
const u32 gUnknown_83C0C00[] = INCBIN_U32("graphics/field_effects/unk_83C0C00.bin.lz");
const u32 gUnknown_83C139C[] = INCBIN_U32("graphics/field_effects/unk_83C139C.bin.lz");
const u32 gUnknown_83C1BB8[] = INCBIN_U32("graphics/field_effects/unk_83C1BB8.bin.lz");
const u32 gUnknown_83C2380[] = INCBIN_U32("graphics/field_effects/unk_83C2380.bin.lz");
static const u32 gUnknown_83BFBE4[] = INCBIN_U32("graphics/title_screen/unk_83BFBE4.bin.lz");
static const u32 gUnknown_83C0408[] = INCBIN_U32("graphics/title_screen/unk_83C0408.bin.lz");
static const u32 gUnknown_83C0C00[] = INCBIN_U32("graphics/title_screen/unk_83C0C00.bin.lz");
static const u32 gUnknown_83C139C[] = INCBIN_U32("graphics/title_screen/unk_83C139C.bin.lz");
static const u32 gUnknown_83C1BB8[] = INCBIN_U32("graphics/title_screen/unk_83C1BB8.bin.lz");
static const u32 gUnknown_83C2380[] = INCBIN_U32("graphics/title_screen/unk_83C2380.bin.lz");
const u32 *const gUnknown_83C2BA4[] = {
static const u32 *const gUnknown_83C2BA4[] = {
gUnknown_83BFBE4,
gUnknown_83C0408,
gUnknown_83C0C00,