From e481a27e7de8bb960336c0d3d3131a6975b07907 Mon Sep 17 00:00:00 2001
From: havoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Wed, 7 May 2008 23:48:11 +0000
Subject: [PATCH] added some checks for the possibility of a map having no
 portals

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8283 d7cf8633-e32d-0410-b094-e92efae38249
---
 gl_rsurf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gl_rsurf.c b/gl_rsurf.c
index 707741ab..223e15cd 100644
--- a/gl_rsurf.c
+++ b/gl_rsurf.c
@@ -465,7 +465,7 @@ void R_View_WorldVisibility(qboolean forcenovis)
 		}
 		// just check if each leaf in the PVS is on screen
 		// (unless portal culling is enabled)
-		else if (r_useportalculling.integer < 1 || (r_useportalculling.integer < 2 && !r_novis.integer))
+		else if (!model->brush.data_portals || r_useportalculling.integer < 1 || (r_useportalculling.integer < 2 && !r_novis.integer))
 		{
 			// pvs method:
 			// simply check if each leaf is in the Potentially Visible Set,
@@ -925,12 +925,12 @@ void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, floa
 		info.pvs = NULL;
 	R_UpdateAllTextureInfo(ent);
 
-	if (r_shadow_frontsidecasting.integer && r_shadow_compilingrtlight && r_shadow_realtime_world_compileportalculling.integer)
+	if (r_shadow_frontsidecasting.integer && r_shadow_compilingrtlight && r_shadow_realtime_world_compileportalculling.integer && info.model->brush.data_portals)
 	{
 		// use portal recursion for exact light volume culling, and exact surface checking
 		Portal_Visibility(info.model, info.relativelightorigin, info.outleaflist, info.outleafpvs, &info.outnumleafs, info.outsurfacelist, info.outsurfacepvs, &info.outnumsurfaces, NULL, 0, true, info.lightmins, info.lightmaxs, info.outmins, info.outmaxs, info.outshadowtrispvs, info.outlighttrispvs);
 	}
-	else if (r_shadow_frontsidecasting.integer && r_shadow_realtime_dlight_portalculling.integer)
+	else if (r_shadow_frontsidecasting.integer && r_shadow_realtime_dlight_portalculling.integer && info.model->brush.data_portals)
 	{
 		// use portal recursion for exact light volume culling, but not the expensive exact surface checking
 		Portal_Visibility(info.model, info.relativelightorigin, info.outleaflist, info.outleafpvs, &info.outnumleafs, info.outsurfacelist, info.outsurfacepvs, &info.outnumsurfaces, NULL, 0, r_shadow_realtime_dlight_portalculling.integer >= 2, info.lightmins, info.lightmaxs, info.outmins, info.outmaxs, info.outshadowtrispvs, info.outlighttrispvs);
-- 
2.39.5