From: havoc Date: Wed, 30 Oct 2002 11:46:08 +0000 (+0000) Subject: fix viewmodel crash X-Git-Tag: RELEASE_0_2_0_RC1~95 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;ds=sidebyside;h=381ef0bb5157065f2a092b2dd316ece3b085ed5a;p=xonotic%2Fdarkplaces.git fix viewmodel crash git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2589 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index e251750c..3a238c3f 100644 --- a/cl_main.c +++ b/cl_main.c @@ -746,18 +746,6 @@ static void CL_RelinkNetworkEntities(void) } } -static void CL_RelinkViewModel(void) -{ - entity_t *ent; - if (!r_drawviewmodel.integer || chase_active.integer || envmap || !r_drawentities.integer || cl.items & IT_INVISIBILITY || cl.stats[STAT_HEALTH] <= 0 || cl.viewent.render.model == NULL) - return; - - ent = &cl.viewent; - // FIXME: set up view model here? - if (r_refdef.numentities < r_refdef.maxentities) - r_refdef.entities[r_refdef.numentities++] = &ent->render; -} - void CL_Effect(vec3_t org, int modelindex, int startframe, int framecount, float framerate) { int i; @@ -951,7 +939,6 @@ void CL_RelinkEntities (void) CL_RelinkWorld(); CL_RelinkStaticEntities(); CL_RelinkNetworkEntities(); - CL_RelinkViewModel(); CL_RelinkEffects(); CL_RelinkBeams(); CL_MoveParticles(); diff --git a/client.h b/client.h index a52d83e5..71e0b432 100644 --- a/client.h +++ b/client.h @@ -632,9 +632,6 @@ typedef struct // fullscreen color blend float viewblend[4]; - // weapon model - entity_render_t viewent; - entity_render_t **entities; int numentities; int maxentities; diff --git a/view.c b/view.c index b3fdf909..e6a66a03 100644 --- a/view.c +++ b/view.c @@ -533,6 +533,7 @@ void V_CalcRefdef (void) r_refdef.vieworg[2] += cl.viewheight + bob; // set up gun + // (FIXME! this should be in cl_main.c with the other linking code, not view.c!) view->state_current.modelindex = cl.stats[STAT_WEAPON]; view->state_current.frame = cl.stats[STAT_WEAPONFRAME]; VectorCopy(r_refdef.vieworg, view->render.origin); @@ -557,8 +558,9 @@ void V_CalcRefdef (void) VectorAdd(r_refdef.vieworg, cl.punchvector, r_refdef.vieworg); } - // copy to refdef - r_refdef.viewent = view->render; + // link into render entities list + if (r_refdef.numentities < r_refdef.maxentities && r_drawviewmodel.integer && !chase_active.integer && !envmap && r_drawentities.integer && !(cl.items & IT_INVISIBILITY) && cl.stats[STAT_HEALTH] > 0 && view->render.model != NULL) + r_refdef.entities[r_refdef.numentities++] = &view->render; } }