From 4689f0b0d012c715e9106b3216bd9308de8abfec Mon Sep 17 00:00:00 2001 From: Ariel A <24759293+aarant@users.noreply.github.com> Date: Sun, 15 Oct 2023 00:52:34 -0400 Subject: [PATCH] Fixes for `make modern`. --- src/field_weather_effect.c | 2 +- src/fieldmap.c | 4 +++- src/follower_helper.c | 2 +- src/palette.c | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index f0c1c4eeba..94ae288d60 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1387,7 +1387,7 @@ static void DestroyFogHorizontalSprites(void); // Updates just the color of shadows to match special weather blending u8 UpdateShadowColor(u16 color) { u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START); - u16 tempBuffer[16]; + u16 ALIGNED(4) tempBuffer[16]; u16 blendedColor; if (paletteNum != 0xFF) { u16 index = (paletteNum+16)*16+SHADOW_COLOR_INDEX; diff --git a/src/fieldmap.c b/src/fieldmap.c index c41a3b616b..0e48065a21 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -892,8 +892,10 @@ static void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u1 } else if (tileset->isSecondary == TRUE) { + // (void*) is to silence 'source potentially unaligned' error + // All 'gTilesetPalettes_' arrays should have ALIGNED(4) in them if (skipFaded) - CpuFastCopy(tileset->palettes[NUM_PALS_IN_PRIMARY], &gPlttBufferUnfaded[destOffset], size); + CpuFastCopy((void*)tileset->palettes[NUM_PALS_IN_PRIMARY], &gPlttBufferUnfaded[destOffset], size); else LoadPaletteFast(tileset->palettes[NUM_PALS_IN_PRIMARY], destOffset, size); low = NUM_PALS_IN_PRIMARY; diff --git a/src/follower_helper.c b/src/follower_helper.c index f146db6a74..af45565848 100644 --- a/src/follower_helper.c +++ b/src/follower_helper.c @@ -297,7 +297,7 @@ const struct FollowerMsgInfoExtended gFollowerConditionalMessages[COND_MSG_COUNT [COND_MSG_BURN] = { .text = sCondMsg42, - .st = {.status STATUS1_BURN}, + .st = {.status = STATUS1_BURN}, .stFlags = ST_FLAGS_STATUS, .emotion = FOLLOWER_EMOTION_SAD, }, diff --git a/src/palette.c b/src/palette.c index bda52a457a..f7584cd28f 100644 --- a/src/palette.c +++ b/src/palette.c @@ -1227,7 +1227,8 @@ void AvgPaletteWeighted(u16 *src0, u16 *src1, u16 *dst, u16 weight0) { r0 = r1 + (((r0 - r1) * weight0) >> 8); g0 = g1 + (((g0 - g1) * weight0) >> 8); b0 = b1 + (((b0 - b1) * weight0) >> 8); - *dst++ = (*dst & RGB_ALPHA) | RGB2(r0, g0, b0); // preserve high bit of dst + *dst = (*dst & RGB_ALPHA) | RGB2(r0, g0, b0); // preserve high bit of dst + dst++; } }