diff options
author | PikalaxALT <PikalaxALT@gmail.com> | 2020-03-17 08:28:09 -0400 |
---|---|---|
committer | PikalaxALT <PikalaxALT@gmail.com> | 2020-03-17 08:28:09 -0400 |
commit | 39587fe2bcfdc8a353e2ca91ca1ed370d748613e (patch) | |
tree | eb4dd512ff4b4f866b64384ec4eea3c56bf6675c /src | |
parent | e7a288189db2773f27134a6327aa9ce3312dc812 (diff) |
Address review comments
Diffstat (limited to 'src')
-rw-r--r-- | src/field_weather.c | 24 | ||||
-rw-r--r-- | src/field_weather_effects.c | 57 | ||||
-rw-r--r-- | src/field_weather_util.c | 27 | ||||
-rw-r--r-- | src/title_screen.c | 16 |
4 files changed, 61 insertions, 63 deletions
diff --git a/src/field_weather.c b/src/field_weather.c index d16e8f15a..1185f5763 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -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](); } diff --git a/src/field_weather_effects.c b/src/field_weather_effects.c index 43314e6ad..e6f4bfacf 100644 --- a/src/field_weather_effects.c +++ b/src/field_weather_effects.c @@ -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; } } diff --git a/src/field_weather_util.c b/src/field_weather_util.c index 2c3338fd9..459071736 100644 --- a/src/field_weather_util.c +++ b/src/field_weather_util.c @@ -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) { diff --git a/src/title_screen.c b/src/title_screen.c index 555b58e8f..e1bcf5dd2 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -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"); - -const u32 *const gUnknown_83C2BA4[] = { +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"); + +static const u32 *const gUnknown_83C2BA4[] = { gUnknown_83BFBE4, gUnknown_83C0408, gUnknown_83C0C00, |