mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 05:41:42 +00:00
Add enums to encapsulate the textmap colormap settings
This commit is contained in:
parent
f0c63ce76a
commit
09506112d7
4 changed files with 58 additions and 40 deletions
|
@ -1630,7 +1630,7 @@ udmf
|
|||
4 = "Subtract light G";
|
||||
8 = "Subtract light B";
|
||||
16 = "Subtract light A";
|
||||
32 = "Subtract light R";
|
||||
32 = "Subtract fade R";
|
||||
64 = "Subtract fade G";
|
||||
128 = "Subtract fade B";
|
||||
256 = "Subtract fade A";
|
||||
|
@ -1670,7 +1670,7 @@ udmf
|
|||
4 = "Subtract light G";
|
||||
8 = "Subtract light B";
|
||||
16 = "Subtract light A";
|
||||
32 = "Subtract light R";
|
||||
32 = "Subtract fade R";
|
||||
64 = "Subtract fade G";
|
||||
128 = "Subtract fade B";
|
||||
256 = "Subtract fade A";
|
||||
|
|
|
@ -1825,12 +1825,12 @@ static void P_ProcessLinedefsAfterSidedefs(void)
|
|||
if (alpha < 0)
|
||||
{
|
||||
alpha *= -1;
|
||||
ld->args[2] |= 16;
|
||||
ld->args[2] |= TMCF_SUBLIGHTA;
|
||||
}
|
||||
if (fadealpha < 0)
|
||||
{
|
||||
fadealpha *= -1;
|
||||
ld->args[2] |= 256;
|
||||
ld->args[2] |= TMCF_SUBFADEA;
|
||||
}
|
||||
|
||||
exc->rgba = R_GetRgbaRGB(exc->rgba) + R_PutRgbaA(alpha);
|
||||
|
@ -2812,13 +2812,13 @@ static void P_ConvertBinaryMap(void)
|
|||
case 447: //Change colormap
|
||||
lines[i].args[0] = lines[i].tag;
|
||||
if (lines[i].flags & ML_EFFECT3)
|
||||
lines[i].args[2] |= 1;
|
||||
lines[i].args[2] |= TMCF_RELATIVE;
|
||||
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)
|
||||
lines[i].args[2] |= 68;
|
||||
lines[i].args[2] |= TMCF_SUBLIGHTG|TMCF_SUBFADEG;
|
||||
if (lines[i].flags & ML_EFFECT2)
|
||||
lines[i].args[2] |= 136;
|
||||
lines[i].args[2] |= TMCF_SUBLIGHTB|TMCF_SUBFADEB;
|
||||
break;
|
||||
case 455: //Fade colormap
|
||||
{
|
||||
|
@ -2832,17 +2832,17 @@ static void P_ConvertBinaryMap(void)
|
|||
else
|
||||
lines[i].args[2] = (256 + speed - 1)/speed;
|
||||
if (lines[i].flags & ML_EFFECT3)
|
||||
lines[i].args[3] |= 1;
|
||||
lines[i].args[3] |= TMCF_RELATIVE;
|
||||
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)
|
||||
lines[i].args[3] |= 68;
|
||||
lines[i].args[3] |= TMCF_SUBLIGHTG|TMCF_SUBFADEG;
|
||||
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)
|
||||
lines[i].args[3] |= 4096;
|
||||
lines[i].args[3] |= TMCF_FROMBLACK;
|
||||
if (lines[i].flags & ML_EFFECT5)
|
||||
lines[i].args[3] |= 8192;
|
||||
lines[i].args[3] |= TMCF_OVERRIDE;
|
||||
break;
|
||||
}
|
||||
case 456: //Stop fading colormap
|
||||
|
|
52
src/p_spec.c
52
src/p_spec.c
|
@ -3532,7 +3532,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
|
||||
P_ResetColormapFader(§ors[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) ?
|
||||
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(
|
||||
target,
|
||||
source,
|
||||
line->args[2] & 2, // subtract R
|
||||
line->args[2] & 4, // subtract G
|
||||
line->args[2] & 8, // subtract B
|
||||
line->args[2] & 16, // subtract A
|
||||
line->args[2] & 32, // subtract FadeR
|
||||
line->args[2] & 64, // subtract FadeG
|
||||
line->args[2] & 128, // subtract FadeB
|
||||
line->args[2] & 256, // subtract FadeA
|
||||
line->args[2] & 512, // subtract FadeStart
|
||||
line->args[2] & 1024, // subtract FadeEnd
|
||||
line->args[2] & 2048, // ignore Flags
|
||||
line->args[2] & TMCF_SUBLIGHTR,
|
||||
line->args[2] & TMCF_SUBLIGHTG,
|
||||
line->args[2] & TMCF_SUBLIGHTB,
|
||||
line->args[2] & TMCF_SUBLIGHTA,
|
||||
line->args[2] & TMCF_SUBFADER,
|
||||
line->args[2] & TMCF_SUBFADEG,
|
||||
line->args[2] & TMCF_SUBFADEB,
|
||||
line->args[2] & TMCF_SUBFADEA,
|
||||
line->args[2] & TMCF_SUBFADESTART,
|
||||
line->args[2] & TMCF_SUBFADEEND,
|
||||
line->args[2] & TMCF_IGNOREFLAGS,
|
||||
false);
|
||||
|
||||
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;
|
||||
|
||||
// Don't interrupt ongoing fade
|
||||
if (!(line->args[3] & 8192)
|
||||
if (!(line->args[3] & TMCF_OVERRIDE)
|
||||
&& sectors[secnum].fadecolormapdata)
|
||||
//&& ((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;
|
||||
|
||||
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(exc, true, false, false))
|
||||
{
|
||||
|
@ -3904,22 +3904,22 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
else
|
||||
source_exc = exc ? exc : R_GetDefaultColormap();
|
||||
|
||||
if (line->args[3] & 1) // relative calc
|
||||
if (line->args[3] & TMCF_RELATIVE)
|
||||
{
|
||||
exc = R_AddColormaps(
|
||||
source_exc,
|
||||
dest,
|
||||
line->args[3] & 2, // subtract R
|
||||
line->args[3] & 4, // subtract G
|
||||
line->args[3] & 8, // subtract B
|
||||
line->args[3] & 16, // subtract A
|
||||
line->args[3] & 32, // subtract FadeR
|
||||
line->args[3] & 64, // subtract FadeG
|
||||
line->args[3] & 128, // subtract FadeB
|
||||
line->args[3] & 256, // subtract FadeA
|
||||
line->args[3] & 512, // subtract FadeStart
|
||||
line->args[3] & 1024, // subtract FadeEnd
|
||||
line->args[3] & 2048, // ignore Flags
|
||||
line->args[3] & TMCF_SUBLIGHTR,
|
||||
line->args[3] & TMCF_SUBLIGHTG,
|
||||
line->args[3] & TMCF_SUBLIGHTB,
|
||||
line->args[3] & TMCF_SUBLIGHTA,
|
||||
line->args[3] & TMCF_SUBFADER,
|
||||
line->args[3] & TMCF_SUBFADEG,
|
||||
line->args[3] & TMCF_SUBFADEB,
|
||||
line->args[3] & TMCF_SUBFADEA,
|
||||
line->args[3] & TMCF_SUBFADESTART,
|
||||
line->args[3] & TMCF_SUBFADEEND,
|
||||
line->args[3] & TMCF_IGNOREFLAGS,
|
||||
false);
|
||||
}
|
||||
else
|
||||
|
|
18
src/r_data.h
18
src/r_data.h
|
@ -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);
|
||||
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);
|
||||
extracolormap_t * R_CreateColormapFromLinedef(char *p1, char *p2, char *p3);
|
||||
extracolormap_t* R_CreateColormap(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags);
|
||||
|
|
Loading…
Reference in a new issue