mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-20 19:02:34 +00:00
Make implementation of slope copying with linedef type 700 not hacky
This commit is contained in:
parent
696d4945a7
commit
34229030f2
4 changed files with 42 additions and 30 deletions
|
@ -5303,6 +5303,7 @@ udmf
|
|||
{
|
||||
1 = "No physics";
|
||||
2 = "Dynamic";
|
||||
4 = "Copy to other side";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4839,12 +4839,8 @@ static void P_ConvertBinaryMap(void)
|
|||
lines[i].args[2] |= TMSL_NOPHYSICS;
|
||||
if (lines[i].flags & ML_NONET)
|
||||
lines[i].args[2] |= TMSL_DYNAMIC;
|
||||
|
||||
if (lines[i].flags & ML_TFERLINE)
|
||||
{
|
||||
lines[i].args[4] |= backfloor ? TMSC_BACKTOFRONTFLOOR : (frontfloor ? TMSC_FRONTTOBACKFLOOR : 0);
|
||||
lines[i].args[4] |= backceil ? TMSC_BACKTOFRONTCEILING : (frontceil ? TMSC_FRONTTOBACKCEILING : 0);
|
||||
}
|
||||
lines[i].args[2] |= TMSL_COPY;
|
||||
|
||||
lines[i].special = 700;
|
||||
break;
|
||||
|
|
|
@ -277,6 +277,27 @@ static fixed_t GetExtent(sector_t *sector, line_t *line)
|
|||
return fardist;
|
||||
}
|
||||
|
||||
static boolean P_CopySlope(pslope_t** toslope, pslope_t* fromslope)
|
||||
{
|
||||
if (*toslope || !fromslope)
|
||||
return true;
|
||||
|
||||
*toslope = fromslope;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void P_UpdateHasSlope(sector_t *sec)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
sec->hasslope = true;
|
||||
|
||||
// if this is an FOF control sector, make sure any target sectors also are marked as having slopes
|
||||
if (sec->numattached)
|
||||
for (i = 0; i < sec->numattached; i++)
|
||||
sectors[sec->attached[i]].hasslope = true;
|
||||
}
|
||||
|
||||
/// Creates one or more slopes based on the given line type and front/back sectors.
|
||||
static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
||||
{
|
||||
|
@ -444,6 +465,23 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
|||
P_AddDynLineSlopeThinker(cslope, DP_BACKCEIL, line, extent);
|
||||
}
|
||||
}
|
||||
|
||||
if (line->args[2] & TMSL_COPY)
|
||||
{
|
||||
if (frontfloor)
|
||||
P_CopySlope(&line->backsector->f_slope, line->frontsector->f_slope);
|
||||
if (backfloor)
|
||||
P_CopySlope(&line->frontsector->f_slope, line->backsector->f_slope);
|
||||
if (frontceil)
|
||||
P_CopySlope(&line->backsector->c_slope, line->frontsector->c_slope);
|
||||
if (backceil)
|
||||
P_CopySlope(&line->frontsector->c_slope, line->backsector->c_slope);
|
||||
|
||||
if (backfloor || backceil)
|
||||
P_UpdateHasSlope(line->frontsector);
|
||||
if (frontfloor || frontceil)
|
||||
P_UpdateHasSlope(line->backsector);
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new slope from three mapthings with the specified IDs
|
||||
|
@ -600,27 +638,6 @@ static boolean P_SetSlopeFromTag(sector_t *sec, INT32 tag, boolean ceiling)
|
|||
return false;
|
||||
}
|
||||
|
||||
static boolean P_CopySlope(pslope_t **toslope, pslope_t *fromslope)
|
||||
{
|
||||
if (*toslope || !fromslope)
|
||||
return true;
|
||||
|
||||
*toslope = fromslope;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void P_UpdateHasSlope(sector_t *sec)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
sec->hasslope = true;
|
||||
|
||||
// if this is an FOF control sector, make sure any target sectors also are marked as having slopes
|
||||
if (sec->numattached)
|
||||
for (i = 0; i < sec->numattached; i++)
|
||||
sectors[sec->attached[i]].hasslope = true;
|
||||
}
|
||||
|
||||
//
|
||||
// P_CopySectorSlope
|
||||
//
|
||||
|
@ -710,9 +727,6 @@ void P_SpawnSlopes(const boolean fromsave) {
|
|||
for (i = 0; i < numlines; i++)
|
||||
switch (lines[i].special)
|
||||
{
|
||||
case 700:
|
||||
if (lines[i].flags & ML_TFERLINE) P_CopySectorSlope(&lines[i]);
|
||||
break;
|
||||
case 720:
|
||||
P_CopySectorSlope(&lines[i]);
|
||||
default:
|
||||
|
|
|
@ -44,7 +44,8 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
TMSL_NOPHYSICS = 1,
|
||||
TMSL_DYNAMIC = 2,
|
||||
TMSL_DYNAMIC = 1<<1,
|
||||
TMSL_COPY = 1<<2,
|
||||
} textmapslopeflags_t;
|
||||
|
||||
void P_LinkSlopeThinkers (void);
|
||||
|
|
Loading…
Reference in a new issue