]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_input.c
added viewzoom extension to QC and client (smooth sniper zooming, with sensitivity...
[xonotic/darkplaces.git] / cl_input.c
index 18ba2fc11d158c52cb4eeae235a7eb5e68fea7c0..0943007dc259b27e23fee07af3b6490e01481f8d 100644 (file)
@@ -70,7 +70,7 @@ void KeyDown (kbutton_t *b)
 
        if (k == b->down[0] || k == b->down[1])
                return;         // repeating key
-       
+
        if (!b->down[0])
                b->down[0] = k;
        else if (!b->down[1])
@@ -227,17 +227,17 @@ float CL_KeyState (kbutton_t *key)
 
 //==========================================================================
 
-cvar_t cl_upspeed = {"cl_upspeed","200"};
-cvar_t cl_forwardspeed = {"cl_forwardspeed","200", true};
-cvar_t cl_backspeed = {"cl_backspeed","200", true};
-cvar_t cl_sidespeed = {"cl_sidespeed","350"};
+cvar_t cl_upspeed = {CVAR_SAVE, "cl_upspeed","400"};
+cvar_t cl_forwardspeed = {CVAR_SAVE, "cl_forwardspeed","400"};
+cvar_t cl_backspeed = {CVAR_SAVE, "cl_backspeed","400"};
+cvar_t cl_sidespeed = {CVAR_SAVE, "cl_sidespeed","350"};
 
-cvar_t cl_movespeedkey = {"cl_movespeedkey","2.0"};
+cvar_t cl_movespeedkey = {CVAR_SAVE, "cl_movespeedkey","2.0"};
 
-cvar_t cl_yawspeed = {"cl_yawspeed","140"};
-cvar_t cl_pitchspeed = {"cl_pitchspeed","150"};
+cvar_t cl_yawspeed = {CVAR_SAVE, "cl_yawspeed","140"};
+cvar_t cl_pitchspeed = {CVAR_SAVE, "cl_pitchspeed","150"};
 
-cvar_t cl_anglespeedkey = {"cl_anglespeedkey","1.5"};
+cvar_t cl_anglespeedkey = {CVAR_SAVE, "cl_anglespeedkey","1.5"};
 
 
 /*
@@ -251,7 +251,7 @@ void CL_AdjustAngles (void)
 {
        float   speed;
        float   up, down;
-       
+
        if (in_speed.state & 1)
                speed = cl.frametime * cl_anglespeedkey.value;
        else
@@ -269,10 +269,10 @@ void CL_AdjustAngles (void)
                cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * CL_KeyState (&in_forward);
                cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
        }
-       
+
        up = CL_KeyState (&in_lookup);
        down = CL_KeyState(&in_lookdown);
-       
+
        cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
        cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
 
@@ -372,7 +372,7 @@ void CL_SendMove (usercmd_t *cmd)
        buf.maxsize = 128;
        buf.cursize = 0;
        buf.data = data;
-       
+
        cl.cmd = *cmd;
 
 //
@@ -382,7 +382,12 @@ void CL_SendMove (usercmd_t *cmd)
 
        MSG_WriteFloat (&buf, cl.mtime[0]);     // so server can get ping times
 
-       if (dpprotocol)
+       if (dpprotocol == DPPROTOCOL_VERSION2)
+       {
+               for (i = 0;i < 3;i++)
+                       MSG_WriteFloat (&buf, cl.viewangles[i]);
+       }
+       else if (dpprotocol == DPPROTOCOL_VERSION1)
        {
                for (i=0 ; i<3 ; i++)
                        MSG_WritePreciseAngle (&buf, cl.viewangles[i]);
@@ -392,7 +397,7 @@ void CL_SendMove (usercmd_t *cmd)
                for (i=0 ; i<3 ; i++)
                        MSG_WriteAngle (&buf, cl.viewangles[i]);
        }
-       
+
     MSG_WriteShort (&buf, forwardmove);
     MSG_WriteShort (&buf, sidemove);
     MSG_WriteShort (&buf, upmove);
@@ -402,11 +407,11 @@ void CL_SendMove (usercmd_t *cmd)
 // send button bits
 //
        bits = 0;
-       
+
        if ( in_attack.state & 3 )
                bits |= 1;
        in_attack.state &= ~2;
-       
+
        if (in_jump.state & 3)
                bits |= 2;
        in_jump.state &= ~2;
@@ -417,12 +422,20 @@ void CL_SendMove (usercmd_t *cmd)
        if (in_button6.state & 3) bits |=  32;in_button6.state &= ~2;
        if (in_button7.state & 3) bits |=  64;in_button7.state &= ~2;
        if (in_button8.state & 3) bits |= 128;in_button8.state &= ~2;
-       
+
     MSG_WriteByte (&buf, bits);
 
     MSG_WriteByte (&buf, in_impulse);
        in_impulse = 0;
 
+       // LordHavoc: should we ack this on receipt instead?  would waste net bandwidth though
+       i = EntityFrame_MostRecentlyRecievedFrameNum(&cl.entitydatabase);
+       if (i > 0)
+       {
+               MSG_WriteByte (&buf, clc_ackentities);
+               MSG_WriteLong (&buf, i);
+       }
+
 //
 // deliver the message
 //