Merge branch 'colorfret' into 'next'

Respect mobj->color while enemies & bosses flash (resolves #531)

Closes #531

See merge request STJr/SRB2!1513
This commit is contained in:
Nev3r 2021-06-01 02:31:22 -04:00
commit ab06ff011e
4 changed files with 16 additions and 20 deletions

View file

@ -5344,7 +5344,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
vis->colormap = R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
else
vis->colormap = R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE);
vis->colormap = R_GetTranslationColormap(TC_BOSS, vis->mobj->color, GTC_CACHE);
}
else if (thing->color)
{

View file

@ -777,24 +777,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
while (size--)
{
if (skinnum == TC_BOSS)
{
// Turn everything below a certain threshold white
if ((image->s.red == image->s.green) && (image->s.green == image->s.blue) && image->s.blue < 127)
{
// Lactozilla: Invert the colors
cur->s.red = cur->s.green = cur->s.blue = (255 - image->s.blue);
}
else
{
cur->s.red = image->s.red;
cur->s.green = image->s.green;
cur->s.blue = image->s.blue;
}
cur->s.alpha = image->s.alpha;
}
else if (skinnum == TC_ALLWHITE)
if (skinnum == TC_ALLWHITE)
{
// Turn everything white
cur->s.red = cur->s.green = cur->s.blue = 255;
@ -1065,6 +1048,15 @@ skippixel:
cur->s.alpha = image->s.alpha;
}
else if (skinnum == TC_BOSS)
{
// Turn everything below a certain threshold white
if ((image->s.red == image->s.green) && (image->s.green == image->s.blue) && image->s.blue < 127)
{
// Lactozilla: Invert the colors
cur->s.red = cur->s.green = cur->s.blue = (255 - image->s.blue);
}
}
}
}

View file

@ -482,8 +482,12 @@ static void R_GenerateTranslationColormap(UINT8 *dest_colormap, INT32 skinnum, U
// White!
if (skinnum == TC_BOSS)
{
UINT8 *originalColormap = R_GetTranslationColormap(TC_DEFAULT, (skincolornum_t)color, GTC_CACHE);
for (i = 0; i < 16; i++)
{
dest_colormap[DEFAULT_STARTTRANSCOLOR + i] = originalColormap[DEFAULT_STARTTRANSCOLOR + i];
dest_colormap[31-i] = i;
}
}
else if (skinnum == TC_METALSONIC)
{

View file

@ -753,7 +753,7 @@ UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
else if (vis->mobj->type == MT_METALSONIC_BATTLE)
return R_GetTranslationColormap(TC_METALSONIC, 0, GTC_CACHE);
else
return R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE);
return R_GetTranslationColormap(TC_BOSS, vis->mobj->color, GTC_CACHE);
}
else if (vis->mobj->color)
{