Add enums to encapsulate the textmap slope settings

This commit is contained in:
MascaraSnake 2020-04-18 16:55:56 +02:00
parent 2a300bcea4
commit 111da04b07
3 changed files with 55 additions and 26 deletions

View File

@ -2705,13 +2705,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;
@ -2722,13 +2722,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;
@ -2751,9 +2751,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);