mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-21 19:21:47 +00:00
Use a set for portalsee.
This removes the hard coding of the size of portalsee, which looks to have been too small for some maps.
This commit is contained in:
parent
299ff8f575
commit
9b4beaf3f8
1 changed files with 7 additions and 4 deletions
|
@ -58,7 +58,7 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
static int clustersee;
|
static int clustersee;
|
||||||
static byte portalsee[MAX_PORTALS];
|
static set_t *portalsee;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is a rough first-order aproximation that is used to trivially reject
|
This is a rough first-order aproximation that is used to trivially reject
|
||||||
|
@ -80,7 +80,7 @@ SimpleFlood (portal_t *srcportal, int clusternum)
|
||||||
|
|
||||||
for (i = 0; i < cluster->numportals; i++) {
|
for (i = 0; i < cluster->numportals; i++) {
|
||||||
portal = cluster->portals[i];
|
portal = cluster->portals[i];
|
||||||
if (!portalsee[portal - portals])
|
if (!set_is_member (portalsee, portal - portals))
|
||||||
continue;
|
continue;
|
||||||
SimpleFlood (srcportal, portal->cluster);
|
SimpleFlood (srcportal, portal->cluster);
|
||||||
}
|
}
|
||||||
|
@ -94,10 +94,13 @@ BasePortalVis (void)
|
||||||
portal_t *tp, *portal;
|
portal_t *tp, *portal;
|
||||||
winding_t *winding;
|
winding_t *winding;
|
||||||
|
|
||||||
|
if (portalsee)
|
||||||
|
set_delete (portalsee);
|
||||||
|
portalsee = set_new_size (numportals * 2);
|
||||||
for (i = 0, portal = portals; i < numportals * 2; i++, portal++) {
|
for (i = 0, portal = portals; i < numportals * 2; i++, portal++) {
|
||||||
portal->mightsee = set_new_size (portalclusters);
|
portal->mightsee = set_new_size (portalclusters);
|
||||||
|
|
||||||
memset (portalsee, 0, numportals * 2);
|
set_empty (portalsee);
|
||||||
|
|
||||||
for (j = 0, tp = portals; j < numportals * 2; j++, tp++) {
|
for (j = 0, tp = portals; j < numportals * 2; j++, tp++) {
|
||||||
if (j == i)
|
if (j == i)
|
||||||
|
@ -123,7 +126,7 @@ BasePortalVis (void)
|
||||||
if (k == winding->numpoints)
|
if (k == winding->numpoints)
|
||||||
continue; // no points on front
|
continue; // no points on front
|
||||||
|
|
||||||
portalsee[j] = 1;
|
set_add (portalsee, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
clustersee = 0;
|
clustersee = 0;
|
||||||
|
|
Loading…
Reference in a new issue