minor tweaks
This commit is contained in:
parent
e8996d0857
commit
15b391cdb3
|
|
@ -481,7 +481,7 @@ brush_t *BrushFromBounds( const Vector3& mins, const Vector3& maxs ){
|
|||
*/
|
||||
float BrushVolume( brush_t *brush ){
|
||||
int i;
|
||||
winding_t *w;
|
||||
const winding_t *w;
|
||||
Vector3 corner;
|
||||
float volume;
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void SwapBSPFile( void ){
|
|||
SwapBlock( (int*) bspModels, numBSPModels * sizeof( bspModels[ 0 ] ) );
|
||||
|
||||
/* shaders (don't swap the name) */
|
||||
for ( i = 0; i < numBSPShaders ; i++ )
|
||||
for ( i = 0; i < numBSPShaders; i++ )
|
||||
{
|
||||
if ( doingBSP ){
|
||||
si = ShaderInfoForShader( bspShaders[ i ].shader );
|
||||
|
|
@ -377,7 +377,7 @@ void PartialLoadBSPFile( const char *filename ){
|
|||
int i;
|
||||
|
||||
/* shaders (don't swap the name) */
|
||||
for ( i = 0; i < numBSPShaders ; i++ )
|
||||
for ( i = 0; i < numBSPShaders; i++ )
|
||||
{
|
||||
bspShaders[ i ].contentFlags = LittleLong( bspShaders[ i ].contentFlags );
|
||||
bspShaders[ i ].surfaceFlags = LittleLong( bspShaders[ i ].surfaceFlags );
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ xmlNodePtr LeakFile( tree_t *tree ){
|
|||
|
||||
// find the best portal exit
|
||||
next = node->occupied;
|
||||
for ( p = node->portals ; p ; p = p->next[!s] )
|
||||
for ( p = node->portals; p; p = p->next[!s] )
|
||||
{
|
||||
s = ( p->nodes[0] == node );
|
||||
if ( p->nodes[s]->occupied
|
||||
|
|
|
|||
|
|
@ -3573,7 +3573,7 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){
|
|||
/* delete the light */
|
||||
numCulledLights++;
|
||||
*owner = light->next;
|
||||
free( light->w );
|
||||
FreeWinding( light->w );
|
||||
free( light );
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -573,10 +573,10 @@ void SetBrushContents( brush_t *b ){
|
|||
|
||||
void AddBrushBevels( void ){
|
||||
int axis, dir;
|
||||
int i, j, k, l, order;
|
||||
int i, k, order;
|
||||
side_t sidetemp;
|
||||
side_t *s, *s2;
|
||||
winding_t *w, *w2;
|
||||
const winding_t *w, *w2;
|
||||
Plane3f plane;
|
||||
Vector3 vec, vec2;
|
||||
float d, minBack;
|
||||
|
|
@ -645,7 +645,7 @@ void AddBrushBevels( void ){
|
|||
s->contentFlags = buildBrush->sides[ 0 ].contentFlags;
|
||||
/* handle bevel surfaceflags for topmost one only: assuming that only walkable ones are meaningful */
|
||||
if( axis == 2 && dir == 1 ){
|
||||
for ( j = 0; j < buildBrush->numsides; j++ ) {
|
||||
for ( int j = 0; j < buildBrush->numsides; j++ ) {
|
||||
s2 = buildBrush->sides + j;
|
||||
w = s2->winding;
|
||||
if ( !w ) {
|
||||
|
|
@ -686,7 +686,7 @@ void AddBrushBevels( void ){
|
|||
if ( !w ) {
|
||||
continue;
|
||||
}
|
||||
for ( j = 0; j < w->size(); j++ ) {
|
||||
for ( size_t j = 0; j < w->size(); j++ ) {
|
||||
k = ( j + 1 ) % w->size();
|
||||
vec = ( *w )[j] - ( *w )[k];
|
||||
if ( VectorNormalize( vec ) < 0.5f ) {
|
||||
|
|
@ -734,15 +734,17 @@ void AddBrushBevels( void ){
|
|||
continue;
|
||||
}
|
||||
minBack = 0.0f;
|
||||
for ( l = 0; l < w2->size(); l++ ) {
|
||||
d = plane3_distance_to_point( plane, ( *w2 )[l] );
|
||||
bool point_in_front = false;
|
||||
for ( const Vector3& point : *w2 ) {
|
||||
d = plane3_distance_to_point( plane, point );
|
||||
if ( d > 0.1f ) {
|
||||
point_in_front = true;
|
||||
break; // point in front
|
||||
}
|
||||
value_minimize( minBack, d );
|
||||
}
|
||||
// if some point was at the front
|
||||
if ( l != w2->size() ) {
|
||||
if ( point_in_front ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void FreePortal( portal_t *p ){
|
|||
returns true if the portal has non-opaque leafs on both sides
|
||||
*/
|
||||
|
||||
bool PortalPassable( portal_t *p ){
|
||||
bool PortalPassable( const portal_t *p ){
|
||||
/* is this to global outside leaf? */
|
||||
if ( !p->onnode ) {
|
||||
return false;
|
||||
|
|
@ -454,7 +454,7 @@ void CalcNodeBounds( node_t *node ){
|
|||
|
||||
// calc mins/maxs for both leafs and nodes
|
||||
node->minmax.clear();
|
||||
for ( p = node->portals ; p ; p = p->next[s] )
|
||||
for ( p = node->portals; p; p = p->next[s] )
|
||||
{
|
||||
s = ( p->nodes[1] == node );
|
||||
WindingExtendBounds( *p->winding, node->minmax );
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ void WriteFloat( FILE *f, float v ){
|
|||
|
||||
void CountVisportals_r( node_t *node ){
|
||||
int s;
|
||||
portal_t *p;
|
||||
winding_t *w;
|
||||
|
||||
// decision node
|
||||
if ( node->planenum != PLANENUM_LEAF ) {
|
||||
|
|
@ -75,9 +73,9 @@ void CountVisportals_r( node_t *node ){
|
|||
return;
|
||||
}
|
||||
|
||||
for ( p = node->portals ; p ; p = p->next[s] )
|
||||
for ( const portal_t *p = node->portals; p; p = p->next[s] )
|
||||
{
|
||||
w = p->winding;
|
||||
const winding_t *w = p->winding;
|
||||
s = ( p->nodes[1] == node );
|
||||
if ( w && p->nodes[0] == node ) {
|
||||
if ( !PortalPassable( p ) ) {
|
||||
|
|
@ -98,8 +96,6 @@ void CountVisportals_r( node_t *node ){
|
|||
*/
|
||||
void WritePortalFile_r( node_t *node ){
|
||||
int s, flags;
|
||||
portal_t *p;
|
||||
winding_t *w;
|
||||
|
||||
// decision node
|
||||
if ( node->planenum != PLANENUM_LEAF ) {
|
||||
|
|
@ -112,9 +108,9 @@ void WritePortalFile_r( node_t *node ){
|
|||
return;
|
||||
}
|
||||
|
||||
for ( p = node->portals ; p ; p = p->next[s] )
|
||||
for (const portal_t *p = node->portals; p; p = p->next[s] )
|
||||
{
|
||||
w = p->winding;
|
||||
const winding_t *w = p->winding;
|
||||
s = ( p->nodes[1] == node );
|
||||
if ( w && p->nodes[0] == node ) {
|
||||
if ( !PortalPassable( p ) ) {
|
||||
|
|
@ -168,8 +164,6 @@ void WritePortalFile_r( node_t *node ){
|
|||
|
||||
void CountSolidFaces_r( node_t *node ){
|
||||
int s;
|
||||
portal_t *p;
|
||||
winding_t *w;
|
||||
|
||||
// decision node
|
||||
if ( node->planenum != PLANENUM_LEAF ) {
|
||||
|
|
@ -182,9 +176,9 @@ void CountSolidFaces_r( node_t *node ){
|
|||
return;
|
||||
}
|
||||
|
||||
for ( p = node->portals ; p ; p = p->next[s] )
|
||||
for ( const portal_t *p = node->portals; p; p = p->next[s] )
|
||||
{
|
||||
w = p->winding;
|
||||
const winding_t *w = p->winding;
|
||||
s = ( p->nodes[1] == node );
|
||||
if ( w ) {
|
||||
if ( PortalPassable( p ) ) {
|
||||
|
|
@ -207,8 +201,6 @@ void CountSolidFaces_r( node_t *node ){
|
|||
*/
|
||||
void WriteFaceFile_r( node_t *node ){
|
||||
int s;
|
||||
portal_t *p;
|
||||
winding_t *w;
|
||||
|
||||
// decision node
|
||||
if ( node->planenum != PLANENUM_LEAF ) {
|
||||
|
|
@ -221,9 +213,9 @@ void WriteFaceFile_r( node_t *node ){
|
|||
return;
|
||||
}
|
||||
|
||||
for ( p = node->portals ; p ; p = p->next[s] )
|
||||
for ( const portal_t *p = node->portals; p; p = p->next[s] )
|
||||
{
|
||||
w = p->winding;
|
||||
const winding_t *w = p->winding;
|
||||
s = ( p->nodes[1] == node );
|
||||
if ( w ) {
|
||||
if ( PortalPassable( p ) ) {
|
||||
|
|
@ -312,7 +304,7 @@ void NumberLeafs_r( node_t *node, int c ){
|
|||
|
||||
#if 0
|
||||
// count the portals
|
||||
for ( p = node->portals ; p ; )
|
||||
for ( p = node->portals; p; )
|
||||
{
|
||||
if ( p->nodes[0] == node ) { // only write out from first leaf
|
||||
if ( PortalPassable( p ) ) {
|
||||
|
|
|
|||
|
|
@ -1610,7 +1610,7 @@ void MakeHeadnodePortals( tree_t *tree );
|
|||
void MakeNodePortal( node_t *node );
|
||||
void SplitNodePortals( node_t *node );
|
||||
|
||||
bool PortalPassable( portal_t *p );
|
||||
bool PortalPassable( const portal_t *p );
|
||||
|
||||
enum class EFloodEntities
|
||||
{
|
||||
|
|
|
|||
|
|
@ -854,7 +854,7 @@ mapDrawSurface_t *DrawSurfaceForSide( entity_t *e, brush_t *b, side_t *s, const
|
|||
}
|
||||
|
||||
/* round the xyz to a given precision and translate by origin */
|
||||
for ( size_t i = 0 ; i < 3 ; i++ )
|
||||
for ( size_t i = 0; i < 3; i++ )
|
||||
dv->xyz[ i ] = SNAP_INT_TO_FLOAT * floor( dv->xyz[ i ] * SNAP_FLOAT_TO_INT + 0.5 );
|
||||
vTranslated = dv->xyz + e->originbrush_origin;
|
||||
|
||||
|
|
@ -1473,7 +1473,7 @@ bool SideInBrush( side_t *side, brush_t *b ){
|
|||
void CullSides( entity_t *e ){
|
||||
int numPoints;
|
||||
int i, j, k, l, first, second, dir;
|
||||
winding_t *w1, *w2;
|
||||
const winding_t *w1, *w2;
|
||||
brush_t *b1, *b2;
|
||||
side_t *side1, *side2;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ void FreeTreePortals_r( node_t *node ){
|
|||
}
|
||||
|
||||
// free portals
|
||||
for ( p = node->portals ; p ; p = nextp )
|
||||
for ( p = node->portals; p; p = nextp )
|
||||
{
|
||||
s = ( p->nodes[1] == node );
|
||||
nextp = p->next[s];
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ int EmitDrawNode_r( node_t *node ){
|
|||
//
|
||||
// recursively output the other nodes
|
||||
//
|
||||
for ( i = 0 ; i < 2 ; i++ )
|
||||
for ( i = 0; i < 2; i++ )
|
||||
{
|
||||
if ( node->children[i]->planenum == PLANENUM_LEAF ) {
|
||||
n->children[i] = -( numBSPLeafs + 1 );
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user