From c363c28b22a2c409486213d6d80041cd3bd47c56 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 17 Jan 2025 18:21:48 -0300 Subject: [PATCH] Addressing a bunch of small things --- data/maps/MtPyre_Summit/scripts.inc | 1 + data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc | 1 + graphics/pokemon/ampharos/normal.pla | 2 +- graphics/pokemon/ampharos/shiny.pla | 2 +- include/palette.h | 2 +- src/event_object_movement.c | 9 +++++++-- src/field_weather.c | 9 ++++----- src/field_weather_effect.c | 4 ++-- src/overworld.c | 2 ++ src/pokemon_summary_screen.c | 2 +- 10 files changed, 21 insertions(+), 13 deletions(-) diff --git a/data/maps/MtPyre_Summit/scripts.inc b/data/maps/MtPyre_Summit/scripts.inc index 5a6d23797a..2d85cf17f5 100644 --- a/data/maps/MtPyre_Summit/scripts.inc +++ b/data/maps/MtPyre_Summit/scripts.inc @@ -622,3 +622,4 @@ MtPyre_Summit_Text_HoennTrioTale: .string "becalmed the two enraged POKéMON.\p" .string "Then, its duty done, the green POKéMON\n" .string "flew off into the wild blue yonder…$" + diff --git a/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc b/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc index fd6567cb65..76b6784562 100644 --- a/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc +++ b/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc @@ -103,3 +103,4 @@ SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter: walk_down walk_in_place_faster_left step_end + diff --git a/graphics/pokemon/ampharos/normal.pla b/graphics/pokemon/ampharos/normal.pla index 88043ac888..debe6624ba 100644 --- a/graphics/pokemon/ampharos/normal.pla +++ b/graphics/pokemon/ampharos/normal.pla @@ -4,4 +4,4 @@ 11 12 13 -14 \ No newline at end of file +14 diff --git a/graphics/pokemon/ampharos/shiny.pla b/graphics/pokemon/ampharos/shiny.pla index 88043ac888..debe6624ba 100644 --- a/graphics/pokemon/ampharos/shiny.pla +++ b/graphics/pokemon/ampharos/shiny.pla @@ -4,4 +4,4 @@ 11 12 13 -14 \ No newline at end of file +14 diff --git a/include/palette.h b/include/palette.h index e127d7fe65..4d918e9001 100644 --- a/include/palette.h +++ b/include/palette.h @@ -101,7 +101,7 @@ void BlendPalettesUnfaded(u32 selectedPalettes, u8 coeff, u32 color); void BlendPalettesGradually(u32 selectedPalettes, s8 delay, u8 coeff, u8 coeffTarget, u16 color, u8 priority, u8 id); void TimeBlendPalette(u16 palOffset, u32 coeff, u32 blendColor); void TintPalette_RGB_Copy(u16 palOffset, u32 blendColor); -void TimeMixPalettes(u32, u16 *, u16 *, struct BlendSettings *, struct BlendSettings *, u16); +void TimeMixPalettes(u32 palettes, u16 *src, u16 *dst, struct BlendSettings *blend0, struct BlendSettings *blend1, u16 weight0); void AvgPaletteWeighted(u16 *src0, u16 *src1, u16 *dst, u16 weight0); void TintPalette_GrayScale(u16 *palette, u32 count); void TintPalette_GrayScale2(u16 *palette, u32 count); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index c3b8f0facb..53380777d4 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2613,6 +2613,8 @@ void GetFollowerAction(struct ScriptContext *ctx) // Essentially a big switch fo gFollowerBasicMessages[emotion].script); } +#define sLightType data[5] + // Sprite callback for light sprites void UpdateLightSprite(struct Sprite *sprite) { @@ -2641,7 +2643,7 @@ void UpdateLightSprite(struct Sprite *sprite) return; } - switch (sprite->data[5]) // lightType + switch (sprite->sLightType) { default: case LIGHT_TYPE_BALL: @@ -2693,7 +2695,7 @@ static void SpawnLightSprite(s16 x, s16 y, s16 camX, s16 camY, u32 lightType) else UpdateSpritePaletteByTemplate(template, sprite); GetMapCoordsFromSpritePos(x + camX, y + camY, &sprite->x, &sprite->y); - sprite->data[5] = lightType; + sprite->sLightType = lightType; sprite->data[6] = x; sprite->data[7] = y; sprite->affineAnims = gDummySpriteAffineAnimTable; @@ -2718,9 +2720,12 @@ static void SpawnLightSprite(s16 x, s16 y, s16 camX, s16 camY, u32 lightType) sprite->oam.priority = 2; sprite->subpriority = 0xFF; sprite->oam.objMode = ST_OAM_OBJ_BLEND; + break; } } +#undef sLightType + void TrySpawnLightSprites(s16 camX, s16 camY) { u32 i; diff --git a/src/field_weather.c b/src/field_weather.c index 485f63c0f0..9274863be1 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -531,7 +531,6 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex) } else { - // copy CpuFastCopy(&gPlttBufferUnfaded[PLTT_ID(startPalIndex)], &gPlttBufferFaded[PLTT_ID(startPalIndex)], numPalettes * PLTT_SIZE_4BPP); } } @@ -681,7 +680,7 @@ static void MarkFogSpritePalToLighten(u8 paletteIndex) static bool8 LightenSpritePaletteInFog(u8 paletteIndex) { - u16 i; + u32 i; if (paletteIndex >= 16 && IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(paletteIndex - 16))) return FALSE; @@ -883,9 +882,9 @@ static bool8 UNUSED IsFirstFrameOfWeatherFadeIn(void) void LoadCustomWeatherSpritePalette(const u16 *palette) { - if (gWeatherPtr->weatherPicSpritePalIndex > 16) // haven't allocated palette yet - if ((gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(PALTAG_WEATHER_2)) > 16) - return; + if (gWeatherPtr->weatherPicSpritePalIndex > 16 // haven't allocated palette yet + && (gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(PALTAG_WEATHER_2)) > 16) + return; LoadPalette(palette, OBJ_PLTT_ID(gWeatherPtr->weatherPicSpritePalIndex), PLTT_SIZE_4BPP); UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex, TRUE); } diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 2ac3a2f52a..df23a6b0e0 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1415,8 +1415,8 @@ void FogHorizontal_Main(void) CreateFogHorizontalSprites(); if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) { - Weather_SetTargetBlendCoeffs(12, 8, 3); - UpdateShadowColor(RGB(15, 15, 15)); // Gray + Weather_SetTargetBlendCoeffs(12, 8, 3); + UpdateShadowColor(RGB(15, 15, 15)); // Gray } else { diff --git a/src/overworld.c b/src/overworld.c index 58d60e8d2b..4d4d74e5dc 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1653,8 +1653,10 @@ void UpdatePalettesWithTime(u32 palettes) u32 mask = 1 << 16; if (palettes >= (1 << 16)) for (i = 0; i < 16; i++, mask <<= 1) + { if (IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(i))) palettes &= ~(mask); + } palettes &= PALETTES_MAP | PALETTES_OBJECTS; // Don't blend UI pals if (!palettes) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 913d55fc0d..f0c65dc2a7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3955,7 +3955,7 @@ static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible) static void HidePageSpecificSprites(void) { - // Keeps POKéMON, caught ball and status sprites visible. + // Keeps Pok�mon, caught ball and status sprites visible. u8 i; for (i = SPRITE_ARR_ID_TYPE; i < ARRAY_COUNT(sMonSummaryScreen->spriteIds); i++)