]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - view.c
added rampsize parameter to BuildGammaTable8 and 16
[xonotic/darkplaces.git] / view.c
diff --git a/view.c b/view.c
index 2a9629c36a15e05c26b6f340679865965872708f..73acc74efdb06f04cc2e5647136ad61ed7b482c6 100644 (file)
--- a/view.c
+++ b/view.c
@@ -70,6 +70,7 @@ cvar_t chase_active = {CVAR_SAVE, "chase_active", "0", "enables chase cam"};
 cvar_t chase_stevie = {0, "chase_stevie", "0", "chase cam view from above (used only by GoodVsBad2)"};
 
 cvar_t v_deathtilt = {0, "v_deathtilt", "1", "whether to use sideways view when dead"};
+cvar_t v_deathtiltangle = {0, "v_deathtiltangle", "80", "what roll angle to use when tilting the view while dead"};
 
 float  v_dmg_time, v_dmg_roll, v_dmg_pitch;
 
@@ -255,9 +256,9 @@ void V_ParseDamage (void)
        }
 
        // calculate view angle kicks
-       if (cl_entities[cl.viewentity].state_current.active)
+       if (cl.entities[cl.viewentity].state_current.active)
        {
-               ent = &cl_entities[cl.viewentity];
+               ent = &cl.entities[cl.viewentity];
                Matrix4x4_Transform(&ent->render.inversematrix, from, localfrom);
                VectorNormalize(localfrom);
                v_dmg_pitch = count * localfrom[0] * v_kickpitch.value;
@@ -325,12 +326,12 @@ void V_CalcRefdef (void)
        if(csqc_loaded)
                return;
        VectorClear(gunorg);
-       Matrix4x4_CreateIdentity(&viewmodelmatrix);
-       Matrix4x4_CreateIdentity(&r_refdef.viewentitymatrix);
+       viewmodelmatrix = identitymatrix;
+       r_refdef.viewentitymatrix = identitymatrix;
        if (cls.state == ca_connected && cls.signon == SIGNONS)
        {
                // ent is the view entity (visible when out of body)
-               ent = &cl_entities[cl.viewentity];
+               ent = &cl.entities[cl.viewentity];
                if (cl.intermission)
                {
                        // entity is a fixed camera, just copy the matrix
@@ -405,7 +406,7 @@ void V_CalcRefdef (void)
                                chase_dest[0] = vieworg[0] + forward[0] * dist;
                                chase_dest[1] = vieworg[1] + forward[1] * dist;
                                chase_dest[2] = vieworg[2] + forward[2] * dist + camup;
-                               trace = CL_TraceBox(vieworg, vec3_origin, vec3_origin, chase_dest, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_SKY, false);
+                               trace = CL_TraceBox(vieworg, vec3_origin, vec3_origin, chase_dest, true, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | SUPERCONTENTS_SKY, false);
                                VectorMAMAM(1, trace.endpos, 8, forward, 4, trace.plane.normal, vieworg);
                        }
                        else
@@ -413,7 +414,7 @@ void V_CalcRefdef (void)
                                // first person view from entity
                                // angles
                                if (cl.stats[STAT_HEALTH] <= 0 && v_deathtilt.integer)
-                                       viewangles[ROLL] = 80;  // dead view angle
+                                       viewangles[ROLL] = v_deathtiltangle.value;
                                VectorAdd(viewangles, cl.punchangle, viewangles);
                                viewangles[ROLL] += V_CalcRoll(cl.viewangles, cl.movement_velocity);
                                if (v_dmg_time > 0)
@@ -429,7 +430,7 @@ void V_CalcRefdef (void)
                                {
                                        double xyspeed, bob;
 
-                                       xyspeed = sqrt(cl.velocity[0]*cl.velocity[0] + cl.velocity[1]*cl.velocity[1]);
+                                       xyspeed = sqrt(cl.movement_velocity[0]*cl.movement_velocity[0] + cl.movement_velocity[1]*cl.movement_velocity[1]);
                                        if (cl_bob.value && cl_bobcycle.value)
                                        {
                                                float cycle;
@@ -680,5 +681,6 @@ void V_Init (void)
                Cvar_RegisterVariable (&chase_stevie);
 
        Cvar_RegisterVariable (&v_deathtilt);
+       Cvar_RegisterVariable (&v_deathtiltangle);
 }