wrap bit flags operations
This commit is contained in:
parent
7626f69b02
commit
2b59253b26
|
|
@ -22,6 +22,14 @@ inline void value_minimize( T& value, const T& other ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool bit_is_enabled( const byte *bytes, int bit_index ){
|
||||||
|
return ( bytes[bit_index >> 3] & ( 1 << ( bit_index & 7 ) ) ) != 0;
|
||||||
|
}
|
||||||
|
inline void bit_enable( byte *bytes, int bit_index ){
|
||||||
|
bytes[bit_index >> 3] |= ( 1 << ( bit_index & 7 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct MinMax___
|
struct MinMax___
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3019,7 +3019,7 @@ bool ClusterVisible( int a, int b ){
|
||||||
const byte *pvs = bspVisBytes.data() + VIS_HEADER_SIZE + ( a * leafBytes );
|
const byte *pvs = bspVisBytes.data() + VIS_HEADER_SIZE + ( a * leafBytes );
|
||||||
|
|
||||||
/* check */
|
/* check */
|
||||||
return ( pvs[ b >> 3 ] & ( 1 << ( b & 7 ) ) );
|
return bit_is_enabled( pvs, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1761,9 +1761,6 @@ static bool ApproximateLightmap( rawLightmap_t *lm ){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool TestOutLightmapStamp( rawLightmap_t *lm, int lightmapNum, outLightmap_t *olm, int x, int y ){
|
static bool TestOutLightmapStamp( rawLightmap_t *lm, int lightmapNum, outLightmap_t *olm, int x, int y ){
|
||||||
int sx, sy, ox, oy, offset;
|
|
||||||
|
|
||||||
|
|
||||||
/* bounds check */
|
/* bounds check */
|
||||||
if ( x < 0 || y < 0 || ( x + lm->w ) > olm->customWidth || ( y + lm->h ) > olm->customHeight ) {
|
if ( x < 0 || y < 0 || ( x + lm->w ) > olm->customWidth || ( y + lm->h ) > olm->customHeight ) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1771,17 +1768,16 @@ static bool TestOutLightmapStamp( rawLightmap_t *lm, int lightmapNum, outLightma
|
||||||
|
|
||||||
/* solid lightmaps test a 1x1 stamp */
|
/* solid lightmaps test a 1x1 stamp */
|
||||||
if ( lm->solid[ lightmapNum ] ) {
|
if ( lm->solid[ lightmapNum ] ) {
|
||||||
offset = ( y * olm->customWidth ) + x;
|
if ( bit_is_enabled( olm->lightBits, ( y * olm->customWidth ) + x ) ) {
|
||||||
if ( olm->lightBits[ offset >> 3 ] & ( 1 << ( offset & 7 ) ) ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test the stamp */
|
/* test the stamp */
|
||||||
for ( sy = 0; sy < lm->h; sy++ )
|
for ( int sy = 0; sy < lm->h; ++sy )
|
||||||
{
|
{
|
||||||
for ( sx = 0; sx < lm->w; sx++ )
|
for ( int sx = 0; sx < lm->w; ++sx )
|
||||||
{
|
{
|
||||||
/* get luxel */
|
/* get luxel */
|
||||||
if ( lm->getBspLuxel( lightmapNum, sx, sy )[ 0 ] < 0.0f ) {
|
if ( lm->getBspLuxel( lightmapNum, sx, sy )[ 0 ] < 0.0f ) {
|
||||||
|
|
@ -1789,10 +1785,9 @@ static bool TestOutLightmapStamp( rawLightmap_t *lm, int lightmapNum, outLightma
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get bsp lightmap coords and test */
|
/* get bsp lightmap coords and test */
|
||||||
ox = x + sx;
|
const int ox = x + sx;
|
||||||
oy = y + sy;
|
const int oy = y + sy;
|
||||||
offset = ( oy * olm->customWidth ) + ox;
|
if ( bit_is_enabled( olm->lightBits, ( oy * olm->customWidth ) + ox ) ) {
|
||||||
if ( olm->lightBits[ offset >> 3 ] & ( 1 << ( offset & 7 ) ) ) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1856,7 +1851,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){
|
||||||
|
|
||||||
#define LIGHTMAP_RESERVE_COUNT 1
|
#define LIGHTMAP_RESERVE_COUNT 1
|
||||||
static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){
|
static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){
|
||||||
int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy, offset;
|
int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy;
|
||||||
outLightmap_t *olm;
|
outLightmap_t *olm;
|
||||||
surfaceInfo_t *info;
|
surfaceInfo_t *info;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
@ -2140,10 +2135,9 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){
|
||||||
/* get bsp lightmap coords */
|
/* get bsp lightmap coords */
|
||||||
ox = x + lm->lightmapX[ lightmapNum ];
|
ox = x + lm->lightmapX[ lightmapNum ];
|
||||||
oy = y + lm->lightmapY[ lightmapNum ];
|
oy = y + lm->lightmapY[ lightmapNum ];
|
||||||
offset = ( oy * olm->customWidth ) + ox;
|
|
||||||
|
|
||||||
/* flag pixel as used */
|
/* flag pixel as used */
|
||||||
olm->lightBits[ offset >> 3 ] |= ( 1 << ( offset & 7 ) );
|
bit_enable( olm->lightBits, ( oy * olm->customWidth ) + ox );
|
||||||
olm->freeLuxels--;
|
olm->freeLuxels--;
|
||||||
|
|
||||||
/* store color */
|
/* store color */
|
||||||
|
|
@ -2249,7 +2243,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
for ( x = 0; x < olm->customWidth; ++x )
|
for ( x = 0; x < olm->customWidth; ++x )
|
||||||
{
|
{
|
||||||
ofs = y * olm->customWidth + x;
|
ofs = y * olm->customWidth + x;
|
||||||
if ( olm->lightBits[ofs >> 3] & ( 1 << ( ofs & 7 ) ) ) { /* already filled */
|
if ( bit_is_enabled( olm->lightBits, ofs ) ) { /* already filled */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
|
|
@ -2257,7 +2251,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
|
|
||||||
/* try all four neighbors */
|
/* try all four neighbors */
|
||||||
ofs = ( ( y + olm->customHeight - 1 ) % olm->customHeight ) * olm->customWidth + x;
|
ofs = ( ( y + olm->customHeight - 1 ) % olm->customHeight ) * olm->customWidth + x;
|
||||||
if ( olm->lightBits[ofs >> 3] & ( 1 << ( ofs & 7 ) ) ) { /* already filled */
|
if ( bit_is_enabled( olm->lightBits, ofs ) ) { /* already filled */
|
||||||
++cnt;
|
++cnt;
|
||||||
light_sum += olm->bspLightBytes[ofs];
|
light_sum += olm->bspLightBytes[ofs];
|
||||||
if ( deluxemap ) {
|
if ( deluxemap ) {
|
||||||
|
|
@ -2266,7 +2260,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
}
|
}
|
||||||
|
|
||||||
ofs = ( ( y + 1 ) % olm->customHeight ) * olm->customWidth + x;
|
ofs = ( ( y + 1 ) % olm->customHeight ) * olm->customWidth + x;
|
||||||
if ( olm->lightBits[ofs >> 3] & ( 1 << ( ofs & 7 ) ) ) { /* already filled */
|
if ( bit_is_enabled( olm->lightBits, ofs ) ) { /* already filled */
|
||||||
++cnt;
|
++cnt;
|
||||||
light_sum += olm->bspLightBytes[ofs];
|
light_sum += olm->bspLightBytes[ofs];
|
||||||
if ( deluxemap ) {
|
if ( deluxemap ) {
|
||||||
|
|
@ -2275,7 +2269,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
}
|
}
|
||||||
|
|
||||||
ofs = y * olm->customWidth + ( x + olm->customWidth - 1 ) % olm->customWidth;
|
ofs = y * olm->customWidth + ( x + olm->customWidth - 1 ) % olm->customWidth;
|
||||||
if ( olm->lightBits[ofs >> 3] & ( 1 << ( ofs & 7 ) ) ) { /* already filled */
|
if ( bit_is_enabled( olm->lightBits, ofs ) ) { /* already filled */
|
||||||
++cnt;
|
++cnt;
|
||||||
light_sum += olm->bspLightBytes[ofs];
|
light_sum += olm->bspLightBytes[ofs];
|
||||||
if ( deluxemap ) {
|
if ( deluxemap ) {
|
||||||
|
|
@ -2284,7 +2278,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
}
|
}
|
||||||
|
|
||||||
ofs = y * olm->customWidth + ( x + 1 ) % olm->customWidth;
|
ofs = y * olm->customWidth + ( x + 1 ) % olm->customWidth;
|
||||||
if ( olm->lightBits[ofs >> 3] & ( 1 << ( ofs & 7 ) ) ) { /* already filled */
|
if ( bit_is_enabled( olm->lightBits, ofs ) ) { /* already filled */
|
||||||
++cnt;
|
++cnt;
|
||||||
light_sum += olm->bspLightBytes[ofs];
|
light_sum += olm->bspLightBytes[ofs];
|
||||||
if ( deluxemap ) {
|
if ( deluxemap ) {
|
||||||
|
|
@ -2295,7 +2289,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
if ( cnt ) {
|
if ( cnt ) {
|
||||||
++filled;
|
++filled;
|
||||||
ofs = y * olm->customWidth + x;
|
ofs = y * olm->customWidth + x;
|
||||||
lightBitsNew[ofs >> 3] |= ( 1 << ( ofs & 7 ) );
|
bit_enable( lightBitsNew, ofs );
|
||||||
lightBytesNew[ofs] = light_sum * ( 1.0 / cnt );
|
lightBytesNew[ofs] = light_sum * ( 1.0 / cnt );
|
||||||
if ( deluxemap ) {
|
if ( deluxemap ) {
|
||||||
dirBytesNew[ofs] = dir_sum * ( 1.0 / cnt );
|
dirBytesNew[ofs] = dir_sum * ( 1.0 / cnt );
|
||||||
|
|
@ -2986,7 +2980,7 @@ void StoreSurfaceLightmaps( bool fastAllocate ){
|
||||||
}
|
}
|
||||||
else if( lightmapPink ){
|
else if( lightmapPink ){
|
||||||
for ( x = 0; x < olm->customHeight * olm->customWidth; ++x ){
|
for ( x = 0; x < olm->customHeight * olm->customWidth; ++x ){
|
||||||
if ( ( olm->lightBits[x >> 3] & ( 1 << ( x & 7 ) ) ) == 0 ) { /* not filled */
|
if ( !bit_is_enabled( olm->lightBits, x ) ) { /* not filled */
|
||||||
olm->bspLightBytes[x] = { 255, 0, 255 };
|
olm->bspLightBytes[x] = { 255, 0, 255 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,9 @@ void SortPortals( void ){
|
||||||
int LeafVectorFromPortalVector( byte *portalbits, byte *leafbits ){
|
int LeafVectorFromPortalVector( byte *portalbits, byte *leafbits ){
|
||||||
for ( int i = 0; i < numportals * 2; ++i )
|
for ( int i = 0; i < numportals * 2; ++i )
|
||||||
{
|
{
|
||||||
if ( portalbits[i >> 3] & ( 1 << ( i & 7 ) ) ) {
|
if ( bit_is_enabled( portalbits, i ) ) {
|
||||||
const vportal_t& p = portals[i];
|
const vportal_t& p = portals[i];
|
||||||
leafbits[p.leaf >> 3] |= ( 1 << ( p.leaf & 7 ) );
|
bit_enable( leafbits, p.leaf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,8 +108,8 @@ int LeafVectorFromPortalVector( byte *portalbits, byte *leafbits ){
|
||||||
while ( leafs[leafnum].merged >= 0 )
|
while ( leafs[leafnum].merged >= 0 )
|
||||||
leafnum = leafs[leafnum].merged;
|
leafnum = leafs[leafnum].merged;
|
||||||
//if the merged leaf is visible then the original leaf is visible
|
//if the merged leaf is visible then the original leaf is visible
|
||||||
if ( leafbits[leafnum >> 3] & ( 1 << ( leafnum & 7 ) ) ) {
|
if ( bit_is_enabled( leafbits, leafnum ) ) {
|
||||||
leafbits[i >> 3] |= ( 1 << ( i & 7 ) );
|
bit_enable( leafbits, i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CountBits( leafbits, portalclusters ); //c_leafs
|
return CountBits( leafbits, portalclusters ); //c_leafs
|
||||||
|
|
@ -148,13 +148,12 @@ void ClusterMerge( int leafnum ){
|
||||||
}
|
}
|
||||||
for ( int j = 0; j < portallongs; ++j )
|
for ( int j = 0; j < portallongs; ++j )
|
||||||
( (long *)portalvector )[j] |= ( (long *)p->portalvis )[j];
|
( (long *)portalvector )[j] |= ( (long *)p->portalvis )[j];
|
||||||
const int pnum = p - portals;
|
bit_enable( portalvector, p - portals );
|
||||||
portalvector[pnum >> 3] |= 1 << ( pnum & 7 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( uncompressed, 0, leafbytes );
|
memset( uncompressed, 0, leafbytes );
|
||||||
|
|
||||||
uncompressed[mergedleafnum >> 3] |= ( 1 << ( mergedleafnum & 7 ) );
|
bit_enable( uncompressed, mergedleafnum );
|
||||||
// convert portal bits to leaf bits
|
// convert portal bits to leaf bits
|
||||||
numvis = LeafVectorFromPortalVector( portalvector, uncompressed );
|
numvis = LeafVectorFromPortalVector( portalvector, uncompressed );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
int CountBits( const byte *bits, int numbits ){
|
int CountBits( const byte *bits, int numbits ){
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for ( int i = 0; i < numbits; ++i )
|
for ( int i = 0; i < numbits; ++i )
|
||||||
if ( bits[i >> 3] & ( 1 << ( i & 7 ) ) ) {
|
if ( bit_is_enabled( bits, i ) ) {
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -380,7 +380,6 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
|
||||||
leaf_t *leaf;
|
leaf_t *leaf;
|
||||||
int j, n;
|
int j, n;
|
||||||
long *test, *might, *prevmight, *vis, more;
|
long *test, *might, *prevmight, *vis, more;
|
||||||
int pnum;
|
|
||||||
|
|
||||||
thread->c_chains++;
|
thread->c_chains++;
|
||||||
|
|
||||||
|
|
@ -408,7 +407,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
|
||||||
if ( p->removed ) {
|
if ( p->removed ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pnum = p - portals;
|
const int pnum = p - portals;
|
||||||
|
|
||||||
/* MrE: portal trace debug code
|
/* MrE: portal trace debug code
|
||||||
{
|
{
|
||||||
|
|
@ -429,7 +428,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !( prevstack->mightsee[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) {
|
if ( !bit_is_enabled( prevstack->mightsee, pnum ) ) {
|
||||||
continue; // can't possibly see it
|
continue; // can't possibly see it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -451,7 +450,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !more &&
|
if ( !more &&
|
||||||
( thread->base->portalvis[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) { // can't see anything new
|
bit_is_enabled( thread->base->portalvis, pnum ) ) { // can't see anything new
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -522,7 +521,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
|
||||||
if ( !prevstack->pass ) { // the second leaf can only be blocked if coplanar
|
if ( !prevstack->pass ) { // the second leaf can only be blocked if coplanar
|
||||||
|
|
||||||
// mark the portal as visible
|
// mark the portal as visible
|
||||||
thread->base->portalvis[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( thread->base->portalvis, pnum );
|
||||||
|
|
||||||
RecursiveLeafFlow( p->leaf, thread, &stack );
|
RecursiveLeafFlow( p->leaf, thread, &stack );
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -574,7 +573,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark the portal as visible
|
// mark the portal as visible
|
||||||
thread->base->portalvis[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( thread->base->portalvis, pnum );
|
||||||
|
|
||||||
// flow through it for real
|
// flow through it for real
|
||||||
RecursiveLeafFlow( p->leaf, thread, &stack );
|
RecursiveLeafFlow( p->leaf, thread, &stack );
|
||||||
|
|
@ -641,7 +640,6 @@ void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstack_t *pr
|
||||||
passage_t *passage, *nextpassage;
|
passage_t *passage, *nextpassage;
|
||||||
int i, j;
|
int i, j;
|
||||||
long *might, *vis, *prevmight, *cansee, *portalvis, more;
|
long *might, *vis, *prevmight, *cansee, *portalvis, more;
|
||||||
int pnum;
|
|
||||||
|
|
||||||
leaf = &leafs[portal->leaf];
|
leaf = &leafs[portal->leaf];
|
||||||
|
|
||||||
|
|
@ -662,14 +660,14 @@ void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstack_t *pr
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nextpassage = passage->next;
|
nextpassage = passage->next;
|
||||||
pnum = p - portals;
|
const int pnum = p - portals;
|
||||||
|
|
||||||
if ( !( prevstack->mightsee[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) {
|
if ( !bit_is_enabled( prevstack->mightsee, pnum ) ) {
|
||||||
continue; // can't possibly see it
|
continue; // can't possibly see it
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark the portal as visible
|
// mark the portal as visible
|
||||||
thread->base->portalvis[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( thread->base->portalvis, pnum );
|
||||||
|
|
||||||
prevmight = (long *)prevstack->mightsee;
|
prevmight = (long *)prevstack->mightsee;
|
||||||
cansee = (long *)passage->cansee;
|
cansee = (long *)passage->cansee;
|
||||||
|
|
@ -764,7 +762,6 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
|
||||||
passage_t *passage, *nextpassage;
|
passage_t *passage, *nextpassage;
|
||||||
int i, j, n;
|
int i, j, n;
|
||||||
long *might, *vis, *prevmight, *cansee, *portalvis, more;
|
long *might, *vis, *prevmight, *cansee, *portalvis, more;
|
||||||
int pnum;
|
|
||||||
|
|
||||||
// thread->c_chains++;
|
// thread->c_chains++;
|
||||||
|
|
||||||
|
|
@ -795,9 +792,9 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nextpassage = passage->next;
|
nextpassage = passage->next;
|
||||||
pnum = p - portals;
|
const int pnum = p - portals;
|
||||||
|
|
||||||
if ( !( prevstack->mightsee[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) {
|
if ( !bit_is_enabled( prevstack->mightsee, pnum ) ) {
|
||||||
continue; // can't possibly see it
|
continue; // can't possibly see it
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -823,7 +820,7 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
|
||||||
might++;
|
might++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !more && ( thread->base->portalvis[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) { // can't see anything new
|
if ( !more && bit_is_enabled( thread->base->portalvis, pnum ) ) { // can't see anything new
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,7 +891,7 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
|
||||||
if ( !prevstack->pass ) { // the second leaf can only be blocked if coplanar
|
if ( !prevstack->pass ) { // the second leaf can only be blocked if coplanar
|
||||||
|
|
||||||
// mark the portal as visible
|
// mark the portal as visible
|
||||||
thread->base->portalvis[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( thread->base->portalvis, pnum );
|
||||||
|
|
||||||
RecursivePassagePortalFlow( p, thread, &stack );
|
RecursivePassagePortalFlow( p, thread, &stack );
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -946,7 +943,7 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark the portal as visible
|
// mark the portal as visible
|
||||||
thread->base->portalvis[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( thread->base->portalvis, pnum );
|
||||||
|
|
||||||
// flow through it for real
|
// flow through it for real
|
||||||
RecursivePassagePortalFlow( p, thread, &stack );
|
RecursivePassagePortalFlow( p, thread, &stack );
|
||||||
|
|
@ -1273,10 +1270,10 @@ void CreatePassages( int portalnum ){
|
||||||
if ( p->removed ) {
|
if ( p->removed ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !( target->portalflood[j >> 3] & ( 1 << ( j & 7 ) ) ) ) {
|
if ( !bit_is_enabled( target->portalflood, j ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( !( portal->portalflood[j >> 3] & ( 1 << ( j & 7 ) ) ) ) {
|
if ( !bit_is_enabled( portal->portalflood, j ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for ( k = 0; k < numseperators; k++ )
|
for ( k = 0; k < numseperators; k++ )
|
||||||
|
|
@ -1334,7 +1331,7 @@ void CreatePassages( int portalnum ){
|
||||||
if ( k < numseperators ) {
|
if ( k < numseperators ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
passage->cansee[j >> 3] |= ( 1 << ( j & 7 ) );
|
bit_enable( passage->cansee, j );
|
||||||
numsee++;
|
numsee++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1418,15 +1415,15 @@ void SimpleFlood( vportal_t *srcportal, int leafnum ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const int pnum = p - portals;
|
const int pnum = p - portals;
|
||||||
if ( !( srcportal->portalfront[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) {
|
if ( !bit_is_enabled( srcportal->portalfront, pnum ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( srcportal->portalflood[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) {
|
if ( bit_is_enabled( srcportal->portalflood, pnum ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcportal->portalflood[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( srcportal->portalflood, pnum );
|
||||||
|
|
||||||
SimpleFlood( srcportal, p->leaf );
|
SimpleFlood( srcportal, p->leaf );
|
||||||
}
|
}
|
||||||
|
|
@ -1516,7 +1513,7 @@ void BasePortalVis( int portalnum ){
|
||||||
continue; // no points on front
|
continue; // no points on front
|
||||||
|
|
||||||
}
|
}
|
||||||
p->portalfront[j >> 3] |= ( 1 << ( j & 7 ) );
|
bit_enable( p->portalfront, j );
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleFlood( p, p->leaf );
|
SimpleFlood( p, p->leaf );
|
||||||
|
|
@ -1560,7 +1557,7 @@ void RecursiveLeafBitFlow( int leafnum, byte *mightsee, byte *cansee ){
|
||||||
const int pnum = p - portals;
|
const int pnum = p - portals;
|
||||||
|
|
||||||
// if some previous portal can't see it, skip
|
// if some previous portal can't see it, skip
|
||||||
if ( !( mightsee[pnum >> 3] & ( 1 << ( pnum & 7 ) ) ) ) {
|
if ( !bit_is_enabled( mightsee, pnum ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1577,7 +1574,7 @@ void RecursiveLeafBitFlow( int leafnum, byte *mightsee, byte *cansee ){
|
||||||
continue; // can't see anything new
|
continue; // can't see anything new
|
||||||
|
|
||||||
}
|
}
|
||||||
cansee[pnum >> 3] |= ( 1 << ( pnum & 7 ) );
|
bit_enable( cansee, pnum );
|
||||||
|
|
||||||
RecursiveLeafBitFlow( p->leaf, newmight, cansee );
|
RecursiveLeafBitFlow( p->leaf, newmight, cansee );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user