mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-23 12:21:07 +00:00
Add native textmap vertex slope support.
This commit is contained in:
parent
163e8c7155
commit
bdc45633d1
3 changed files with 58 additions and 5 deletions
|
@ -722,7 +722,7 @@ static void GeneralDefaults(void)
|
||||||
side_t *sd;
|
side_t *sd;
|
||||||
sector_t *sc;
|
sector_t *sc;
|
||||||
mapthing_t *mt;
|
mapthing_t *mt;
|
||||||
// vertex_t* vt;
|
vertex_t* vt;
|
||||||
|
|
||||||
for (i = 0, ld = lines; i < numlines; i++, ld++)
|
for (i = 0, ld = lines; i < numlines; i++, ld++)
|
||||||
{
|
{
|
||||||
|
@ -848,7 +848,7 @@ static void GeneralDefaults(void)
|
||||||
mt->xdeathtrigger = 0;
|
mt->xdeathtrigger = 0;
|
||||||
mt->raisetrigger = 0;*/
|
mt->raisetrigger = 0;*/
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
for (i = 0, vt = vertexes; i < numvertexes; i++, vt++)
|
for (i = 0, vt = vertexes; i < numvertexes; i++, vt++)
|
||||||
{
|
{
|
||||||
// Initialization.
|
// Initialization.
|
||||||
|
@ -857,7 +857,7 @@ static void GeneralDefaults(void)
|
||||||
vt->floorzset = false;
|
vt->floorzset = false;
|
||||||
vt->ceilingzset = false;
|
vt->ceilingzset = false;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set map defaults in UDMF format.
|
/** Set map defaults in UDMF format.
|
||||||
|
@ -1002,7 +1002,6 @@ static void TextmapVertex(UINT32 i, char *param)
|
||||||
vertexes[i].x = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
vertexes[i].x = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
||||||
else if (fastcmp(param, "y"))
|
else if (fastcmp(param, "y"))
|
||||||
vertexes[i].y = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
vertexes[i].y = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
||||||
#ifdef ADVUDMF
|
|
||||||
else if (fastcmp(param, "zfloor"))
|
else if (fastcmp(param, "zfloor"))
|
||||||
{
|
{
|
||||||
vertexes[i].floorz = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
vertexes[i].floorz = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
||||||
|
@ -1013,7 +1012,6 @@ static void TextmapVertex(UINT32 i, char *param)
|
||||||
vertexes[i].ceilingz = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
vertexes[i].ceilingz = FLOAT_TO_FIXED(atof(M_GetToken(NULL)));
|
||||||
vertexes[i].ceilingzset = true;
|
vertexes[i].ceilingzset = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Auxiliary function for TextmapParse.
|
/** Auxiliary function for TextmapParse.
|
||||||
|
|
|
@ -508,6 +508,56 @@ static void line_SpawnViaVertexes(const int linenum, const boolean spawnthinker)
|
||||||
side->sector->hasslope = true;
|
side->sector->hasslope = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Spawn textmap vertex slopes.
|
||||||
|
void SpawnVertexSlopes (void)
|
||||||
|
{
|
||||||
|
line_t *l1, *l2;
|
||||||
|
sector_t* sc;
|
||||||
|
vertex_t *v1, *v2, *v3;
|
||||||
|
size_t i;
|
||||||
|
for (i = 0, sc = sectors; i < numsectors; i++, sc++)
|
||||||
|
{
|
||||||
|
// The vertex slopes only work for 3-vertex sectors (and thus 3-sided sectors).
|
||||||
|
if (sc->linecount != 3)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
l1 = sc->lines[0];
|
||||||
|
l2 = sc->lines[1];
|
||||||
|
|
||||||
|
// Determine the vertexes.
|
||||||
|
v1 = l1->v1;
|
||||||
|
v2 = l1->v2;
|
||||||
|
if ((l2->v1 != v1) && (l2->v1 != v2))
|
||||||
|
v3 = l2->v1;
|
||||||
|
else
|
||||||
|
v3 = l2->v2;
|
||||||
|
|
||||||
|
if (v1->floorzset || v2->floorzset || v3->floorzset)
|
||||||
|
{
|
||||||
|
vector3_t vtx[3] = {
|
||||||
|
{v1->x, v1->y, v1->floorzset == true ? v1->floorz : sc->floorheight},
|
||||||
|
{v2->x, v2->y, v2->floorzset == true ? v2->floorz : sc->floorheight},
|
||||||
|
{v3->x, v3->y, v3->floorzset == true ? v3->floorz : sc->floorheight}};
|
||||||
|
pslope_t* slop = Slope_Add(0);
|
||||||
|
sc->f_slope = slop;
|
||||||
|
sc->hasslope = true;
|
||||||
|
ReconfigureViaVertexes(slop, vtx[0], vtx[1], vtx[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v1->ceilingzset || v2->ceilingzset || v3->ceilingzset)
|
||||||
|
{
|
||||||
|
vector3_t vtx[3] = {
|
||||||
|
{v1->x, v1->y, v1->ceilingzset == true ? v1->ceilingz : sc->ceilingheight},
|
||||||
|
{v2->x, v2->y, v2->ceilingzset == true ? v2->ceilingz : sc->ceilingheight},
|
||||||
|
{v3->x, v3->y, v3->ceilingzset == true ? v3->ceilingz : sc->ceilingheight}};
|
||||||
|
pslope_t* slop = Slope_Add(0);
|
||||||
|
sc->c_slope = slop;
|
||||||
|
sc->hasslope = true;
|
||||||
|
ReconfigureViaVertexes(slop, vtx[0], vtx[1], vtx[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_CopySectorSlope
|
// P_CopySectorSlope
|
||||||
|
@ -561,6 +611,9 @@ void P_ResetDynamicSlopes(const UINT32 fromsave) {
|
||||||
slopelist = NULL;
|
slopelist = NULL;
|
||||||
slopecount = 0;
|
slopecount = 0;
|
||||||
|
|
||||||
|
/// Generates vertex-based Textmap UDMF slopes.
|
||||||
|
SpawnVertexSlopes();
|
||||||
|
|
||||||
/// Generates line special-defined slopes.
|
/// Generates line special-defined slopes.
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,6 +84,8 @@ typedef struct extracolormap_s
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t x, y, z;
|
fixed_t x, y, z;
|
||||||
|
fixed_t floorz, ceilingz;
|
||||||
|
boolean floorzset, ceilingzset;
|
||||||
} vertex_t;
|
} vertex_t;
|
||||||
|
|
||||||
// Forward of linedefs, for sectors.
|
// Forward of linedefs, for sectors.
|
||||||
|
|
Loading…
Reference in a new issue