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