From 00c0a7f03eb62658594f9741c66b2a9407b8b5aa Mon Sep 17 00:00:00 2001 From: divverent Date: Wed, 2 Jan 2008 13:48:57 +0000 Subject: [PATCH] before calling Mod_CanSeeBox_Trace or TraceLineOfSight, check if the model actually supports them (prevents crash with missing worldmodel) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7894 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 2 +- sv_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index c01a6885..3e4ec056 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2214,7 +2214,7 @@ static void R_View_UpdateEntityVisible (void) r_viewcache.entityvisible[i] = !(ent->flags & renderimask) && ((ent->model && ent->model->type == mod_sprite && (ent->model->sprite.sprnum_type == SPR_LABEL || ent->model->sprite.sprnum_type == SPR_LABEL_SCALE)) || !R_CullBox(ent->mins, ent->maxs)) && ((ent->effects & EF_NODEPTHTEST) || (ent->flags & RENDER_VIEWMODEL) || r_refdef.worldmodel->brush.BoxTouchingVisibleLeafs(r_refdef.worldmodel, r_viewcache.world_leafvisible, ent->mins, ent->maxs)); } - if(r_cullentities_trace.integer) + if(r_cullentities_trace.integer && r_refdef.worldmodel->brush.TraceLineOfSight) { for (i = 0;i < r_refdef.numentities;i++) { diff --git a/sv_main.c b/sv_main.c index 8ce2f6d6..53956869 100644 --- a/sv_main.c +++ b/sv_main.c @@ -1263,7 +1263,7 @@ void SV_MarkWriteEntityStateToClient(entity_state_t *s) } // or not seen by random tracelines - if (sv_cullentities_trace.integer && !isbmodel) + if (sv_cullentities_trace.integer && !isbmodel && sv.worldmodel->brush.TraceLineOfSight) { int samples = s->specialvisibilityradius ? sv_cullentities_trace_samples_extra.integer : sv_cullentities_trace_samples.integer; float enlarge = sv_cullentities_trace_enlarge.value; -- 2.39.2