minor tweaks

This commit is contained in:
Garux 2021-10-28 12:25:26 +03:00
parent 2e9bf0af1c
commit 7626f69b02
2 changed files with 11 additions and 23 deletions

View File

@ -1744,7 +1744,7 @@ std::array<Vector3, 2> TextureAxisFromPlane( const plane_t& plane );
int VisMain( Args& args ); int VisMain( Args& args );
/* visflow.c */ /* visflow.c */
int CountBits( byte *bits, int numbits ); int CountBits( const byte *bits, int numbits );
void PassageFlow( int portalnum ); void PassageFlow( int portalnum );
void CreatePassages( int portalnum ); void CreatePassages( int portalnum );
void PassageMemory( void ); void PassageMemory( void );

View File

@ -53,7 +53,7 @@
void CalcMightSee (leaf_t *leaf, void CalcMightSee (leaf_t *leaf,
*/ */
int CountBits( 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 ( bits[i >> 3] & ( 1 << ( i & 7 ) ) ) {
@ -592,7 +592,6 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
*/ */
void PortalFlow( int portalnum ){ void PortalFlow( int portalnum ){
threaddata_t data; threaddata_t data;
int i;
vportal_t *p; vportal_t *p;
int c_might, c_can; int c_might, c_can;
@ -618,8 +617,7 @@ void PortalFlow( int portalnum ){
data.pstack_head.source = p->winding; data.pstack_head.source = p->winding;
data.pstack_head.portalplane = p->plane; data.pstack_head.portalplane = p->plane;
data.pstack_head.depth = 0; data.pstack_head.depth = 0;
for ( i = 0; i < portallongs; ++i ) memcpy( data.pstack_head.mightsee, p->portalflood, portalbytes );
( (long *)data.pstack_head.mightsee )[i] = ( (long *)p->portalflood )[i];
RecursiveLeafFlow( p->leaf, &data, &data.pstack_head ); RecursiveLeafFlow( p->leaf, &data, &data.pstack_head );
@ -687,14 +685,11 @@ void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstack_t *pr
for ( j = 0; j < portallongs; j++ ) for ( j = 0; j < portallongs; j++ )
{ {
if ( *might ) { if ( *might ) {
*might &= *cansee++ & *portalvis++; *might &= *cansee & *portalvis;
more |= ( *might & ~vis[j] ); more |= ( *might & ~vis[j] );
} }
else cansee++;
{ portalvis++;
cansee++;
portalvis++;
}
might++; might++;
} }
@ -717,7 +712,6 @@ void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstack_t *pr
*/ */
void PassageFlow( int portalnum ){ void PassageFlow( int portalnum ){
threaddata_t data; threaddata_t data;
int i;
vportal_t *p; vportal_t *p;
// int c_might, c_can; // int c_might, c_can;
@ -743,8 +737,7 @@ void PassageFlow( int portalnum ){
data.pstack_head.source = p->winding; data.pstack_head.source = p->winding;
data.pstack_head.portalplane = p->plane; data.pstack_head.portalplane = p->plane;
data.pstack_head.depth = 0; data.pstack_head.depth = 0;
for ( i = 0; i < portallongs; ++i ) memcpy( data.pstack_head.mightsee, p->portalflood, portalbytes );
( (long *)data.pstack_head.mightsee )[i] = ( (long *)p->portalflood )[i];
RecursivePassageFlow( p, &data, &data.pstack_head ); RecursivePassageFlow( p, &data, &data.pstack_head );
@ -822,14 +815,11 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
for ( j = 0; j < portallongs; j++ ) for ( j = 0; j < portallongs; j++ )
{ {
if ( *might ) { if ( *might ) {
*might &= *cansee++ & *portalvis++; *might &= *cansee & *portalvis;
more |= ( *might & ~vis[j] ); more |= ( *might & ~vis[j] );
} }
else cansee++;
{ portalvis++;
cansee++;
portalvis++;
}
might++; might++;
} }
@ -972,7 +962,6 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
*/ */
void PassagePortalFlow( int portalnum ){ void PassagePortalFlow( int portalnum ){
threaddata_t data; threaddata_t data;
int i;
vportal_t *p; vportal_t *p;
// int c_might, c_can; // int c_might, c_can;
@ -998,8 +987,7 @@ void PassagePortalFlow( int portalnum ){
data.pstack_head.source = p->winding; data.pstack_head.source = p->winding;
data.pstack_head.portalplane = p->plane; data.pstack_head.portalplane = p->plane;
data.pstack_head.depth = 0; data.pstack_head.depth = 0;
for ( i = 0; i < portallongs; ++i ) memcpy( data.pstack_head.mightsee, p->portalflood, portalbytes );
( (long *)data.pstack_head.mightsee )[i] = ( (long *)p->portalflood )[i];
RecursivePassagePortalFlow( p, &data, &data.pstack_head ); RecursivePassagePortalFlow( p, &data, &data.pstack_head );