diff --git a/doomtypes.h b/doomtypes.h index ca5e822..36f340a 100644 --- a/doomtypes.h +++ b/doomtypes.h @@ -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; @@ -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; diff --git a/wadprocessor.cpp b/wadprocessor.cpp index 99fb8da..616922f 100644 --- a/wadprocessor.cpp +++ b/wadprocessor.cpp @@ -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; }