_farplanedist now ignores C_SKY leafs

This commit is contained in:
Rudolf Polzer 2011-11-23 12:01:02 +01:00
parent 6b01d68ba6
commit 34d45e210f
4 changed files with 17 additions and 8 deletions

View File

@ -102,7 +102,7 @@ WritePortalFile_r
*/ */
void WritePortalFile_r (node_t *node) void WritePortalFile_r (node_t *node)
{ {
int i, s; int i, s, flags;
portal_t *p; portal_t *p;
winding_t *w; winding_t *w;
vec3_t normal; vec3_t normal;
@ -144,12 +144,18 @@ void WritePortalFile_r (node_t *node)
} }
else else
fprintf (pf,"%i %i %i ",w->numpoints, p->nodes[0]->cluster, p->nodes[1]->cluster); fprintf (pf,"%i %i %i ",w->numpoints, p->nodes[0]->cluster, p->nodes[1]->cluster);
flags = 0;
/* ydnar: added this change to make antiportals work */ /* ydnar: added this change to make antiportals work */
if( p->compileFlags & C_HINT ) if( p->compileFlags & C_HINT )
fprintf( pf, "1 " ); flags |= 1;
else
fprintf( pf, "0 " ); /* divVerent: I want farplanedist to not kill skybox. So... */
if( p->compileFlags & C_SKY )
flags |= 2;
fprintf( pf, "%d ", flags );
/* write the winding */ /* write the winding */
for (i=0 ; i<w->numpoints ; i++) for (i=0 ; i<w->numpoints ; i++)

View File

@ -1236,6 +1236,7 @@ typedef struct
{ {
int num; int num;
qboolean hint; /* true if this portal was created from a hint splitter */ qboolean hint; /* true if this portal was created from a hint splitter */
qboolean sky; /* true if this portal belongs to a sky leaf */
qboolean removed; qboolean removed;
visPlane_t plane; /* normal pointing into neighbor */ visPlane_t plane; /* normal pointing into neighbor */
int leaf; /* neighbor */ int leaf; /* neighbor */

View File

@ -870,7 +870,7 @@ LoadPortals
*/ */
void LoadPortals (char *name) void LoadPortals (char *name)
{ {
int i, j, hint; int i, j, flags;
vportal_t *p; vportal_t *p;
leaf_t *l; leaf_t *l;
char magic[80]; char magic[80];
@ -935,8 +935,8 @@ void LoadPortals (char *name)
if (leafnums[0] > portalclusters if (leafnums[0] > portalclusters
|| leafnums[1] > portalclusters) || leafnums[1] > portalclusters)
Error ("LoadPortals: reading portal %i", i); Error ("LoadPortals: reading portal %i", i);
if (fscanf (f, "%i ", &hint) != 1) if (fscanf (f, "%i ", &flags) != 1)
Error ("LoadPortals: reading hint state"); Error ("LoadPortals: reading flags");
w = p->winding = NewFixedWinding (numpoints); w = p->winding = NewFixedWinding (numpoints);
w->numpoints = numpoints; w->numpoints = numpoints;
@ -970,7 +970,8 @@ void LoadPortals (char *name)
l->numportals++; l->numportals++;
p->num = i+1; p->num = i+1;
p->hint = hint; p->hint = ((flags & 1) != 0);
p->sky = ((flags & 2) != 0);
p->winding = w; p->winding = w;
VectorSubtract (vec3_origin, plane.normal, p->plane.normal); VectorSubtract (vec3_origin, plane.normal, p->plane.normal);
p->plane.dist = -plane.dist; p->plane.dist = -plane.dist;

View File

@ -1583,6 +1583,7 @@ void BasePortalVis( int portalnum )
*/ */
/* ydnar: this is known-to-be-working farplane code */ /* ydnar: this is known-to-be-working farplane code */
if( !p->sky && !tp->sky )
if( farPlaneDist > 0.0f ) if( farPlaneDist > 0.0f )
{ {
VectorSubtract( p->origin, tp->origin, dir ); VectorSubtract( p->origin, tp->origin, dir );