mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge p_slopes.c
This commit is contained in:
parent
337db54965
commit
a73b9a9a0d
1 changed files with 0 additions and 68 deletions
|
|
@ -29,13 +29,8 @@ UINT16 slopecount = 0;
|
||||||
// Calculate line normal
|
// Calculate line normal
|
||||||
void P_CalculateSlopeNormal(pslope_t *slope) {
|
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||||
<<<<<<< HEAD
|
|
||||||
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
|
|
||||||
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
|
|
||||||
=======
|
|
||||||
slope->normal.x = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
|
slope->normal.x = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
|
||||||
slope->normal.y = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
|
slope->normal.y = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
|
||||||
>>>>>>> srb2/next
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Setup slope via 3 vertexes.
|
/// Setup slope via 3 vertexes.
|
||||||
|
|
@ -43,52 +38,6 @@ static void ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const v
|
||||||
{
|
{
|
||||||
vector3_t vec1, vec2;
|
vector3_t vec1, vec2;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Set slope normal
|
|
||||||
vec1.x = (slope->vertices[1]->x - slope->vertices[0]->x) << FRACBITS;
|
|
||||||
vec1.y = (slope->vertices[1]->y - slope->vertices[0]->y) << FRACBITS;
|
|
||||||
vec1.z = (slope->vertices[1]->z - slope->vertices[0]->z) << FRACBITS;
|
|
||||||
|
|
||||||
vec2.x = (slope->vertices[2]->x - slope->vertices[0]->x) << FRACBITS;
|
|
||||||
vec2.y = (slope->vertices[2]->y - slope->vertices[0]->y) << FRACBITS;
|
|
||||||
vec2.z = (slope->vertices[2]->z - slope->vertices[0]->z) << FRACBITS;
|
|
||||||
|
|
||||||
// ugggggggh fixed-point maaaaaaath
|
|
||||||
slope->extent = max(
|
|
||||||
max(max(abs(vec1.x), abs(vec1.y)), abs(vec1.z)),
|
|
||||||
max(max(abs(vec2.x), abs(vec2.y)), abs(vec2.z))
|
|
||||||
) >> (FRACBITS+5);
|
|
||||||
|
|
||||||
if (slope->extent == 0)
|
|
||||||
{
|
|
||||||
// Prevent divide by zero
|
|
||||||
slope->extent = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec1.x /= slope->extent;
|
|
||||||
vec1.y /= slope->extent;
|
|
||||||
vec1.z /= slope->extent;
|
|
||||||
vec2.x /= slope->extent;
|
|
||||||
vec2.y /= slope->extent;
|
|
||||||
vec2.z /= slope->extent;
|
|
||||||
|
|
||||||
FV3_Cross(&vec1, &vec2, &slope->normal);
|
|
||||||
|
|
||||||
slope->extent = R_PointToDist2(0, 0, R_PointToDist2(0, 0, slope->normal.x, slope->normal.y), slope->normal.z);
|
|
||||||
if (slope->normal.z < 0)
|
|
||||||
slope->extent = -slope->extent;
|
|
||||||
|
|
||||||
slope->normal.x = FixedDiv(slope->normal.x, slope->extent);
|
|
||||||
slope->normal.y = FixedDiv(slope->normal.y, slope->extent);
|
|
||||||
slope->normal.z = FixedDiv(slope->normal.z, slope->extent);
|
|
||||||
|
|
||||||
// Set origin
|
|
||||||
slope->o.x = slope->vertices[0]->x << FRACBITS;
|
|
||||||
slope->o.y = slope->vertices[0]->y << FRACBITS;
|
|
||||||
slope->o.z = slope->vertices[0]->z << FRACBITS;
|
|
||||||
|
|
||||||
if (slope->normal.x == 0 && slope->normal.y == 0) { // Set some defaults for a non-sloped "slope"
|
|
||||||
=======
|
|
||||||
// Set origin.
|
// Set origin.
|
||||||
FV3_Copy(&slope->o, &v1);
|
FV3_Copy(&slope->o, &v1);
|
||||||
|
|
||||||
|
|
@ -99,7 +48,6 @@ static void ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const v
|
||||||
// Set some defaults for a non-sloped "slope"
|
// Set some defaults for a non-sloped "slope"
|
||||||
if (vec1.z == 0 && vec2.z == 0)
|
if (vec1.z == 0 && vec2.z == 0)
|
||||||
{
|
{
|
||||||
>>>>>>> srb2/next
|
|
||||||
slope->zangle = slope->xydirection = 0;
|
slope->zangle = slope->xydirection = 0;
|
||||||
slope->zdelta = slope->d.x = slope->d.y = 0;
|
slope->zdelta = slope->d.x = slope->d.y = 0;
|
||||||
slope->normal.x = slope->normal.y = 0;
|
slope->normal.x = slope->normal.y = 0;
|
||||||
|
|
@ -311,15 +259,8 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
||||||
UINT8 flags = 0; // Slope flags
|
UINT8 flags = 0; // Slope flags
|
||||||
if (line->flags & ML_NETONLY)
|
if (line->flags & ML_NETONLY)
|
||||||
flags |= SL_NOPHYSICS;
|
flags |= SL_NOPHYSICS;
|
||||||
<<<<<<< HEAD
|
|
||||||
if (!(line->flags & ML_NOTAILS))
|
|
||||||
flags |= SL_NODYNAMIC;
|
|
||||||
if (line->flags & ML_NOKNUX)
|
|
||||||
flags |= SL_ANCHORVERTEX;
|
|
||||||
=======
|
|
||||||
if (line->flags & ML_NONET)
|
if (line->flags & ML_NONET)
|
||||||
flags |= SL_DYNAMIC;
|
flags |= SL_DYNAMIC;
|
||||||
>>>>>>> srb2/next
|
|
||||||
|
|
||||||
if(!frontfloor && !backfloor && !frontceil && !backceil)
|
if(!frontfloor && !backfloor && !frontceil && !backceil)
|
||||||
{
|
{
|
||||||
|
|
@ -664,12 +605,9 @@ void P_SpawnSlopes(const boolean fromsave) {
|
||||||
slopelist = NULL;
|
slopelist = NULL;
|
||||||
slopecount = 0;
|
slopecount = 0;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
/// Generates vertex slopes.
|
/// Generates vertex slopes.
|
||||||
SpawnVertexSlopes();
|
SpawnVertexSlopes();
|
||||||
|
|
||||||
>>>>>>> srb2/next
|
|
||||||
/// Generates line special-defined slopes.
|
/// Generates line special-defined slopes.
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -877,14 +815,11 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
||||||
if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope
|
if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope
|
||||||
{
|
{
|
||||||
thing->standingslope = slope;
|
thing->standingslope = slope;
|
||||||
<<<<<<< HEAD
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
thing->modeltilt = thing->standingslope;
|
thing->modeltilt = thing->standingslope;
|
||||||
#endif
|
#endif
|
||||||
=======
|
|
||||||
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
||||||
thing->momz = -P_MobjFlip(thing);
|
thing->momz = -P_MobjFlip(thing);
|
||||||
>>>>>>> srb2/next
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -899,14 +834,11 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope)
|
||||||
thing->momx = mom.x;
|
thing->momx = mom.x;
|
||||||
thing->momy = mom.y;
|
thing->momy = mom.y;
|
||||||
thing->standingslope = slope;
|
thing->standingslope = slope;
|
||||||
<<<<<<< HEAD
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
thing->modeltilt = thing->standingslope;
|
thing->modeltilt = thing->standingslope;
|
||||||
#endif
|
#endif
|
||||||
=======
|
|
||||||
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
if (!thing->player || !(thing->player->pflags & PF_BOUNCING))
|
||||||
thing->momz = -P_MobjFlip(thing);
|
thing->momz = -P_MobjFlip(thing);
|
||||||
>>>>>>> srb2/next
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue