]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - view.c
some work on SV_TestEntityPosition and entity unsticking, now only checks against...
[xonotic/darkplaces.git] / view.c
diff --git a/view.c b/view.c
index dacbe7e360bb6fdd65fb94c4591be596d1a76a79..28fe76408f0e0918211441987c58751f38e7c3a5 100644 (file)
--- a/view.c
+++ b/view.c
@@ -221,7 +221,7 @@ void V_ParseDamage (void)
 
        armor = MSG_ReadByte ();
        blood = MSG_ReadByte ();
-       MSG_ReadVector(from, cl.protocol);
+       MSG_ReadVector(from, cls.protocol);
 
        count = blood*0.5 + armor*0.5;
        if (count < 10)
@@ -325,8 +325,8 @@ 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)
@@ -334,10 +334,14 @@ void V_CalcRefdef (void)
                if (cl.intermission)
                {
                        // entity is a fixed camera, just copy the matrix
-                       Matrix4x4_Copy(&r_refdef.viewentitymatrix, &ent->render.matrix);
-                       Matrix4x4_Copy(&viewmodelmatrix, &ent->render.matrix);
-                       r_refdef.viewentitymatrix.m[2][3] += cl.stats[STAT_VIEWHEIGHT];
-                       viewmodelmatrix.m[2][3] += cl.stats[STAT_VIEWHEIGHT];
+                       if (cls.protocol == PROTOCOL_QUAKEWORLD)
+                               Matrix4x4_CreateFromQuakeEntity(&r_refdef.viewentitymatrix, cl.qw_intermission_origin[0], cl.qw_intermission_origin[1], cl.qw_intermission_origin[2], cl.qw_intermission_angles[0], cl.qw_intermission_angles[1], cl.qw_intermission_angles[2], 1);
+                       else
+                       {
+                               r_refdef.viewentitymatrix = ent->render.matrix;
+                               r_refdef.viewentitymatrix.m[2][3] += cl.stats[STAT_VIEWHEIGHT];
+                       }
+                       viewmodelmatrix = r_refdef.viewentitymatrix;
                }
                else
                {
@@ -346,6 +350,10 @@ void V_CalcRefdef (void)
                        Matrix4x4_OriginFromMatrix(&ent->render.matrix, vieworg);
                        VectorCopy(cl.viewangles, viewangles);
 
+                       // apply qw weapon recoil effect (this did not work in QW)
+                       // TODO: add a cvar to disable this
+                       viewangles[PITCH] += cl.qw_weaponkick;
+
                        if (cl.onground)
                        {
                                if (!cl.oldonground)