mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Remove cr/cg/cb/ca in favor of rgba * Change default colormap values to be in sync with rgba/fadergba
This commit is contained in:
parent
b7a216c78b
commit
a818b9a1dc
3 changed files with 24 additions and 99 deletions
|
@ -662,15 +662,6 @@ static void P_NetArchiveWorld(void)
|
||||||
WRITEUINT8(put, ss->extra_colormap->fadeend);
|
WRITEUINT8(put, ss->extra_colormap->fadeend);
|
||||||
WRITEUINT8(put, (UINT8)ss->extra_colormap->fog);
|
WRITEUINT8(put, (UINT8)ss->extra_colormap->fog);
|
||||||
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cr);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cg);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cb);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->ca);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cfr);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cfg);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cfb);
|
|
||||||
WRITEUINT8(put, ss->extra_colormap->cfa);
|
|
||||||
|
|
||||||
WRITEINT32(put, ss->extra_colormap->rgba);
|
WRITEINT32(put, ss->extra_colormap->rgba);
|
||||||
WRITEINT32(put, ss->extra_colormap->fadergba);
|
WRITEINT32(put, ss->extra_colormap->fadergba);
|
||||||
|
|
||||||
|
@ -883,15 +874,6 @@ static void P_NetUnArchiveWorld(void)
|
||||||
|
|
||||||
boolean fog = (boolean)READUINT8(get);
|
boolean fog = (boolean)READUINT8(get);
|
||||||
|
|
||||||
UINT8 cr = READUINT8(get),
|
|
||||||
cg = READUINT8(get),
|
|
||||||
cb = READUINT8(get),
|
|
||||||
ca = READUINT8(get),
|
|
||||||
cfr = READUINT8(get),
|
|
||||||
cfg = READUINT8(get),
|
|
||||||
cfb = READUINT8(get),
|
|
||||||
cfa = READUINT8(get);
|
|
||||||
|
|
||||||
INT32 rgba = READINT32(get),
|
INT32 rgba = READINT32(get),
|
||||||
fadergba = READINT32(get);
|
fadergba = READINT32(get);
|
||||||
|
|
||||||
|
@ -905,20 +887,6 @@ static void P_NetUnArchiveWorld(void)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (exc = extra_colormaps; exc; exc = exc->next)
|
|
||||||
{
|
|
||||||
#ifdef EXTRACOLORMAPLUMPS
|
|
||||||
if (exc->lump != LUMPERROR)
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
if (cr == exc->cr && cg == exc->cg && cb == exc->cb && ca == exc->ca
|
|
||||||
&& cfr == exc->cfr && cfg == exc->cfg && cfb == exc->cfb && cfa == exc->cfa
|
|
||||||
&& fadestart == exc->fadestart
|
|
||||||
&& fadeend == exc->fadeend
|
|
||||||
&& fog == exc->fog)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (exc = extra_colormaps; exc; exc = exc->next)
|
for (exc = extra_colormaps; exc; exc = exc->next)
|
||||||
{
|
{
|
||||||
#ifdef EXTRACOLORMAPLUMPS
|
#ifdef EXTRACOLORMAPLUMPS
|
||||||
|
@ -928,14 +896,15 @@ static void P_NetUnArchiveWorld(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (cr == exc->cr && cg == exc->cg && cb == exc->cb && ca == exc->ca
|
if (rgba == exc->rgba
|
||||||
&& cfr == exc->cfr && cfg == exc->cfg && cfb == exc->cfb && cfa == exc->cfa
|
&& fadergba == exc->fadergba
|
||||||
&& fadestart == exc->fadestart
|
&& fadestart == exc->fadestart
|
||||||
&& fadeend == exc->fadeend
|
&& fadeend == exc->fadeend
|
||||||
&& fog == exc->fog)
|
&& fog == exc->fog)
|
||||||
{
|
{
|
||||||
// CONS_Debug(DBG_RENDER, "P_NetUnArchiveWorld: Found map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
|
// CONS_Debug(DBG_RENDER, "P_NetUnArchiveWorld: Found map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
|
||||||
// dbg_i, cr, cg, cb, ca, cfr, cfg, cfb, cfa);
|
// dbg_i, (rgba)&0xFF, (rgba>>8)&0xFF, (rgba>>16)&0xFF, (rgba>>24)&0xFF,
|
||||||
|
// (fadergba)&0xFF, (fadergba>>8)&0xFF, (fadergba>>16)&0xFF, (fadergba>>24)&0xFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//dbg_i++;
|
//dbg_i++;
|
||||||
|
@ -944,7 +913,8 @@ static void P_NetUnArchiveWorld(void)
|
||||||
if (!exc)
|
if (!exc)
|
||||||
{
|
{
|
||||||
// CONS_Debug(DBG_RENDER, "P_NetUnArchiveWorld: Creating map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
|
// CONS_Debug(DBG_RENDER, "P_NetUnArchiveWorld: Creating map %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n",
|
||||||
// dbg_i, cr, cg, cb, ca, cfr, cfg, cfb, cfa);
|
// dbg_i, (rgba)&0xFF, (rgba>>8)&0xFF, (rgba>>16)&0xFF, (rgba>>24)&0xFF,
|
||||||
|
// (fadergba)&0xFF, (fadergba>>8)&0xFF, (fadergba>>16)&0xFF, (fadergba>>24)&0xFF);
|
||||||
|
|
||||||
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
||||||
|
|
||||||
|
@ -952,15 +922,6 @@ static void P_NetUnArchiveWorld(void)
|
||||||
exc->fadeend = fadeend;
|
exc->fadeend = fadeend;
|
||||||
exc->fog = fog;
|
exc->fog = fog;
|
||||||
|
|
||||||
exc->cr = cr;
|
|
||||||
exc->cg = cg;
|
|
||||||
exc->cb = cb;
|
|
||||||
exc->ca = ca;
|
|
||||||
exc->cfr = cfr;
|
|
||||||
exc->cfg = cfg;
|
|
||||||
exc->cfb = cfb;
|
|
||||||
exc->cfa = cfa;
|
|
||||||
|
|
||||||
exc->rgba = rgba;
|
exc->rgba = rgba;
|
||||||
exc->fadergba = fadergba;
|
exc->fadergba = fadergba;
|
||||||
|
|
||||||
|
|
66
src/r_data.c
66
src/r_data.c
|
@ -1332,10 +1332,6 @@ void R_ClearColormaps(void)
|
||||||
|
|
||||||
// make a default extra_colormap
|
// make a default extra_colormap
|
||||||
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL);
|
||||||
exc->cr = exc->cg = exc->cb = 0xff;
|
|
||||||
exc->ca = 0;
|
|
||||||
exc->cfr = exc->cfg = exc->cfb = 0;
|
|
||||||
exc->cfa = 18;
|
|
||||||
exc->fadestart = 0;
|
exc->fadestart = 0;
|
||||||
exc->fadeend = 31;
|
exc->fadeend = 31;
|
||||||
exc->fog = 0;
|
exc->fog = 0;
|
||||||
|
@ -1411,10 +1407,6 @@ extracolormap_t *R_ColormapForName(char *name)
|
||||||
|
|
||||||
// We set all params of the colormap to normal because there
|
// We set all params of the colormap to normal because there
|
||||||
// is no real way to tell how GL should handle a colormap lump anyway..
|
// is no real way to tell how GL should handle a colormap lump anyway..
|
||||||
exc->cr = exc->cg = exc->cb = 0xff;
|
|
||||||
exc->ca = 0;
|
|
||||||
exc->cfr = exc->cfg = exc->cfb = 0;
|
|
||||||
exc->cfa = 18;
|
|
||||||
exc->fadestart = 0;
|
exc->fadestart = 0;
|
||||||
exc->fadeend = 31;
|
exc->fadeend = 31;
|
||||||
exc->fog = 0;
|
exc->fog = 0;
|
||||||
|
@ -1445,14 +1437,14 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
||||||
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb;
|
||||||
double maskamt = 0, othermask = 0;
|
double maskamt = 0, othermask = 0;
|
||||||
|
|
||||||
UINT8 cr = extra_colormap->cr,
|
UINT8 cr = (extra_colormap->rgba) & 0xFF,
|
||||||
cg = extra_colormap->cg,
|
cg = (extra_colormap->rgba >> 8) & 0xFF,
|
||||||
cb = extra_colormap->cb,
|
cb = (extra_colormap->rgba >> 16) & 0xFF,
|
||||||
ca = extra_colormap->ca,
|
ca = (extra_colormap->rgba >> 24) & 0xFF,
|
||||||
cfr = extra_colormap->cfr,
|
cfr = (extra_colormap->fadergba) & 0xFF,
|
||||||
cfg = extra_colormap->cfg,
|
cfg = (extra_colormap->fadergba >> 8) & 0xFF,
|
||||||
cfb = extra_colormap->cfb;
|
cfb = (extra_colormap->fadergba >> 16) & 0xFF;
|
||||||
// cfa = extra_colormap->cfa; // unused in software
|
// cfa = (extra_colormap->fadergba >> 24) & 0xFF; // unused in software
|
||||||
|
|
||||||
UINT8 fadestart = extra_colormap->fadestart,
|
UINT8 fadestart = extra_colormap->fadestart,
|
||||||
fadedist = extra_colormap->fadeend - extra_colormap->fadestart;
|
fadedist = extra_colormap->fadeend - extra_colormap->fadestart;
|
||||||
|
@ -1594,22 +1586,13 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
||||||
ca = (p1[7] - 'A');
|
ca = (p1[7] - 'A');
|
||||||
else
|
else
|
||||||
ca = 24;
|
ca = 25;
|
||||||
|
|
||||||
// for opengl; generate on software too for netsync
|
rgba = cr + (cg << 8) + (cb << 16) + (ca << 24);
|
||||||
rgba = (HEX2INT(p1[1]) << 4) + (HEX2INT(p1[2]) << 0) +
|
|
||||||
(HEX2INT(p1[3]) << 12) + (HEX2INT(p1[4]) << 8) +
|
|
||||||
(HEX2INT(p1[5]) << 20) + (HEX2INT(p1[6]) << 16);
|
|
||||||
|
|
||||||
if ((p1[7] >= 'a' && p1[7] <= 'z') || (p1[7] >= 'A' && p1[7] <= 'Z'))
|
|
||||||
rgba += (ALPHA2INT(p1[7]) << 24);
|
|
||||||
else
|
|
||||||
rgba += (25 << 24);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cr = cg = cb = 0xff;
|
cr = cg = cb = ca = 0;
|
||||||
ca = 0;
|
|
||||||
rgba = 0;
|
rgba = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,22 +1621,14 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
else if (p1[7] >= 'A' && p1[7] <= 'Z')
|
||||||
cfa = (p1[7] - 'A');
|
cfa = (p1[7] - 'A');
|
||||||
else
|
else
|
||||||
cfa = 18;
|
cfa = 25;
|
||||||
|
|
||||||
// for opengl; generate on software too for netsync
|
fadergba = cfr + (cfg << 8) + (cfb << 16) + (cfa << 24);
|
||||||
fadergba = (HEX2INT(p3[1]) << 4) + (HEX2INT(p3[2]) << 0) +
|
|
||||||
(HEX2INT(p3[3]) << 12) + (HEX2INT(p3[4]) << 8) +
|
|
||||||
(HEX2INT(p3[5]) << 20) + (HEX2INT(p3[6]) << 16);
|
|
||||||
|
|
||||||
if ((p3[7] >= 'a' && p3[7] <= 'z') || (p3[7] >= 'A' && p3[7] <= 'Z'))
|
|
||||||
fadergba += (ALPHA2INT(p3[7]) << 24);
|
|
||||||
else
|
|
||||||
fadergba += (25 << 24);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cfr = cfg = cfb = 0;
|
cfr = cfg = cfb = 0;
|
||||||
cfa = 18;
|
cfa = 25;
|
||||||
fadergba = 0x19000000; // default alpha for fade, (25 << 24)
|
fadergba = 0x19000000; // default alpha for fade, (25 << 24)
|
||||||
}
|
}
|
||||||
#undef ALPHA2INT
|
#undef ALPHA2INT
|
||||||
|
@ -1668,8 +1643,8 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (cr == exc->cr && cg == exc->cg && cb == exc->cb && ca == exc->ca
|
if (rgba == exc->rgba
|
||||||
&& cfr == exc->cfr && cfg == exc->cfg && cfb == exc->cfb && cfa == exc->cfa
|
&& fadergba == exc->fadergba
|
||||||
&& fadestart == exc->fadestart
|
&& fadestart == exc->fadestart
|
||||||
&& fadeend == exc->fadeend
|
&& fadeend == exc->fadeend
|
||||||
&& fog == exc->fog)
|
&& fog == exc->fog)
|
||||||
|
@ -1690,15 +1665,6 @@ extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
extra_colormap->fadeend = (UINT16)fadeend;
|
extra_colormap->fadeend = (UINT16)fadeend;
|
||||||
extra_colormap->fog = fog;
|
extra_colormap->fog = fog;
|
||||||
|
|
||||||
extra_colormap->cr = cr;
|
|
||||||
extra_colormap->cg = cg;
|
|
||||||
extra_colormap->cb = cb;
|
|
||||||
extra_colormap->ca = ca;
|
|
||||||
extra_colormap->cfr = cfr;
|
|
||||||
extra_colormap->cfg = cfg;
|
|
||||||
extra_colormap->cfb = cfb;
|
|
||||||
extra_colormap->cfa = cfa;
|
|
||||||
|
|
||||||
extra_colormap->rgba = rgba;
|
extra_colormap->rgba = rgba;
|
||||||
extra_colormap->fadergba = fadergba;
|
extra_colormap->fadergba = fadergba;
|
||||||
|
|
||||||
|
|
|
@ -55,10 +55,8 @@ typedef struct extracolormap_s
|
||||||
UINT8 fadestart, fadeend;
|
UINT8 fadestart, fadeend;
|
||||||
boolean fog;
|
boolean fog;
|
||||||
|
|
||||||
// rgba for colormap table generation
|
// store rgba values in combined bitwise
|
||||||
UINT8 cr, cg, cb, ca, cfr, cfg, cfb, cfa;
|
// also used in OpenGL instead lighttables
|
||||||
|
|
||||||
// rgba is used in hw mode for colored sector lighting
|
|
||||||
INT32 rgba; // similar to maskcolor in sw mode
|
INT32 rgba; // similar to maskcolor in sw mode
|
||||||
INT32 fadergba; // The colour the colourmaps fade to
|
INT32 fadergba; // The colour the colourmaps fade to
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue