mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-06 16:31:47 +00:00
Add vertex slope spawning function.
Rename P_ResetDynamicSlopes() to P_SpawnSlopes().
This commit is contained in:
parent
0b21a34ddd
commit
faf127ff88
3 changed files with 59 additions and 5 deletions
|
@ -3582,7 +3582,7 @@ boolean P_LoadLevel(boolean fromnetsave)
|
||||||
P_InitSpecials();
|
P_InitSpecials();
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
P_ResetDynamicSlopes(fromnetsave);
|
P_SpawnSlopes(fromnetsave);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
P_SpawnMapThings(!fromnetsave);
|
P_SpawnMapThings(!fromnetsave);
|
||||||
|
|
|
@ -507,6 +507,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
|
||||||
|
@ -551,12 +601,16 @@ pslope_t *P_SlopeById(UINT16 id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reset slopes and read them from special lines.
|
/// Initializes and reads the slopes from the map data.
|
||||||
void P_ResetDynamicSlopes(const boolean fromsave) {
|
void P_SpawnSlopes(const boolean fromsave) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
slopelist = NULL;
|
slopelist = NULL;
|
||||||
slopecount = 0;
|
slopecount = 0;
|
||||||
|
|
||||||
|
/// Generates vertex slopes.
|
||||||
|
SpawnVertexSlopes();
|
||||||
|
|
||||||
/// Generates line special-defined slopes.
|
/// Generates line special-defined slopes.
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
|
@ -577,7 +631,7 @@ void P_ResetDynamicSlopes(const boolean fromsave) {
|
||||||
case 705:
|
case 705:
|
||||||
case 714:
|
case 714:
|
||||||
case 715:
|
case 715:
|
||||||
line_SpawnViaVertexes(i, !fromsave);
|
line_SpawnViaVertexes(i, !fromsave); // Mapthing-based vertex slopes.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -23,7 +23,7 @@ extern UINT16 slopecount;
|
||||||
void P_LinkSlopeThinkers (void);
|
void P_LinkSlopeThinkers (void);
|
||||||
|
|
||||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||||
void P_ResetDynamicSlopes(const boolean fromsave);
|
void P_SpawnSlopes(const boolean fromsave);
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_CopySectorSlope
|
// P_CopySectorSlope
|
||||||
|
|
Loading…
Reference in a new issue