Merge branch 'master' into divVerent/farplanedist-sky-fix
authorRudolf Polzer <divverent@xonotic.org>
Tue, 15 May 2012 09:56:17 +0000 (11:56 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 15 May 2012 09:58:06 +0000 (11:58 +0200)
Conflicts:
tools/quake3/q3map2/prtfile.c
tools/quake3/q3map2/vis.c
tools/quake3/q3map2/visflow.c

tools/quake3/q3map2/prtfile.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/vis.c
tools/quake3/q3map2/visflow.c

index b5c09484156c3290bfc749a378a512ca0b624f23..514d255f7b556ba2ce35597a04a1feb874f35f38 100644 (file)
@@ -102,7 +102,7 @@ void CountVisportals_r( node_t *node ){
    =================
  */
 void WritePortalFile_r( node_t *node ){
-       int i, s;
+       int i, s, flags;
        portal_t    *p;
        winding_t   *w;
        vec3_t normal;
@@ -146,14 +146,20 @@ void WritePortalFile_r( node_t *node ){
                                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 " );
+                       if( p->compileFlags & C_HINT ) {
+                               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 */
                        for ( i = 0 ; i < w->numpoints ; i++ )
                        {
index bbb3e76e73518d27b8bc12ef7a42ca46f51b2188..2a938822620529ed8e6521b939884cab0b0aa2be 100644 (file)
@@ -1237,6 +1237,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 fb560d511311c911499c1719e50ed63376cb1757..b166c91fc4f576f46a1f964dad2c98b31d83e820 100644 (file)
@@ -890,7 +890,7 @@ void WritePortals( char *filename ){
    ============
  */
 void LoadPortals( char *name ){
-       int i, j, hint;
+       int i, j, flags;
        vportal_t   *p;
        leaf_t      *l;
        char magic[80];
@@ -964,8 +964,8 @@ void LoadPortals( char *name ){
                         || 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 );
@@ -1001,7 +1001,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 6c48e2da867dea8cdd62bc7ea74adf7eeeb5bbfe..5a7ffd92de65c6ed8cc77889b3a22e07e76aa666 100644 (file)
@@ -1615,7 +1615,7 @@ void BasePortalVis( int portalnum ){
                 */
 
                /* ydnar: this is known-to-be-working farplane code */
-               if ( farPlaneDist > 0.0f ) {
+               if ( !p->sky && !tp->sky && farPlaneDist > 0.0f ) {
                        VectorSubtract( p->origin, tp->origin, dir );
                        if ( VectorLength( dir ) - p->radius - tp->radius > farPlaneDist ) {
                                continue;