From 90507126e47cdd5d4ecf8273f5f6b74e0ea82ffa Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 4 Jan 2021 17:34:10 -0800 Subject: [PATCH 1/3] Move block line checks to a single function --- src/p_map.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index d3e9aaa80..b60d243e2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1624,6 +1624,22 @@ static boolean PIT_CheckCameraLine(line_t *ld) return true; } +static boolean P_IsLineBlocking(const line_t *ld, const mobj_t *thing) +{ + // missiles can cross uncrossable lines + if ((thing->flags & MF_MISSILE)) + return false; + else + { + return + ( + (ld->flags & ML_IMPASSABLE) || // block objects from moving through this linedef. + (thing->player && !thing->player->spectator && + ld->flags & ML_BLOCKPLAYERS) // SRB2Kart: Only block players, not items + ); + } +} + // // PIT_CheckLine // Adjusts tmfloorz and tmceilingz as lines are contacted @@ -1699,14 +1715,8 @@ static boolean PIT_CheckLine(line_t *ld) return false; } - // missiles can cross uncrossable lines - if (!(tmthing->flags & MF_MISSILE)) - { - if (ld->flags & ML_IMPASSABLE) // block objects from moving through this linedef. - return false; - if (tmthing->player && !tmthing->player->spectator && ld->flags & ML_BLOCKPLAYERS) - return false; // SRB2Kart: Only block players, not items - } + if (P_IsLineBlocking(ld, tmthing)) + return false; // set openrange, opentop, openbottom P_LineOpening(ld, tmthing); @@ -3172,14 +3182,8 @@ static boolean PTR_LineIsBlocking(line_t *li) if (!li->backsector) return !P_PointOnLineSide(slidemo->x, slidemo->y, li); - if (!(slidemo->flags & MF_MISSILE)) - { - if (li->flags & ML_IMPASSABLE) - return true; - - if (slidemo->player && !slidemo->player->spectator && li->flags & ML_BLOCKPLAYERS) - return true; - } + if (P_IsLineBlocking(li, slidemo)) + return true; // set openrange, opentop, openbottom P_LineOpening(li, slidemo); From 6070d14fa5772398a8977be1f8346f60b5c0d0c4 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 4 Jan 2021 17:40:06 -0800 Subject: [PATCH 2/3] Line special 11: block monsters for this line --- src/p_map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index b60d243e2..d6a3044cb 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1635,7 +1635,8 @@ static boolean P_IsLineBlocking(const line_t *ld, const mobj_t *thing) ( (ld->flags & ML_IMPASSABLE) || // block objects from moving through this linedef. (thing->player && !thing->player->spectator && - ld->flags & ML_BLOCKPLAYERS) // SRB2Kart: Only block players, not items + ld->flags & ML_BLOCKPLAYERS) || // SRB2Kart: Only block players, not items + ((thing->flags & (MF_ENEMY|MF_BOSS)) && ld->special == 11) // case 11: block monsters only ); } } From c76ae9a4fd878826312202697b38ac2210fd14d2 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 4 Jan 2021 18:55:33 -0800 Subject: [PATCH 3/3] Actually put it on line type 81 --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index d6a3044cb..898ee0a49 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1636,7 +1636,7 @@ static boolean P_IsLineBlocking(const line_t *ld, const mobj_t *thing) (ld->flags & ML_IMPASSABLE) || // block objects from moving through this linedef. (thing->player && !thing->player->spectator && ld->flags & ML_BLOCKPLAYERS) || // SRB2Kart: Only block players, not items - ((thing->flags & (MF_ENEMY|MF_BOSS)) && ld->special == 11) // case 11: block monsters only + ((thing->flags & (MF_ENEMY|MF_BOSS)) && ld->special == 81) // case 81: block monsters only ); } }