mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 11:40:52 +00:00
Holy shit. I spent two hours staring at how garbage this code was and didn't even realise it was #ifdef'd out behind a define not even mentioned in doomdef.h. It's not actually used anywhere (superseded entirely by the much nicer, much more relevant P_NewVertexSlope()... out with you, ancient, foul demons who should've been SPRINGCLEANed long ago.
This commit is contained in:
parent
ad61050bb0
commit
6058eec1c9
2 changed files with 0 additions and 275 deletions
255
src/p_slopes.c
255
src/p_slopes.c
|
@ -624,261 +624,6 @@ pslope_t *P_SlopeById(UINT16 id)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SPRINGCLEAN
|
|
||||||
#include "byteptr.h"
|
|
||||||
|
|
||||||
#include "p_setup.h"
|
|
||||||
#include "p_local.h"
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// P_SetSlopesFromVertexHeights
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum)
|
|
||||||
{
|
|
||||||
mapthing_t *mt;
|
|
||||||
boolean vt_found = false;
|
|
||||||
size_t i, j, k, l, q;
|
|
||||||
|
|
||||||
//size_t i;
|
|
||||||
//mapthing_t *mt;
|
|
||||||
char *data;
|
|
||||||
char *datastart;
|
|
||||||
|
|
||||||
// SRB2CBTODO: WHAT IS (5 * sizeof (short))?! It = 10
|
|
||||||
// anything else seems to make a map not load properly,
|
|
||||||
// but this hard-coded value MUST have some reason for being what it is
|
|
||||||
size_t snummapthings = W_LumpLength(lumpnum) / (5 * sizeof (short));
|
|
||||||
mapthing_t *smapthings = Z_Calloc(snummapthings * sizeof (*smapthings), PU_LEVEL, NULL);
|
|
||||||
fixed_t x, y;
|
|
||||||
sector_t *sector;
|
|
||||||
// Spawn axis points first so they are
|
|
||||||
// at the front of the list for fast searching.
|
|
||||||
data = datastart = W_CacheLumpNum(lumpnum, PU_LEVEL);
|
|
||||||
mt = smapthings;
|
|
||||||
for (i = 0; i < snummapthings; i++, mt++)
|
|
||||||
{
|
|
||||||
mt->x = READINT16(data);
|
|
||||||
mt->y = READINT16(data);
|
|
||||||
mt->angle = READINT16(data);
|
|
||||||
mt->type = READINT16(data);
|
|
||||||
mt->options = READINT16(data);
|
|
||||||
// mt->z hasn't been set yet!
|
|
||||||
//mt->extrainfo = (byte)(mt->type >> 12); // slope things are special, they have a bigger range of types
|
|
||||||
|
|
||||||
//mt->type &= 4095; // SRB2CBTODO: WHAT IS THIS???? Mobj type limits?!!!!
|
|
||||||
x = mt->x*FRACUNIT;
|
|
||||||
y = mt->y*FRACUNIT;
|
|
||||||
sector = R_PointInSubsector(x, y)->sector;
|
|
||||||
// Z for objects
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (sector->f_slope)
|
|
||||||
mt->z = (short)(P_GetZAt(sector->f_slope, x, y)>>FRACBITS);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
mt->z = (short)(sector->floorheight>>FRACBITS);
|
|
||||||
|
|
||||||
mt->z = mt->z + (mt->options >> ZSHIFT);
|
|
||||||
|
|
||||||
if (mt->type == THING_VertexFloorZ || mt->type == THING_VertexCeilingZ) // THING_VertexFloorZ
|
|
||||||
{
|
|
||||||
for(l = 0; l < numvertexes; l++)
|
|
||||||
{
|
|
||||||
if (vertexes[l].x == mt->x*FRACUNIT && vertexes[l].y == mt->y*FRACUNIT)
|
|
||||||
{
|
|
||||||
if (mt->type == THING_VertexFloorZ)
|
|
||||||
{
|
|
||||||
vertexes[l].z = mt->z*FRACUNIT;
|
|
||||||
//I_Error("Z value: %i", vertexes[l].z/FRACUNIT);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vertexes[l].z = mt->z*FRACUNIT; // celing floor
|
|
||||||
}
|
|
||||||
vt_found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//mt->type = 0; // VPHYSICS: Dynamic slopes
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (vt_found)
|
|
||||||
{
|
|
||||||
for (k = 0; k < numsectors; k++)
|
|
||||||
{
|
|
||||||
sector_t *sec = §ors[k];
|
|
||||||
if (sec->linecount != 3) continue; // only works with triangular sectors
|
|
||||||
|
|
||||||
v3float_t vt1, vt2, vt3; // cross = ret->normalf
|
|
||||||
v3float_t vec1, vec2;
|
|
||||||
|
|
||||||
int vi1, vi2, vi3;
|
|
||||||
|
|
||||||
vi1 = (int)(sec->lines[0]->v1 - vertexes);
|
|
||||||
vi2 = (int)(sec->lines[0]->v2 - vertexes);
|
|
||||||
vi3 = (sec->lines[1]->v1 == sec->lines[0]->v1 || sec->lines[1]->v1 == sec->lines[0]->v2)?
|
|
||||||
(int)(sec->lines[1]->v2 - vertexes) : (int)(sec->lines[1]->v1 - vertexes);
|
|
||||||
|
|
||||||
//if (vertexes[vi1].z)
|
|
||||||
// I_Error("OSNAP %i", vertexes[vi1].z/FRACUNIT);
|
|
||||||
//if (vertexes[vi2].z)
|
|
||||||
// I_Error("OSNAP %i", vertexes[vi2].z/FRACUNIT);
|
|
||||||
//if (vertexes[vi3].z)
|
|
||||||
// I_Error("OSNAP %i", vertexes[vi3].z/FRACUNIT);
|
|
||||||
|
|
||||||
//I_Error("%i, %i", mt->z*FRACUNIT, vertexes[vi1].z);
|
|
||||||
|
|
||||||
//I_Error("%i, %i, %i", mt->x, mt->y, mt->z);
|
|
||||||
//P_SpawnMobj(mt->x*FRACUNIT, mt->y*FRACUNIT, mt->z*FRACUNIT, MT_RING);
|
|
||||||
|
|
||||||
// TODO: Make sure not to spawn in the same place 2x! (we need an object in every vertex of the
|
|
||||||
// triangle sector to setup the real vertex slopes
|
|
||||||
// Check for the vertexes of all sectors
|
|
||||||
for(q = 0; q < numvertexes; q++)
|
|
||||||
{
|
|
||||||
if (vertexes[q].x == mt->x*FRACUNIT && vertexes[q].y == mt->y*FRACUNIT)
|
|
||||||
{
|
|
||||||
//I_Error("yeah %i", vertexes[q].z);
|
|
||||||
P_SpawnMobj(vertexes[q].x, vertexes[q].y, vertexes[q].z, MT_RING);
|
|
||||||
#if 0
|
|
||||||
if ((mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z)
|
|
||||||
&& !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z)
|
|
||||||
&& !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z))
|
|
||||||
P_SpawnMobj(vertexes[vi1].x, vertexes[vi1].y, vertexes[vi1].z, MT_RING);
|
|
||||||
else if ((mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z)
|
|
||||||
&& !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z)
|
|
||||||
&& !(mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z))
|
|
||||||
P_SpawnMobj(vertexes[vi2].x, vertexes[vi2].y, vertexes[vi2].z, MT_BOUNCETV);
|
|
||||||
else if ((mt->y*FRACUNIT == vertexes[vi3].y && mt->x*FRACUNIT == vertexes[vi3].x && mt->z*FRACUNIT == vertexes[vi3].z)
|
|
||||||
&& !(mt->y*FRACUNIT == vertexes[vi2].y && mt->x*FRACUNIT == vertexes[vi2].x && mt->z*FRACUNIT == vertexes[vi2].z)
|
|
||||||
&& !(mt->y*FRACUNIT == vertexes[vi1].y && mt->x*FRACUNIT == vertexes[vi1].x && mt->z*FRACUNIT == vertexes[vi1].z))
|
|
||||||
P_SpawnMobj(vertexes[vi3].x, vertexes[vi3].y, vertexes[vi3].z, MT_GFZFLOWER1);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vt1.x = FIXED_TO_FLOAT(vertexes[vi1].x);
|
|
||||||
vt1.y = FIXED_TO_FLOAT(vertexes[vi1].y);
|
|
||||||
vt2.x = FIXED_TO_FLOAT(vertexes[vi2].x);
|
|
||||||
vt2.y = FIXED_TO_FLOAT(vertexes[vi2].y);
|
|
||||||
vt3.x = FIXED_TO_FLOAT(vertexes[vi3].x);
|
|
||||||
vt3.y = FIXED_TO_FLOAT(vertexes[vi3].y);
|
|
||||||
|
|
||||||
for(j = 0; j < 2; j++)
|
|
||||||
{
|
|
||||||
|
|
||||||
fixed_t z3;
|
|
||||||
//I_Error("Lo hicimos");
|
|
||||||
|
|
||||||
vt1.z = mt->z;//FIXED_TO_FLOAT(j==0 ? sec->floorheight : sec->ceilingheight);
|
|
||||||
vt2.z = mt->z;//FIXED_TO_FLOAT(j==0? sec->floorheight : sec->ceilingheight);
|
|
||||||
z3 = mt->z;//j==0? sec->floorheight : sec->ceilingheight; // Destination height
|
|
||||||
vt3.z = FIXED_TO_FLOAT(z3);
|
|
||||||
|
|
||||||
if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0)
|
|
||||||
{
|
|
||||||
vec1.x = vt2.x - vt3.x;
|
|
||||||
vec1.y = vt2.y - vt3.y;
|
|
||||||
vec1.z = vt2.z - vt3.z;
|
|
||||||
|
|
||||||
vec2.x = vt1.x - vt3.x;
|
|
||||||
vec2.y = vt1.y - vt3.y;
|
|
||||||
vec2.z = vt1.z - vt3.z;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vec1.x = vt1.x - vt3.x;
|
|
||||||
vec1.y = vt1.y - vt3.y;
|
|
||||||
vec1.z = vt1.z - vt3.z;
|
|
||||||
|
|
||||||
vec2.x = vt2.x - vt3.x;
|
|
||||||
vec2.y = vt2.y - vt3.y;
|
|
||||||
vec2.z = vt2.z - vt3.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL);
|
|
||||||
memset(ret, 0, sizeof(*ret));
|
|
||||||
|
|
||||||
{
|
|
||||||
M_CrossProduct3f(&ret->normalf, &vec1, &vec2);
|
|
||||||
|
|
||||||
// Cross product length
|
|
||||||
float len = (float)sqrt(ret->normalf.x * ret->normalf.x +
|
|
||||||
ret->normalf.y * ret->normalf.y +
|
|
||||||
ret->normalf.z * ret->normalf.z);
|
|
||||||
|
|
||||||
if (len == 0)
|
|
||||||
{
|
|
||||||
// Only happens when all vertices in this sector are on the same line.
|
|
||||||
// Let's just ignore this case.
|
|
||||||
//CONS_Printf("Slope thing at (%d,%d) lies directly on its target line.\n", (int)(x>>16), (int)(y>>16));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// cross/len
|
|
||||||
ret->normalf.x /= len;
|
|
||||||
ret->normalf.y /= len;
|
|
||||||
ret->normalf.z /= len;
|
|
||||||
|
|
||||||
// ZDoom cross = ret->normalf
|
|
||||||
// Fix backward normals
|
|
||||||
if ((ret->normalf.z < 0 && j == 0) || (ret->normalf.z > 0 && j == 1))
|
|
||||||
{
|
|
||||||
// cross = -cross
|
|
||||||
ret->normalf.x = -ret->normalf.x;
|
|
||||||
ret->normalf.y = -ret->normalf.x;
|
|
||||||
ret->normalf.z = -ret->normalf.x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
secplane_t *srcplane = Z_Calloc(sizeof(*srcplane), PU_LEVEL, NULL);
|
|
||||||
|
|
||||||
srcplane->a = FLOAT_TO_FIXED (ret->normalf.x);
|
|
||||||
srcplane->b = FLOAT_TO_FIXED (ret->normalf.y);
|
|
||||||
srcplane->c = FLOAT_TO_FIXED (ret->normalf.z);
|
|
||||||
//srcplane->ic = FixedDiv(FRACUNIT, srcplane->c);
|
|
||||||
srcplane->d = -TMulScale16 (srcplane->a, vertexes[vi3].x,
|
|
||||||
srcplane->b, vertexes[vi3].y,
|
|
||||||
srcplane->c, z3);
|
|
||||||
|
|
||||||
if (j == 0)
|
|
||||||
{
|
|
||||||
sec->f_slope = ret;
|
|
||||||
sec->f_slope->secplane = *srcplane;
|
|
||||||
}
|
|
||||||
else if (j == 1)
|
|
||||||
{
|
|
||||||
sec->c_slope = ret;
|
|
||||||
sec->c_slope->secplane = *srcplane;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Z_Free(datastart);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
|
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
|
||||||
void P_ResetDynamicSlopes(void) {
|
void P_ResetDynamicSlopes(void) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
|
@ -21,26 +21,6 @@ void P_RunDynamicSlopes(void);
|
||||||
// sectors.
|
// sectors.
|
||||||
void P_SpawnSlope_Line(int linenum);
|
void P_SpawnSlope_Line(int linenum);
|
||||||
|
|
||||||
#ifdef SPRINGCLEAN
|
|
||||||
// Loads just map objects that make slopes,
|
|
||||||
// terrain affecting objects have to be spawned first
|
|
||||||
void P_SetSlopesFromVertexHeights(lumpnum_t lumpnum);
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
THING_SlopeFloorPointLine = 9500,
|
|
||||||
THING_SlopeCeilingPointLine = 9501,
|
|
||||||
THING_SetFloorSlope = 9502,
|
|
||||||
THING_SetCeilingSlope = 9503,
|
|
||||||
THING_CopyFloorPlane = 9510,
|
|
||||||
THING_CopyCeilingPlane = 9511,
|
|
||||||
THING_VavoomFloor=1500,
|
|
||||||
THING_VavoomCeiling=1501,
|
|
||||||
THING_VertexFloorZ=1504,
|
|
||||||
THING_VertexCeilingZ=1505,
|
|
||||||
} slopething_e;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_CopySectorSlope
|
// P_CopySectorSlope
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue