]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix viewmodel crash
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 30 Oct 2002 11:46:08 +0000 (11:46 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 30 Oct 2002 11:46:08 +0000 (11:46 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2589 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
client.h
view.c

index e251750ca0832f3c7166238dbd61b8dd218abf07..3a238c3ffa40d5340b244fc704f74d949c2fc2d4 100644 (file)
--- 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();
index a52d83e5291708bfa9db096a47714331cb6e2ed6..71e0b4323f629e7ebf4073ea831faa4bb9fd8e4a 100644 (file)
--- 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 b3fdf9096ac1dac6ee02acb348b31245045fb366..e6a66a0353d7c4e7faaae50647211796a2b4e57c 100644 (file)
--- 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;
        }
 }