Add "relative" setting to linedef type 799 and adapt it to UDMF

This commit is contained in:
MascaraSnake 2021-12-29 15:29:59 +01:00
parent 1e1ea22e51
commit 228efa5ffc
6 changed files with 60 additions and 17 deletions

View file

@ -3253,6 +3253,7 @@ linedeftypes
{
title = "Set Tagged Dynamic Slope Vertex to Front Sector Height";
prefix = "(799)";
flags64text = "[6] Use relative heights";
}
}

View file

@ -5233,5 +5233,21 @@ udmf
}
}
}
799
{
title = "Set Tagged Dynamic Slope Vertex to Front Sector Height";
prefix = "(799)";
arg0
{
title = "Apply height";
type = 11;
enum
{
0 = "Absolute";
1 = "Relative";
}
}
}
}
}

View file

@ -2294,12 +2294,17 @@ static inline void SaveDynamicLineSlopeThinker(const thinker_t *th, const UINT8
static inline void SaveDynamicVertexSlopeThinker(const thinker_t *th, const UINT8 type)
{
size_t i;
const dynvertexplanethink_t* ht = (const void*)th;
WRITEUINT8(save_p, type);
WRITEUINT32(save_p, SaveSlope(ht->slope));
WRITEMEM(save_p, ht->tags, sizeof(ht->tags));
WRITEMEM(save_p, ht->vex, sizeof(ht->vex));
for (i = 0; i < 3; i++)
WRITEUINT32(save_p, SaveSector(ht->secs[i]));
WRITEMEM(save_p, ht->vex, sizeof(ht->vex));
WRITEMEM(save_p, ht->origsecheights, sizeof(ht->origsecheights));
WRITEMEM(save_p, ht->origvecheights, sizeof(ht->origvecheights));
WRITEUINT8(save_p, ht->relative);
}
static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type)
@ -3468,12 +3473,17 @@ static inline thinker_t* LoadDynamicLineSlopeThinker(actionf_p1 thinker)
static inline thinker_t* LoadDynamicVertexSlopeThinker(actionf_p1 thinker)
{
size_t i;
dynvertexplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL);
ht->thinker.function.acp1 = thinker;
ht->slope = LoadSlope(READUINT32(save_p));
READMEM(save_p, ht->tags, sizeof(ht->tags));
for (i = 0; i < 3; i++)
ht->secs[i] = LoadSector(READUINT32(save_p));
READMEM(save_p, ht->vex, sizeof(ht->vex));
READMEM(save_p, ht->origsecheights, sizeof(ht->origsecheights));
READMEM(save_p, ht->origvecheights, sizeof(ht->origvecheights));
ht->relative = READUINT8(save_p);
return &ht->thinker;
}

View file

@ -4885,7 +4885,9 @@ static void P_ConvertBinaryMap(void)
lines[i].args[4] |= TMSC_BACKTOFRONTCEILING;
lines[i].special = 720;
break;
case 799: //Set dynamic slope vertex to front sector height
lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB);
break;
case 900: //Translucent wall (10%)
case 901: //Translucent wall (20%)
case 902: //Translucent wall (30%)

View file

@ -163,21 +163,17 @@ void T_DynamicSlopeLine (dynlineplanethink_t* th)
/// Mapthing-defined
void T_DynamicSlopeVert (dynvertexplanethink_t* th)
{
pslope_t* slope = th->slope;
size_t i;
INT32 l;
for (i = 0; i < 3; i++) {
l = Tag_FindLineSpecial(799, th->tags[i]);
if (l != -1) {
th->vex[i].z = lines[l].frontsector->floorheight;
}
for (i = 0; i < 3; i++)
{
if (th->relative & (1 << i))
th->vex[i].z = th->origvecheights[i] + (th->secs[i]->floorheight - th->origsecheights[i]);
else
th->vex[i].z = 0;
th->vex[i].z = th->secs[i]->floorheight;
}
ReconfigureViaVertexes(slope, th->vex[0], th->vex[1], th->vex[2]);
ReconfigureViaVertexes(th->slope, th->vex[0], th->vex[1], th->vex[2]);
}
static inline void P_AddDynLineSlopeThinker (pslope_t* slope, dynplanetype_t type, line_t* sourceline, fixed_t extent)
@ -194,10 +190,25 @@ static inline void P_AddDynLineSlopeThinker (pslope_t* slope, dynplanetype_t typ
static inline void P_AddDynVertexSlopeThinker (pslope_t* slope, const INT16 tags[3], const vector3_t vx[3])
{
dynvertexplanethink_t* th = Z_Calloc(sizeof (*th), PU_LEVSPEC, NULL);
size_t i;
INT32 l;
th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeVert;
th->slope = slope;
memcpy(th->tags, tags, sizeof(th->tags));
memcpy(th->vex, vx, sizeof(th->vex));
for (i = 0; i < 3; i++) {
l = Tag_FindLineSpecial(799, tags[i]);
if (l == -1)
{
Z_Free(th);
return;
}
th->secs[i] = lines[l].frontsector;
th->vex[i] = vx[i];
th->origsecheights[i] = lines[l].frontsector->floorheight;
th->origvecheights[i] = vx[i].z;
if (lines[l].args[0])
th->relative |= 1<<i;
}
P_AddThinker(THINK_DYNSLOPE, &th->thinker);
}

View file

@ -111,8 +111,11 @@ typedef struct
{
thinker_t thinker;
pslope_t *slope;
INT16 tags[3];
sector_t *secs[3];
vector3_t vex[3];
fixed_t origsecheights[3];
fixed_t origvecheights[3];
UINT8 relative;
} dynvertexplanethink_t;
void T_DynamicSlopeLine (dynlineplanethink_t* th);