From d1c80dfd9bb18c16344282e1131cc8a576ea8a64 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 2 Jan 2025 22:18:52 +0100 Subject: [PATCH] smol fix --- src/p_mobj.c | 3 +++ src/r_main.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 8d728c389..a70ab5f91 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3579,11 +3579,14 @@ static void CalculatePrecipFloor(precipmobj_t *mobj) { // recalculate floorz each time const sector_t *mobjsecsubsec; + if (mobj && mobj->subsector && mobj->subsector->sector) mobjsecsubsec = mobj->subsector->sector; else return; + mobj->floorz = P_GetSectorFloorZAt(mobjsecsubsec, mobj->x, mobj->y); + if (mobjsecsubsec->ffloors) { ffloor_t *rover; diff --git a/src/r_main.h b/src/r_main.h index a3938fd0a..53579c163 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -104,7 +104,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSide(fixed_t x, fixed_t y, FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideFast(fixed_t x, fixed_t y, const node_t *node) { // use cross product to determine side quickly - return ((INT64)y - node->y) * node->dx - ((INT64)x - node->x) * node->dy > 0; + return ((((INT64)y - node->y) * node->dx - ((INT64)x - node->x) * node->dy) >= 0); } FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line) @@ -115,7 +115,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t fixed_t ldy = line->v2->y - ly; // use cross product to determine side quickly - return ((INT64)y - ly) * ldx - ((INT64)x - lx) * ldy > 0; + return ((((INT64)y - ly) * ldx - ((INT64)x - lx) * ldy) >= 0); } angle_t R_PointToAngle(fixed_t x, fixed_t y);