Skip to content

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Jun 17, 2023
1 parent 9a9d82d commit 4514588
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions p_floor.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ int EV_BuildStairs(line_t *line, int type)
if ( !(check->flags & ML_TWOSIDED) )
continue;

newsecnum = LD_FRONTSECTORNUM(check);
newsecnum = sides[check->sidenum[0]].sector;
tsec = &sectors[newsecnum];
if (secnum != newsecnum)
continue;
newsecnum = LD_BACKSECTORNUM(check);
newsecnum = sides[check->sidenum[1]].sector;
tsec = &sectors[newsecnum];
if (tsec->floorpic != texture)
continue;
Expand Down
4 changes: 2 additions & 2 deletions p_shoot.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ static boolean PA_ShootLine(shootWork_t *sw, line_t *li, fixed_t interceptfrac)
}

// crosses a two-sided line
front = &sectors[LD_FRONTSECTORNUM(li)];
back = &sectors[LD_BACKSECTORNUM(li)];
front = &sectors[sides[li->sidenum[0]].sector];
back = &sectors[sides[li->sidenum[1]].sector];

if(front->ceilingheight < back->ceilingheight)
opentop = front->ceilingheight;
Expand Down
7 changes: 3 additions & 4 deletions p_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,11 +896,10 @@ int EV_DoDonut(line_t *line)
for (i = 0;i < s2->linecount;i++)
{
line = lines + s2->lines[i];
s3 = LD_BACKSECTOR(line);
if (!s3)
if (!(line->flags & ML_TWOSIDED))
continue;
if (!(line->flags & ML_TWOSIDED) ||
(s3 == s1))
s3 = &sectors[sides[line->sidenum[1]].sector];
if (s3 == s1)
continue;

/* */
Expand Down
4 changes: 1 addition & 3 deletions r_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ typedef struct line_s
VINT fineangle; /* to get sine / eosine for sliding */
} line_t;

#define LD_FRONTSECTORNUM(ld) (sides[(ld)->sidenum[0]].sector)
#define LD_BACKSECTORNUM(ld) ((ld)->sidenum[1] != -1 ? sides[ld->sidenum[1]].sector : -1)
#define LD_FRONTSECTOR(ld) (&sectors[LD_FRONTSECTORNUM(ld)])
#define LD_FRONTSECTOR(ld) (&sectors[sides[(ld)->sidenum[0]].sector])
#define LD_BACKSECTOR(ld) ((ld)->sidenum[1] != -1 ? &sectors[sides[ld->sidenum[1]].sector] : NULL)

typedef struct subsector_s
Expand Down

0 comments on commit 4514588

Please sign in to comment.