inline P_PointOn stuff + fix declarations
This commit is contained in:
1 parent
a425935bc4
commit
039daa0145
4 files changed
+21
-23
No files matched your search
+2
-2
@@ -23,7 +23,7 @@
|
||||
#include "m_fixed.h"
|
||||
#include "tables.h" // ANGLETOFINESHIFT
|
||||
|
||||
fixed_t FixedSqrt(fixed_t x)
|
||||
FUNCMATH fixed_t FixedSqrt(fixed_t x)
|
||||
{
|
||||
#ifdef HAVE_SQRT
|
||||
const float fx = FIXED_TO_FLOAT(x);
|
||||
@@ -61,7 +61,7 @@ fixed_t FixedSqrt(fixed_t x)
|
||||
#endif
|
||||
}
|
||||
|
||||
fixed_t FixedHypot(fixed_t x, fixed_t y)
|
||||
FUNCMATH fixed_t FixedHypot(fixed_t x, fixed_t y)
|
||||
{
|
||||
// Moved the code from R_PointToDist2 to here,
|
||||
// since R_PointToDist2 did the same thing,
|
||||
|
||||
+3
-17
@@ -130,25 +130,12 @@ void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, verte
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_PointOnLineSide
|
||||
// Returns 0 or 1
|
||||
//
|
||||
INT32 PUREFUNC P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line)
|
||||
{
|
||||
return
|
||||
!line->dx ? x <= line->v1->x ? line->dy > 0 : line->dy < 0 :
|
||||
!line->dy ? y <= line->v1->y ? line->dx < 0 : line->dx > 0 :
|
||||
FixedMul(y-line->v1->y, line->dx>>FRACBITS) >=
|
||||
FixedMul(line->dy>>FRACBITS, x-line->v1->x);
|
||||
}
|
||||
|
||||
//
|
||||
// P_BoxOnLineSide
|
||||
// Considers the line to be infinite
|
||||
// Returns side 0 or 1, -1 if box crosses the line.
|
||||
//
|
||||
INT32 PUREFUNC P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld)
|
||||
PUREFUNC INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld)
|
||||
{
|
||||
INT32 p1, p2;
|
||||
|
||||
@@ -198,7 +185,7 @@ INT32 PUREFUNC P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld)
|
||||
// P_PointOnDivlineSide
|
||||
// Returns 0 or 1.
|
||||
//
|
||||
static INT32 PUREFUNC P_PointOnDivlineSide(fixed_t x, fixed_t y, divline_t *line)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 P_PointOnDivlineSide(fixed_t x, fixed_t y, divline_t *line)
|
||||
{
|
||||
return
|
||||
!line->dx ? x <= line->x ? line->dy > 0 : line->dy < 0 :
|
||||
@@ -207,7 +194,6 @@ static INT32 PUREFUNC P_PointOnDivlineSide(fixed_t x, fixed_t y, divline_t *line
|
||||
FixedMul(y>>8, line->dx>>8) >= FixedMul(line->dy>>8, x>>8);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_MakeDivline
|
||||
//
|
||||
@@ -224,7 +210,7 @@ void P_MakeDivline(line_t *li, divline_t *dl)
|
||||
// Returns the fractional intercept point along the first divline.
|
||||
// This is only called by the addthings and addlines traversers.
|
||||
//
|
||||
fixed_t PUREFUNC P_InterceptVector(divline_t *v2, divline_t *v1)
|
||||
PUREFUNC fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
|
||||
{
|
||||
fixed_t frac, num, den;
|
||||
|
||||
|
||||
+15
-3
@@ -41,14 +41,26 @@ typedef boolean (*traverser_t)(intercept_t *in);
|
||||
boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
|
||||
INT32 pflags, traverser_t ptrav);
|
||||
|
||||
//
|
||||
// P_PointOnLineSide
|
||||
// Returns 0 or 1
|
||||
//
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line)
|
||||
{
|
||||
return
|
||||
!line->dx ? x <= line->v1->x ? line->dy > 0 : line->dy < 0 :
|
||||
!line->dy ? y <= line->v1->y ? line->dx < 0 : line->dx > 0 :
|
||||
FixedMul(y-line->v1->y, line->dx>>FRACBITS) >=
|
||||
FixedMul(line->dy>>FRACBITS, x-line->v1->x);
|
||||
}
|
||||
|
||||
#define P_AproxDistance(dx, dy) FixedHypot(dx, dy)
|
||||
void P_ClosestPointOnLine(fixed_t x, fixed_t y, line_t *line, vertex_t *result);
|
||||
void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, vertex_t *result);
|
||||
INT32 PUREFUNC P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line);
|
||||
void P_MakeDivline(line_t *li, divline_t *dl);
|
||||
void P_CameraLineOpening(line_t *plinedef);
|
||||
fixed_t PUREFUNC P_InterceptVector(divline_t *v2, divline_t *v1);
|
||||
INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld);
|
||||
PUREFUNC fixed_t P_InterceptVector(divline_t *v2, divline_t *v1);
|
||||
PUREFUNC INT32 P_BoxOnLineSide(fixed_t *tmbox, const line_t *ld);
|
||||
void P_UnsetPrecipThingPosition(precipmobj_t *thing);
|
||||
void P_SetPrecipitationThingPosition(precipmobj_t *thing);
|
||||
void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
|
||||
|
||||
+1
-1
@@ -623,7 +623,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
}
|
||||
}
|
||||
|
||||
if(!line->tag)
|
||||
if (!line->tag)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user