Skip to content
Snippets Groups Projects
Commit 3a09c475 authored by Lactozilla's avatar Lactozilla :speech_balloon:
Browse files

Add comments

parent e67e225f
No related branches found
No related tags found
No related merge requests found
Pipeline #3876 passed
...@@ -852,7 +852,6 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y) ...@@ -852,7 +852,6 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y)
return light->slope ? P_GetSlopeZAt(light->slope, x, y) : light->height; return light->slope ? P_GetSlopeZAt(light->slope, x, y) : light->height;
} }
// //
// P_QuantizeMomentumToSlope // P_QuantizeMomentumToSlope
// //
...@@ -887,6 +886,8 @@ void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) ...@@ -887,6 +886,8 @@ void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope)
FV3_Rotate(momentum, &axis, InvAngle(slope->zangle) >> ANGLETOFINESHIFT); FV3_Rotate(momentum, &axis, InvAngle(slope->zangle) >> ANGLETOFINESHIFT);
} }
// Returns the angle of the slope plane.
// If line is provided, a new calculation is performed as if the slope were on the top or bottom of a solid midtexture.
angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line)
{ {
angle_t zangle = slope->zangle; angle_t zangle = slope->zangle;
...@@ -900,28 +901,23 @@ angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) ...@@ -900,28 +901,23 @@ angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line)
return zangle; return zangle;
} }
// Returns the angle of the projected normal of slope plane.
// If line is provided, this simply returns the line's angle.
angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line) angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line)
{ {
angle_t xydirection = slope->xydirection; angle_t xydirection = slope->xydirection;
if (line) if (line)
{ {
xydirection = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); xydirection = line->angle;
} }
return xydirection; return xydirection;
} }
angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) // When given a vector, rotates it and aligns it to either a slope, or a flat surface relative to the slope.
{ // If line is provided, this calculation is performed as if the slope were on the top or bottom of a solid midtexture.
return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); // See also: P_QuantizeMomentumToSlope
}
angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo)
{
return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline);
}
static void QuantizeMomentumToSlope(pslope_t *slope, line_t *line, vector3_t *momentum, boolean reverse) static void QuantizeMomentumToSlope(pslope_t *slope, line_t *line, vector3_t *momentum, boolean reverse)
{ {
if (!slope || slope->flags & SL_NOPHYSICS) if (!slope || slope->flags & SL_NOPHYSICS)
...@@ -963,6 +959,18 @@ void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) ...@@ -963,6 +959,18 @@ void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum)
QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, true); QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, true);
} }
// Wrapper for P_GetStandingSlopeZAngle.
angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo)
{
return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline);
}
// Wrapper for P_GetObjectStandingSlopeDirection.
angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo)
{
return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline);
}
// //
// P_SlopeLaunch // P_SlopeLaunch
// //
...@@ -1042,7 +1050,6 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) ...@@ -1042,7 +1050,6 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line)
// Function to help handle landing on slopes // Function to help handle landing on slopes
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line)
{ {
vector3_t mom; // Ditto.
if (slope->flags & SL_NOPHYSICS || (slope->normal.x == 0 && slope->normal.y == 0)) { // No physics, no need to make anything complicated. if (slope->flags & SL_NOPHYSICS || (slope->normal.x == 0 && slope->normal.y == 0)) { // No physics, no need to make anything complicated.
if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope
{ {
...@@ -1055,6 +1062,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) ...@@ -1055,6 +1062,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line)
return; return;
} }
vector3_t mom;
mom.x = thing->momx; mom.x = thing->momx;
mom.y = thing->momy; mom.y = thing->momy;
mom.z = thing->momz*2; mom.z = thing->momz*2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment