Add enums to encapsulate the textmap colormap settings

This commit is contained in:
MascaraSnake 2020-04-18 17:15:25 +02:00
parent f0c63ce76a
commit 09506112d7
4 changed files with 58 additions and 40 deletions

View file

@ -1630,7 +1630,7 @@ udmf
4 = "Subtract light G"; 4 = "Subtract light G";
8 = "Subtract light B"; 8 = "Subtract light B";
16 = "Subtract light A"; 16 = "Subtract light A";
32 = "Subtract light R"; 32 = "Subtract fade R";
64 = "Subtract fade G"; 64 = "Subtract fade G";
128 = "Subtract fade B"; 128 = "Subtract fade B";
256 = "Subtract fade A"; 256 = "Subtract fade A";
@ -1670,7 +1670,7 @@ udmf
4 = "Subtract light G"; 4 = "Subtract light G";
8 = "Subtract light B"; 8 = "Subtract light B";
16 = "Subtract light A"; 16 = "Subtract light A";
32 = "Subtract light R"; 32 = "Subtract fade R";
64 = "Subtract fade G"; 64 = "Subtract fade G";
128 = "Subtract fade B"; 128 = "Subtract fade B";
256 = "Subtract fade A"; 256 = "Subtract fade A";

View file

@ -1825,12 +1825,12 @@ static void P_ProcessLinedefsAfterSidedefs(void)
if (alpha < 0) if (alpha < 0)
{ {
alpha *= -1; alpha *= -1;
ld->args[2] |= 16; ld->args[2] |= TMCF_SUBLIGHTA;
} }
if (fadealpha < 0) if (fadealpha < 0)
{ {
fadealpha *= -1; fadealpha *= -1;
ld->args[2] |= 256; ld->args[2] |= TMCF_SUBFADEA;
} }
exc->rgba = R_GetRgbaRGB(exc->rgba) + R_PutRgbaA(alpha); exc->rgba = R_GetRgbaRGB(exc->rgba) + R_PutRgbaA(alpha);
@ -2812,13 +2812,13 @@ static void P_ConvertBinaryMap(void)
case 447: //Change colormap case 447: //Change colormap
lines[i].args[0] = lines[i].tag; lines[i].args[0] = lines[i].tag;
if (lines[i].flags & ML_EFFECT3) if (lines[i].flags & ML_EFFECT3)
lines[i].args[2] |= 1; lines[i].args[2] |= TMCF_RELATIVE;
if (lines[i].flags & ML_EFFECT1) if (lines[i].flags & ML_EFFECT1)
lines[i].args[2] |= 34; lines[i].args[2] |= TMCF_SUBLIGHTR|TMCF_SUBFADER;
if (lines[i].flags & ML_NOCLIMB) if (lines[i].flags & ML_NOCLIMB)
lines[i].args[2] |= 68; lines[i].args[2] |= TMCF_SUBLIGHTG|TMCF_SUBFADEG;
if (lines[i].flags & ML_EFFECT2) if (lines[i].flags & ML_EFFECT2)
lines[i].args[2] |= 136; lines[i].args[2] |= TMCF_SUBLIGHTB|TMCF_SUBFADEB;
break; break;
case 455: //Fade colormap case 455: //Fade colormap
{ {
@ -2832,17 +2832,17 @@ static void P_ConvertBinaryMap(void)
else else
lines[i].args[2] = (256 + speed - 1)/speed; lines[i].args[2] = (256 + speed - 1)/speed;
if (lines[i].flags & ML_EFFECT3) if (lines[i].flags & ML_EFFECT3)
lines[i].args[3] |= 1; lines[i].args[3] |= TMCF_RELATIVE;
if (lines[i].flags & ML_EFFECT1) if (lines[i].flags & ML_EFFECT1)
lines[i].args[3] |= 34; lines[i].args[3] |= TMCF_SUBLIGHTR|TMCF_SUBFADER;
if (lines[i].flags & ML_NOCLIMB) if (lines[i].flags & ML_NOCLIMB)
lines[i].args[3] |= 68; lines[i].args[3] |= TMCF_SUBLIGHTG|TMCF_SUBFADEG;
if (lines[i].flags & ML_EFFECT2) if (lines[i].flags & ML_EFFECT2)
lines[i].args[3] |= 136; lines[i].args[3] |= TMCF_SUBLIGHTB|TMCF_SUBFADEB;
if (lines[i].flags & ML_BOUNCY) if (lines[i].flags & ML_BOUNCY)
lines[i].args[3] |= 4096; lines[i].args[3] |= TMCF_FROMBLACK;
if (lines[i].flags & ML_EFFECT5) if (lines[i].flags & ML_EFFECT5)
lines[i].args[3] |= 8192; lines[i].args[3] |= TMCF_OVERRIDE;
break; break;
} }
case 456: //Stop fading colormap case 456: //Stop fading colormap

View file

@ -3532,7 +3532,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
P_ResetColormapFader(&sectors[secnum]); P_ResetColormapFader(&sectors[secnum]);
if (line->args[2] & 1) // relative calc if (line->args[2] & TMCF_RELATIVE)
{ {
extracolormap_t *target = (!udmf && (line->flags & ML_TFERLINE) && line->sidenum[1] != 0xFFFF) ? extracolormap_t *target = (!udmf && (line->flags & ML_TFERLINE) && line->sidenum[1] != 0xFFFF) ?
sides[line->sidenum[1]].colormap_data : sectors[secnum].extra_colormap; // use back colormap instead of target sector sides[line->sidenum[1]].colormap_data : sectors[secnum].extra_colormap; // use back colormap instead of target sector
@ -3540,17 +3540,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
extracolormap_t *exc = R_AddColormaps( extracolormap_t *exc = R_AddColormaps(
target, target,
source, source,
line->args[2] & 2, // subtract R line->args[2] & TMCF_SUBLIGHTR,
line->args[2] & 4, // subtract G line->args[2] & TMCF_SUBLIGHTG,
line->args[2] & 8, // subtract B line->args[2] & TMCF_SUBLIGHTB,
line->args[2] & 16, // subtract A line->args[2] & TMCF_SUBLIGHTA,
line->args[2] & 32, // subtract FadeR line->args[2] & TMCF_SUBFADER,
line->args[2] & 64, // subtract FadeG line->args[2] & TMCF_SUBFADEG,
line->args[2] & 128, // subtract FadeB line->args[2] & TMCF_SUBFADEB,
line->args[2] & 256, // subtract FadeA line->args[2] & TMCF_SUBFADEA,
line->args[2] & 512, // subtract FadeStart line->args[2] & TMCF_SUBFADESTART,
line->args[2] & 1024, // subtract FadeEnd line->args[2] & TMCF_SUBFADEEND,
line->args[2] & 2048, // ignore Flags line->args[2] & TMCF_IGNOREFLAGS,
false); false);
if (!(sectors[secnum].extra_colormap = R_GetColormapFromList(exc))) if (!(sectors[secnum].extra_colormap = R_GetColormapFromList(exc)))
@ -3868,7 +3868,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
continue; continue;
// Don't interrupt ongoing fade // Don't interrupt ongoing fade
if (!(line->args[3] & 8192) if (!(line->args[3] & TMCF_OVERRIDE)
&& sectors[secnum].fadecolormapdata) && sectors[secnum].fadecolormapdata)
//&& ((fadecolormap_t*)sectors[secnum].fadecolormapdata)->timer > (ticbased ? 2 : speed*2)) //&& ((fadecolormap_t*)sectors[secnum].fadecolormapdata)->timer > (ticbased ? 2 : speed*2))
{ {
@ -3882,7 +3882,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
exc = sectors[secnum].extra_colormap; exc = sectors[secnum].extra_colormap;
if (!(line->args[3] & 4096) // Override fade from default rgba if (!(line->args[3] & TMCF_FROMBLACK) // Override fade from default rgba
&& !R_CheckDefaultColormap(dest, true, false, false) && !R_CheckDefaultColormap(dest, true, false, false)
&& R_CheckDefaultColormap(exc, true, false, false)) && R_CheckDefaultColormap(exc, true, false, false))
{ {
@ -3904,22 +3904,22 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
else else
source_exc = exc ? exc : R_GetDefaultColormap(); source_exc = exc ? exc : R_GetDefaultColormap();
if (line->args[3] & 1) // relative calc if (line->args[3] & TMCF_RELATIVE)
{ {
exc = R_AddColormaps( exc = R_AddColormaps(
source_exc, source_exc,
dest, dest,
line->args[3] & 2, // subtract R line->args[3] & TMCF_SUBLIGHTR,
line->args[3] & 4, // subtract G line->args[3] & TMCF_SUBLIGHTG,
line->args[3] & 8, // subtract B line->args[3] & TMCF_SUBLIGHTB,
line->args[3] & 16, // subtract A line->args[3] & TMCF_SUBLIGHTA,
line->args[3] & 32, // subtract FadeR line->args[3] & TMCF_SUBFADER,
line->args[3] & 64, // subtract FadeG line->args[3] & TMCF_SUBFADEG,
line->args[3] & 128, // subtract FadeB line->args[3] & TMCF_SUBFADEB,
line->args[3] & 256, // subtract FadeA line->args[3] & TMCF_SUBFADEA,
line->args[3] & 512, // subtract FadeStart line->args[3] & TMCF_SUBFADESTART,
line->args[3] & 1024, // subtract FadeEnd line->args[3] & TMCF_SUBFADEEND,
line->args[3] & 2048, // ignore Flags line->args[3] & TMCF_IGNOREFLAGS,
false); false);
} }
else else

View file

@ -146,6 +146,24 @@ boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgb
boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams); boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams);
extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap); extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap);
typedef enum
{
TMCF_RELATIVE = 1,
TMCF_SUBLIGHTR = 1<<1,
TMCF_SUBLIGHTG = 1<<2,
TMCF_SUBLIGHTB = 1<<3,
TMCF_SUBLIGHTA = 1<<4,
TMCF_SUBFADER = 1<<5,
TMCF_SUBFADEG = 1<<6,
TMCF_SUBFADEB = 1<<7,
TMCF_SUBFADEA = 1<<8,
TMCF_SUBFADESTART = 1<<9,
TMCF_SUBFADEEND = 1<<10,
TMCF_IGNOREFLAGS = 1<<11,
TMCF_FROMBLACK = 1<<12,
TMCF_OVERRIDE = 1<<13,
} textmapcolormapflags_t;
lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap); lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap);
extracolormap_t * R_CreateColormapFromLinedef(char *p1, char *p2, char *p3); extracolormap_t * R_CreateColormapFromLinedef(char *p1, char *p2, char *p3);
extracolormap_t* R_CreateColormap(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags); extracolormap_t* R_CreateColormap(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags);