Skip to content

Commit

Permalink
Add bounding box to line_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
doomhack committed Dec 15, 2019
1 parent 2d9bdf4 commit adc37ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doomtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ typedef enum
RF_CLOSED =16, // Line blocks view
} r_flags;


/* Bounding box coordinate storage. */
enum
{
BOXTOP,
BOXBOTTOM,
BOXLEFT,
BOXRIGHT
}; /* bbox coordinates */


typedef struct line_s
{
vertex_t v1;
Expand All @@ -117,6 +128,8 @@ typedef struct line_s

quint16 sidenum[2]; // Visual appearance: SideDefs.

fixed_t bbox[4]; //Line bounding box.

quint16 flags; // Animation related.
qint16 special;
qint16 tag;
Expand Down
6 changes: 6 additions & 0 deletions wadprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ bool WadProcessor::ProcessLines(quint32 lumpNum)
newLines[i].sidenum[0] = oldLines[i].sidenum[0];
newLines[i].sidenum[1] = oldLines[i].sidenum[1];

newLines[i].bbox[BOXLEFT] = (newLines[i].v1.x < newLines[i].v2.x ? newLines[i].v1.x : newLines[i].v2.x);
newLines[i].bbox[BOXRIGHT] = (newLines[i].v1.x < newLines[i].v2.x ? newLines[i].v2.x : newLines[i].v1.x);

newLines[i].bbox[BOXTOP] = (newLines[i].v1.y < newLines[i].v2.y ? newLines[i].v2.y : newLines[i].v1.y);
newLines[i].bbox[BOXBOTTOM] = (newLines[i].v1.y < newLines[i].v2.y ? newLines[i].v1.y : newLines[i].v2.y);

newLines[i].lineno = i;

}
Expand Down

0 comments on commit adc37ad

Please sign in to comment.