Merge branch 'udmf-argenums' into 'udmf-next'

No more magic numbers for linedef arg values in UDMF

See merge request STJr/SRB2!881
This commit is contained in:
Nev3r 2020-04-19 07:06:32 -04:00
commit 197d4e405d
6 changed files with 113 additions and 66 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
@ -2865,13 +2865,13 @@ static void P_ConvertBinaryMap(void)
boolean frontceil = (lines[i].special == 701 || lines[i].special == 702 || lines[i].special == 713); boolean frontceil = (lines[i].special == 701 || lines[i].special == 702 || lines[i].special == 713);
boolean backceil = (lines[i].special == 711 || lines[i].special == 712 || lines[i].special == 703); boolean backceil = (lines[i].special == 711 || lines[i].special == 712 || lines[i].special == 703);
lines[i].args[0] = backfloor ? 2 : (frontfloor ? 1 : 0); lines[i].args[0] = backfloor ? TMS_BACK : (frontfloor ? TMS_FRONT : TMS_NONE);
lines[i].args[1] = backceil ? 2 : (frontceil ? 1 : 0); lines[i].args[1] = backceil ? TMS_BACK : (frontceil ? TMS_FRONT : TMS_NONE);
if (lines[i].flags & ML_NETONLY) if (lines[i].flags & ML_NETONLY)
lines[i].args[2] |= SL_NOPHYSICS; lines[i].args[2] |= TMSL_NOPHYSICS;
if (lines[i].flags & ML_NONET) if (lines[i].flags & ML_NONET)
lines[i].args[2] |= SL_DYNAMIC; lines[i].args[2] |= TMSL_DYNAMIC;
lines[i].special = 700; lines[i].special = 700;
break; break;
@ -2882,13 +2882,13 @@ static void P_ConvertBinaryMap(void)
case 715: //Slope back sector ceiling by 3 tagged vertices case 715: //Slope back sector ceiling by 3 tagged vertices
{ {
if (lines[i].special == 704) if (lines[i].special == 704)
lines[i].args[0] = 0; lines[i].args[0] = TMSP_FRONTFLOOR;
else if (lines[i].special == 705) else if (lines[i].special == 705)
lines[i].args[0] = 1; lines[i].args[0] = TMSP_FRONTCEILING;
else if (lines[i].special == 714) else if (lines[i].special == 714)
lines[i].args[0] = 2; lines[i].args[0] = TMSP_BACKFLOOR;
else if (lines[i].special == 715) else if (lines[i].special == 715)
lines[i].args[0] = 3; lines[i].args[0] = TMSP_BACKCEILING;
lines[i].args[1] = lines[i].tag; lines[i].args[1] = lines[i].tag;
@ -2911,9 +2911,9 @@ static void P_ConvertBinaryMap(void)
} }
if (lines[i].flags & ML_NETONLY) if (lines[i].flags & ML_NETONLY)
lines[i].args[4] |= SL_NOPHYSICS; lines[i].args[4] |= TMSL_NOPHYSICS;
if (lines[i].flags & ML_NONET) if (lines[i].flags & ML_NONET)
lines[i].args[4] |= SL_DYNAMIC; lines[i].args[4] |= TMSL_DYNAMIC;
lines[i].special = 704; lines[i].special = 704;
break; break;

View File

@ -250,14 +250,14 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
vector2_t direction; vector2_t direction;
fixed_t nx, ny, dz, extent; fixed_t nx, ny, dz, extent;
boolean frontfloor = line->args[0] == 1; boolean frontfloor = line->args[0] == TMS_FRONT;
boolean backfloor = line->args[0] == 2; boolean backfloor = line->args[0] == TMS_BACK;
boolean frontceil = line->args[1] == 1; boolean frontceil = line->args[1] == TMS_FRONT;
boolean backceil = line->args[1] == 2; boolean backceil = line->args[1] == TMS_BACK;
UINT8 flags = 0; // Slope flags UINT8 flags = 0; // Slope flags
if (line->args[2] & 1) if (line->args[2] & TMSL_NOPHYSICS)
flags |= SL_NOPHYSICS; flags |= SL_NOPHYSICS;
if (line->args[2] & 2) if (line->args[2] & TMSL_DYNAMIC)
flags |= SL_DYNAMIC; flags |= SL_DYNAMIC;
if(!frontfloor && !backfloor && !frontceil && !backceil) if(!frontfloor && !backfloor && !frontceil && !backceil)
@ -464,26 +464,26 @@ static void line_SpawnViaMapthingVertexes(const int linenum, const boolean spawn
UINT16 tag2 = line->args[2]; UINT16 tag2 = line->args[2];
UINT16 tag3 = line->args[3]; UINT16 tag3 = line->args[3];
UINT8 flags = 0; // Slope flags UINT8 flags = 0; // Slope flags
if (line->args[4] & 1) if (line->args[4] & TMSL_NOPHYSICS)
flags |= SL_NOPHYSICS; flags |= SL_NOPHYSICS;
if (line->args[4] & 2) if (line->args[4] & TMSL_DYNAMIC)
flags |= SL_DYNAMIC; flags |= SL_DYNAMIC;
switch(line->args[0]) switch(line->args[0])
{ {
case 0: case TMSP_FRONTFLOOR:
slopetoset = &line->frontsector->f_slope; slopetoset = &line->frontsector->f_slope;
side = &sides[line->sidenum[0]]; side = &sides[line->sidenum[0]];
break; break;
case 1: case TMSP_FRONTCEILING:
slopetoset = &line->frontsector->c_slope; slopetoset = &line->frontsector->c_slope;
side = &sides[line->sidenum[0]]; side = &sides[line->sidenum[0]];
break; break;
case 2: case TMSP_BACKFLOOR:
slopetoset = &line->backsector->f_slope; slopetoset = &line->backsector->f_slope;
side = &sides[line->sidenum[1]]; side = &sides[line->sidenum[1]];
break; break;
case 3: case TMSP_BACKCEILING:
slopetoset = &line->backsector->c_slope; slopetoset = &line->backsector->c_slope;
side = &sides[line->sidenum[1]]; side = &sides[line->sidenum[1]];
default: default:
@ -605,13 +605,13 @@ void P_CopySectorSlope(line_t *line)
setback |= P_SetSlopeFromTag(bsec, line->args[2], false); setback |= P_SetSlopeFromTag(bsec, line->args[2], false);
setback |= P_SetSlopeFromTag(bsec, line->args[3], true); setback |= P_SetSlopeFromTag(bsec, line->args[3], true);
if (line->args[4] & 1) if (line->args[4] & TMSC_FRONTTOBACKFLOOR)
setback |= P_CopySlope(&bsec->f_slope, fsec->f_slope); setback |= P_CopySlope(&bsec->f_slope, fsec->f_slope);
if (line->args[4] & 2) if (line->args[4] & TMSC_BACKTOFRONTFLOOR)
setfront |= P_CopySlope(&fsec->f_slope, bsec->f_slope); setfront |= P_CopySlope(&fsec->f_slope, bsec->f_slope);
if (line->args[4] & 4) if (line->args[4] & TMSC_FRONTTOBACKCEILING)
setback |= P_CopySlope(&bsec->c_slope, fsec->c_slope); setback |= P_CopySlope(&bsec->c_slope, fsec->c_slope);
if (line->args[4] & 8) if (line->args[4] & TMSC_BACKTOFRONTCEILING)
setfront |= P_CopySlope(&fsec->c_slope, bsec->c_slope); setfront |= P_CopySlope(&fsec->c_slope, bsec->c_slope);
} }

View File

@ -18,6 +18,35 @@
extern pslope_t *slopelist; extern pslope_t *slopelist;
extern UINT16 slopecount; extern UINT16 slopecount;
typedef enum
{
TMSP_FRONTFLOOR,
TMSP_FRONTCEILING,
TMSP_BACKFLOOR,
TMSP_BACKCEILING,
} textmapslopeplane_t;
typedef enum
{
TMSC_FRONTTOBACKFLOOR = 1,
TMSC_BACKTOFRONTFLOOR = 1<<1,
TMSC_FRONTTOBACKCEILING = 1<<2,
TMSC_BACKTOFRONTCEILING = 1<<3,
} textmapslopecopy_t;
typedef enum
{
TMS_NONE,
TMS_FRONT,
TMS_BACK,
} textmapside_t;
typedef enum
{
TMSL_NOPHYSICS = 1,
TMSL_DYNAMIC = 2,
} textmapslopeflags_t;
void P_LinkSlopeThinkers (void); void P_LinkSlopeThinkers (void);
void P_CalculateSlopeNormal(pslope_t *slope); void P_CalculateSlopeNormal(pslope_t *slope);

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);