summaryrefslogtreecommitdiff
path: root/src/palette.c
diff options
context:
space:
mode:
authorluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2021-06-01 20:40:27 -0400
committerluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2021-06-01 20:40:27 -0400
commitf0b41debc35c2084aad6d369eab11a2d2df4ab44 (patch)
tree9b720ab0b617fa207051efc7ff9373669f7dc47b /src/palette.c
parenta839463c849679974c986bf9c9c260eff0e94cb7 (diff)
parent9f5bf65fb336cf7a3ba68d32267bf993f0f6a494 (diff)
Merge branch 'master' of https://github.com/pret/pokeemerald into remove-temps
Diffstat (limited to 'src/palette.c')
-rw-r--r--src/palette.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/palette.c b/src/palette.c
index 320e11ecc..cbaae8da2 100644
--- a/src/palette.c
+++ b/src/palette.c
@@ -60,7 +60,7 @@ ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0};
ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0};
EWRAM_DATA struct PaletteStruct sPaletteStructs[0x10] = {0};
EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0};
-static EWRAM_DATA u32 gFiller_2037FE0 = 0;
+static EWRAM_DATA u32 sFiller = 0;
static EWRAM_DATA u32 sPlttBufferTransferPending = 0;
EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_DECOMP_BUFFER_SIZE] = {0};
@@ -624,7 +624,7 @@ static u8 UpdateFastPaletteFade(void)
if (b < b0)
b = b0;
- gPlttBufferFaded[i] = r | (g << 5) | (b << 10);
+ gPlttBufferFaded[i] = RGB(r, g, b);
}
break;
case FAST_FADE_OUT_TO_WHITE:
@@ -642,7 +642,7 @@ static u8 UpdateFastPaletteFade(void)
if (b > 31)
b = 31;
- gPlttBufferFaded[i] = r | (g << 5) | (b << 10);
+ gPlttBufferFaded[i] = RGB(r, g, b);
}
break;
case FAST_FADE_IN_FROM_BLACK:
@@ -668,7 +668,7 @@ static u8 UpdateFastPaletteFade(void)
if (b > b0)
b = b0;
- gPlttBufferFaded[i] = r | (g << 5) | (b << 10);
+ gPlttBufferFaded[i] = RGB(r, g, b);
}
break;
case FAST_FADE_OUT_TO_BLACK:
@@ -686,7 +686,7 @@ static u8 UpdateFastPaletteFade(void)
if (b < 0)
b = 0;
- gPlttBufferFaded[i] = r | (g << 5) | (b << 10);
+ gPlttBufferFaded[i] = RGB(r, g, b);
}
}
@@ -856,13 +856,13 @@ void TintPalette_GrayScale(u16 *palette, u16 count)
for (i = 0; i < count; i++)
{
- r = (*palette >> 0) & 0x1F;
- g = (*palette >> 5) & 0x1F;
- b = (*palette >> 10) & 0x1F;
+ r = GET_R(*palette);
+ g = GET_G(*palette);
+ b = GET_B(*palette);
gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8;
- *palette++ = (gray << 10) | (gray << 5) | (gray << 0);
+ *palette++ = RGB2(gray, gray, gray);
}
}
@@ -873,18 +873,18 @@ void TintPalette_GrayScale2(u16 *palette, u16 count)
for (i = 0; i < count; i++)
{
- r = (*palette >> 0) & 0x1F;
- g = (*palette >> 5) & 0x1F;
- b = (*palette >> 10) & 0x1F;
+ r = GET_R(*palette);
+ g = GET_G(*palette);
+ b = GET_B(*palette);
gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8;
- if (gray > 0x1F)
- gray = 0x1F;
+ if (gray > 31)
+ gray = 31;
gray = sRoundedDownGrayscaleMap[gray];
- *palette++ = (gray << 10) | (gray << 5) | (gray << 0);
+ *palette++ = RGB2(gray, gray, gray);
}
}
@@ -895,9 +895,9 @@ void TintPalette_SepiaTone(u16 *palette, u16 count)
for (i = 0; i < count; i++)
{
- r = (*palette >> 0) & 0x1F;
- g = (*palette >> 5) & 0x1F;
- b = (*palette >> 10) & 0x1F;
+ r = GET_R(*palette);
+ g = GET_G(*palette);
+ b = GET_B(*palette);
gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8;
@@ -908,7 +908,7 @@ void TintPalette_SepiaTone(u16 *palette, u16 count)
if (r > 31)
r = 31;
- *palette++ = (b << 10) | (g << 5) | (r << 0);
+ *palette++ = RGB2(r, g, b);
}
}
@@ -919,9 +919,9 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 b
for (i = 0; i < count; i++)
{
- r = (*palette >> 0) & 0x1F;
- g = (*palette >> 5) & 0x1F;
- b = (*palette >> 10) & 0x1F;
+ r = GET_R(*palette);
+ g = GET_G(*palette);
+ b = GET_B(*palette);
gray = (r * Q_8_8(0.3) + g * Q_8_8(0.59) + b * Q_8_8(0.1133)) >> 8;
@@ -936,7 +936,7 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 b
if (b > 31)
b = 31;
- *palette++ = (b << 10) | (g << 5) | (r << 0);
+ *palette++ = RGB2(r, g, b);
}
}
@@ -1002,7 +1002,7 @@ static void DestroyBlendPalettesGraduallyTask(void)
while (1)
{
taskId = FindTaskIdByFunc(Task_BlendPalettesGradually);
- if (taskId == 0xFF)
+ if (taskId == TASK_NONE)
break;
DestroyTask(taskId);
}