Skip to content

Commit

Permalink
Merged pull request "Qbsp": NVIDIA#154
Browse files Browse the repository at this point in the history
  • Loading branch information
apanteleev committed Oct 7, 2021
2 parents 0f9f98c + 8c67184 commit 52598e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions inc/common/bsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ typedef struct bsp_s {
byte *pvs2_matrix;
qboolean pvs_patched;

qboolean extended;

// WARNING: the 'name' string is actually longer than this, and the bsp_t structure is allocated larger than sizeof(bsp_t) in BSP_Load
char name[1];
} bsp_t;
Expand Down
3 changes: 2 additions & 1 deletion src/common/bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ LOAD(Visibility)
memcpy(bsp->vis, base, count);

numclusters = LittleLong(bsp->vis->numclusters);
if (numclusters > MAX_MAP_LEAFS) {
if (numclusters > (bsp->extended ? MAX_QBSP_MAP_LEAFS : MAX_MAP_LEAFS)) {
DEBUG("bad numclusters");
return Q_ERR_TOO_MANY;
}
Expand Down Expand Up @@ -1540,6 +1540,7 @@ qerror_t BSP_Load(const char *name, bsp_t **bsp_p)
bsp = Z_Mallocz(sizeof(*bsp) + len);
memcpy(bsp->name, name, len + 1);
bsp->refcount = 1;
bsp->extended = (lumps == qbsp_lumps);

// add an extra page for cacheline alignment overhead
Hunk_Begin(&bsp->hunk, memsize + 4096);
Expand Down

0 comments on commit 52598e4

Please sign in to comment.