mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-29 05:41:02 +00:00
Merge branch 'ogl-encore-color-fix' into 'master'
Fix bug in OpenGL encore colormaps See merge request KartKrew/Kart-Public!180
This commit is contained in:
commit
f7e74e8884
1 changed files with 16 additions and 20 deletions
|
@ -1408,7 +1408,7 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
INT32 num;
|
INT32 num;
|
||||||
size_t j;
|
size_t j;
|
||||||
UINT32 cr, cg, cb;
|
RGBA_t color;
|
||||||
|
|
||||||
for (i = 0; i < numsides; i++)
|
for (i = 0; i < numsides; i++)
|
||||||
{
|
{
|
||||||
|
@ -1491,22 +1491,20 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
|
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
|
||||||
// do this for both the start and fade colormaps.
|
// do this for both the start and fade colormaps.
|
||||||
|
|
||||||
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
|
||||||
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
|
||||||
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
|
||||||
|
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap)
|
if (encoremap)
|
||||||
{
|
{
|
||||||
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
|
||||||
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
cr = pLocalPalette[j].s.red;
|
color = pLocalPalette[j];
|
||||||
cg = pLocalPalette[j].s.green;
|
|
||||||
cb = pLocalPalette[j].s.blue;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sec->extra_colormap->rgba = cr + cg + cb;
|
sec->extra_colormap->rgba = color.rgba;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->toptexture[7])
|
if (msd->toptexture[7])
|
||||||
|
@ -1534,22 +1532,20 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
|
|
||||||
// do the exact same thing as above here.
|
// do the exact same thing as above here.
|
||||||
|
|
||||||
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
|
||||||
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
|
||||||
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
|
||||||
|
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap)
|
if (encoremap)
|
||||||
{
|
{
|
||||||
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
|
||||||
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
cr = pLocalPalette[j].s.red;
|
color = pLocalPalette[j];
|
||||||
cg = pLocalPalette[j].s.green;
|
|
||||||
cb = pLocalPalette[j].s.blue;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sec->extra_colormap->fadergba = cr + cg + cb;
|
sec->extra_colormap->fadergba = color.rgba;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->bottomtexture[7])
|
if (msd->bottomtexture[7])
|
||||||
|
|
Loading…
Reference in a new issue