_farplanedist now ignores C_SKY leafs
authorRudolf Polzer <divverent@xonotic.org>
Wed, 23 Nov 2011 11:01:02 +0000 (12:01 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 23 Nov 2011 11:01:02 +0000 (12:01 +0100)
tools/quake3/q3map2/prtfile.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/vis.c
tools/quake3/q3map2/visflow.c

index 2f10c7c0b5b620e279a1370903b8af026198439e..e3759c0cd0a3cb06bdfe41d0b2e54bd81f768065 100644 (file)
@@ -102,7 +102,7 @@ WritePortalFile_r
 */
 void WritePortalFile_r (node_t *node)
 {
-       int                     i, s;   
+       int                     i, s, flags;
        portal_t        *p;
        winding_t       *w;
        vec3_t          normal;
@@ -144,12 +144,18 @@ void WritePortalFile_r (node_t *node)
                        }
                        else
                                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 */
                        if( p->compileFlags & C_HINT )
-                               fprintf( pf, "1 " );
-                       else
-                               fprintf( pf, "0 " );
+                               flags |= 1;
+
+                       /* divVerent: I want farplanedist to not kill skybox. So... */
+                       if( p->compileFlags & C_SKY )
+                               flags |= 2;
+
+                       fprintf( pf, "%d ", flags );
                        
                        /* write the winding */
                        for (i=0 ; i<w->numpoints ; i++)
index 8c240ea899b6ac97463f9b569f7410c73d1c98fa..427c0279b95b4b0d808c2f19ab8d74d06ac9af31 100644 (file)
@@ -1236,6 +1236,7 @@ typedef struct
 {
        int                                     num;
        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;
        visPlane_t                      plane;                  /* normal pointing into neighbor */
        int                                     leaf;                   /* neighbor */
index b92919226af604a9089019940bcb33f8410c3a5c..87fb3a3122fefc9d876358dcd3eceab83bc9fc76 100644 (file)
@@ -870,7 +870,7 @@ LoadPortals
 */
 void LoadPortals (char *name)
 {
-       int                     i, j, hint;
+       int                     i, j, flags;
        vportal_t       *p;
        leaf_t          *l;
        char            magic[80];
@@ -935,8 +935,8 @@ void LoadPortals (char *name)
                if (leafnums[0] > portalclusters
                || leafnums[1] > portalclusters)
                        Error ("LoadPortals: reading portal %i", i);
-               if (fscanf (f, "%i ", &hint) != 1)
-                       Error ("LoadPortals: reading hint state");
+               if (fscanf (f, "%i ", &flags) != 1)
+                       Error ("LoadPortals: reading flags");
                
                w = p->winding = NewFixedWinding (numpoints);
                w->numpoints = numpoints;
@@ -970,7 +970,8 @@ void LoadPortals (char *name)
                l->numportals++;
                
                p->num = i+1;
-               p->hint = hint;
+               p->hint = ((flags & 1) != 0);
+               p->sky = ((flags & 2) != 0);
                p->winding = w;
                VectorSubtract (vec3_origin, plane.normal, p->plane.normal);
                p->plane.dist = -plane.dist;
index c3bdfdda92dff86fb172cb11a0e563fda0502374..672b91a5aa53ad277f517546e97bec4d4384a3ce 100644 (file)
@@ -1583,6 +1583,7 @@ void BasePortalVis( int portalnum )
                */
                
                /* ydnar: this is known-to-be-working farplane code */
+               if( !p->sky && !tp->sky )
                if( farPlaneDist > 0.0f )
                {
                        VectorSubtract( p->origin, tp->origin, dir );