From 34d45e210f74edf0690df413b45cc7630d91bd01 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 23 Nov 2011 12:01:02 +0100 Subject: [PATCH] _farplanedist now ignores C_SKY leafs --- tools/quake3/q3map2/prtfile.c | 14 ++++++++++---- tools/quake3/q3map2/q3map2.h | 1 + tools/quake3/q3map2/vis.c | 9 +++++---- tools/quake3/q3map2/visflow.c | 1 + 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tools/quake3/q3map2/prtfile.c b/tools/quake3/q3map2/prtfile.c index 2f10c7c0..e3759c0c 100644 --- a/tools/quake3/q3map2/prtfile.c +++ b/tools/quake3/q3map2/prtfile.c @@ -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 ; inumpoints ; i++) diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 8c240ea8..427c0279 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -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 */ diff --git a/tools/quake3/q3map2/vis.c b/tools/quake3/q3map2/vis.c index b9291922..87fb3a31 100644 --- a/tools/quake3/q3map2/vis.c +++ b/tools/quake3/q3map2/vis.c @@ -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; diff --git a/tools/quake3/q3map2/visflow.c b/tools/quake3/q3map2/visflow.c index c3bdfdda..672b91a5 100644 --- a/tools/quake3/q3map2/visflow.c +++ b/tools/quake3/q3map2/visflow.c @@ -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 ); -- 2.39.2