Skip to content

Commit adc37ad

Browse files
committed
Add bounding box to line_t.
1 parent 2d9bdf4 commit adc37ad

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

doomtypes.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ typedef enum
108108
RF_CLOSED =16, // Line blocks view
109109
} r_flags;
110110

111+
112+
/* Bounding box coordinate storage. */
113+
enum
114+
{
115+
BOXTOP,
116+
BOXBOTTOM,
117+
BOXLEFT,
118+
BOXRIGHT
119+
}; /* bbox coordinates */
120+
121+
111122
typedef struct line_s
112123
{
113124
vertex_t v1;
@@ -117,6 +128,8 @@ typedef struct line_s
117128

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

131+
fixed_t bbox[4]; //Line bounding box.
132+
120133
quint16 flags; // Animation related.
121134
qint16 special;
122135
qint16 tag;

wadprocessor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ bool WadProcessor::ProcessLines(quint32 lumpNum)
174174
newLines[i].sidenum[0] = oldLines[i].sidenum[0];
175175
newLines[i].sidenum[1] = oldLines[i].sidenum[1];
176176

177+
newLines[i].bbox[BOXLEFT] = (newLines[i].v1.x < newLines[i].v2.x ? newLines[i].v1.x : newLines[i].v2.x);
178+
newLines[i].bbox[BOXRIGHT] = (newLines[i].v1.x < newLines[i].v2.x ? newLines[i].v2.x : newLines[i].v1.x);
179+
180+
newLines[i].bbox[BOXTOP] = (newLines[i].v1.y < newLines[i].v2.y ? newLines[i].v2.y : newLines[i].v1.y);
181+
newLines[i].bbox[BOXBOTTOM] = (newLines[i].v1.y < newLines[i].v2.y ? newLines[i].v1.y : newLines[i].v2.y);
182+
177183
newLines[i].lineno = i;
178184

179185
}

0 commit comments

Comments
 (0)