From e2f79aa308fb09b2f8d858fd068808ee517739bf Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 14 Sep 2024 18:29:57 +0200 Subject: [PATCH] remove some code duplication + add missing check --- src/r_segs.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index ea4ebce1b..d2918076a 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2084,45 +2084,12 @@ void R_StoreWallRange(INT32 start, INT32 stop) } } - if (!bothceilingssky && !bothfloorssky || !udmf) - { - if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - - if (worldlow >= worldtop && worldlowslope >= worldtopslope) - { - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - } - //SoM: 3/25/2000: This code fixes an automap bug that didn't check // frontsector->ceiling and backsector->floor to see if a door was closed. // Without the following code, sprites get displayed behind closed doors. if (!bothceilingssky && !bothfloorssky || !udmf) { - if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) - { - ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = INT32_MAX; - ds_p->silhouette |= SIL_BOTTOM; - } - - if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) - { // killough 1/17/98, 2/8/98 - ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = INT32_MIN; - ds_p->silhouette |= SIL_TOP; - } - - //SoM: 3/25/2000: This code fixes an automap bug that didn't check - // frontsector->ceiling and backsector->floor to see if a door was closed. - // Without the following code, sprites get displayed behind closed doors. + if (udmf || !udmf && viewsector != frontsector && viewsector != backsector) { if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) { @@ -2130,8 +2097,9 @@ void R_StoreWallRange(INT32 start, INT32 stop) ds_p->bsilheight = INT32_MAX; ds_p->silhouette |= SIL_BOTTOM; } + if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope)) - { // killough 1/17/98, 2/8/98 + { ds_p->sprtopclip = screenheightarray; ds_p->tsilheight = INT32_MIN; ds_p->silhouette |= SIL_TOP;