mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
dontencoreremap flag + colormaps
This commit is contained in:
parent
3bd62175f6
commit
aab87012df
3 changed files with 56 additions and 13 deletions
|
@ -5762,7 +5762,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
||||||
{
|
{
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)))
|
if (encoremap && (thing->flags & (MF_SCENERY|MF_NOTHINK)) && !(thing->flags & MF_DONTENCOREMAP))
|
||||||
vis->colormap += (256*32);
|
vis->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -5880,7 +5880,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||||
|
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
#ifdef GLENCORE
|
#ifdef GLENCORE
|
||||||
if (encoremap)
|
if (encoremap && !(thing->flags & MF_DONTENCOREMAP))
|
||||||
vis->colormap += (256*32);
|
vis->colormap += (256*32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1407,11 +1407,12 @@ static inline void P_LoadSideDefs(lumpnum_t lumpnum)
|
||||||
P_LoadRawSideDefs(W_LumpLength(lumpnum));
|
P_LoadRawSideDefs(W_LumpLength(lumpnum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void P_LoadRawSideDefs2(void *data)
|
static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
INT32 num;
|
INT32 num;
|
||||||
|
size_t j;
|
||||||
|
UINT32 cr, cg, cb;
|
||||||
|
|
||||||
for (i = 0; i < numsides; i++)
|
for (i = 0; i < numsides; i++)
|
||||||
{
|
{
|
||||||
|
@ -1490,16 +1491,43 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->toptexture;
|
col = msd->toptexture;
|
||||||
|
|
||||||
sec->extra_colormap->rgba =
|
// encore mode colormaps!
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
// 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.
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
// do this for both the start and fade colormaps.
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
|
||||||
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->toptexture[7])
|
if (msd->toptexture[7])
|
||||||
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
||||||
else
|
else
|
||||||
sec->extra_colormap->rgba += (25 << 24);
|
sec->extra_colormap->rgba += (25 << 24);
|
||||||
|
|
||||||
|
/*nearest = NearestColor(
|
||||||
|
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0),
|
||||||
|
(HEX2INT(col[3]) << 4) + (HEX2INT(col[4]) << 0),
|
||||||
|
(HEX2INT(col[5]) << 4) + (HEX2INT(col[6]) << 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba =
|
||||||
|
pLocalPalette[nearest].s.red +
|
||||||
|
(pLocalPalette[nearest].s.green << 8) +
|
||||||
|
(pLocalPalette[nearest].s.blue << 16);*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sec->extra_colormap->rgba = 0;
|
sec->extra_colormap->rgba = 0;
|
||||||
|
@ -1508,10 +1536,24 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->bottomtexture;
|
col = msd->bottomtexture;
|
||||||
|
|
||||||
sec->extra_colormap->fadergba =
|
// do the exact same thing as above here.
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->fadergba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->bottomtexture[7])
|
if (msd->bottomtexture[7])
|
||||||
|
@ -1658,6 +1700,7 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
R_ClearTextureNumCache(true);
|
R_ClearTextureNumCache(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Delay loading texture names until after loaded linedefs.
|
// Delay loading texture names until after loaded linedefs.
|
||||||
static void P_LoadSideDefs2(lumpnum_t lumpnum)
|
static void P_LoadSideDefs2(lumpnum_t lumpnum)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ void R_ClearColormaps(void)
|
||||||
//
|
//
|
||||||
static double deltas[256][3], map[256][3];
|
static double deltas[256][3], map[256][3];
|
||||||
|
|
||||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||||
static int RoundUp(double number);
|
static int RoundUp(double number);
|
||||||
|
|
||||||
#ifdef HASINVERT
|
#ifdef HASINVERT
|
||||||
|
@ -1403,7 +1403,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
|
|
||||||
// Thanks to quake2 source!
|
// Thanks to quake2 source!
|
||||||
// utils3/qdata/images.c
|
// utils3/qdata/images.c
|
||||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
||||||
{
|
{
|
||||||
int dr, dg, db;
|
int dr, dg, db;
|
||||||
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
||||||
|
|
Loading…
Reference in a new issue