From 9eec9f7e52b21de13dcb0133806323fe42eab837 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 7 Oct 2024 23:05:01 +0200 Subject: [PATCH] fix some inline stuff --- src/p_maputl.c | 33 +++++---------------------------- src/p_maputl.h | 25 ++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index fc7ea89ec..6d58808d0 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -130,29 +130,6 @@ void P_ClosestPointOnLine3D(fixed_t x, fixed_t y, fixed_t z, line_t *line, verte return; } -// -// P_PointOnLineSide -// Returns 0 or 1 -// -FUNCINLINE ATTRINLINE PUREFUNC INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line) -{ - fixed_t dx, dy, left, right; - - if (!line->dx) - return x <= line->v1->x ? line->dy > 0 : line->dy < 0; - - if (!line->dy) - return y <= line->v1->y ? line->dx < 0 : line->dx > 0; - - dx = (x - line->v1->x); - dy = (y - line->v1->y); - - left = FixedMul(line->dy>>FRACBITS, dx); - right = FixedMul(dy, line->dx>>FRACBITS); - - return right < left ? 0 : 1; -} - // // P_BoxOnLineSide // Considers the line to be infinite @@ -235,7 +212,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 P_PointOnDivlineSide(fixed_t x, fixe // // P_MakeDivline // -FUNCINLINE ATTRINLINE void P_MakeDivline(line_t *li, divline_t *dl) +void P_MakeDivline(line_t *li, divline_t *dl) { dl->x = li->v1->x; dl->y = li->v1->y; @@ -248,7 +225,7 @@ FUNCINLINE ATTRINLINE 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. // -FUNCINLINE ATTRINLINE fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) +fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) { fixed_t frac, num, den; @@ -752,7 +729,7 @@ void P_UnsetThingPosition(mobj_t *thing) } } -FUNCINLINE ATTRINLINE void P_UnsetPrecipThingPosition(precipmobj_t *thing) +void P_UnsetPrecipThingPosition(precipmobj_t *thing) { precipmobj_t **bprev = thing->bprev; precipmobj_t *bnext = thing->bnext; @@ -902,7 +879,7 @@ void P_SetUnderlayPosition(mobj_t *thing) sector_list = NULL; // clear for next time } -FUNCINLINE ATTRINLINE void P_SetPrecipitationThingPosition(precipmobj_t *thing) +void P_SetPrecipitationThingPosition(precipmobj_t *thing) { thing->subsector = R_PointInSubsector(thing->x, thing->y); @@ -990,7 +967,7 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *)) // // P_BlockThingsIterator // -FUNCINLINE ATTRINLINE boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) +boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) { mobj_t *mobj, *bnext = NULL; diff --git a/src/p_maputl.h b/src/p_maputl.h index d2337d007..1471de321 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -44,7 +44,30 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2, #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 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line); + +// +// P_PointOnLineSide +// Returns 0 or 1 +// +FUNCINLINE static ATTRINLINE PUREFUNC INT32 P_PointOnLineSide(fixed_t x, fixed_t y, const line_t *line) +{ + fixed_t dx, dy, left, right; + + if (!line->dx) + return x <= line->v1->x ? line->dy > 0 : line->dy < 0; + + if (!line->dy) + return y <= line->v1->y ? line->dx < 0 : line->dx > 0; + + dx = (x - line->v1->x); + dy = (y - line->v1->y); + + left = FixedMul(line->dy>>FRACBITS, dx); + right = FixedMul(dy, line->dx>>FRACBITS); + + return right < left ? 0 : 1; +} + void P_MakeDivline(line_t *li, divline_t *dl); void P_CameraLineOpening(line_t *plinedef); fixed_t P_InterceptVector(divline_t *v2, divline_t *v1);