From 7431c398d88f0467f42934164873332a16a2a858 Mon Sep 17 00:00:00 2001 From: Spoike Date: Fri, 9 Jan 2015 06:32:48 +0000 Subject: [PATCH] hack for skies and spectating from above. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4826 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/renderer.c | 43 +++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 2a423e149..483f52af6 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -2140,18 +2140,43 @@ qbyte *R_MarkLeaves_Q1 (void) r_visframecount++; - for (i=0 ; inumclusters ; i++) + if (r_viewleaf && r_viewleaf->contents == Q1CONTENTS_SOLID) { - if (vis[i>>3] & (1<<(i&7))) + //to improve spectating, when the camera is in a wall, we ignore any sky leafs. + //this prevents seeing the upwards-facing sky surfaces within the sky volumes. + //this will not affect inwards facing sky, so sky will basically appear as though it is identical to solid brushes. + for (i=0 ; inumclusters ; i++) { - node = (mnode_t *)&cl.worldmodel->leafs[i+1]; - do + if (vis[i>>3] & (1<<(i&7))) { - if (node->visframe == r_visframecount) - break; - node->visframe = r_visframecount; - node = node->parent; - } while (node); + if (cl.worldmodel->leafs[i+1].contents == Q1CONTENTS_SKY) + continue; + node = (mnode_t *)&cl.worldmodel->leafs[i+1]; + do + { + if (node->visframe == r_visframecount) + break; + node->visframe = r_visframecount; + node = node->parent; + } while (node); + } + } + } + else + { + for (i=0 ; inumclusters ; i++) + { + if (vis[i>>3] & (1<<(i&7))) + { + node = (mnode_t *)&cl.worldmodel->leafs[i+1]; + do + { + if (node->visframe == r_visframecount) + break; + node->visframe = r_visframecount; + node = node->parent; + } while (node); + } } } return vis;