// if we couldn't find any of the weapons, there's nothing more we can do...
}
+#if 0
void IN_CycleWeapon (void)
{
int i, n;
}
// if we couldn't find any of the weapons, there's nothing more we can do...
}
+#endif
/*
===============
cvar_t cl_sidespeed = {CVAR_SAVE, "cl_sidespeed","350","strafe movement speed"};
cvar_t cl_movespeedkey = {CVAR_SAVE, "cl_movespeedkey","2.0","how much +speed multiplies keyboard movement speed"};
+cvar_t cl_movecliptokeyboard = {0, "cl_movecliptokeyboard", "0", "if set to 1, any move is clipped to the nine keyboard states; if set to 2, only the direction is clipped, not the amount"};
cvar_t cl_yawspeed = {CVAR_SAVE, "cl_yawspeed","140","keyboard yaw turning speed"};
cvar_t cl_pitchspeed = {CVAR_SAVE, "cl_pitchspeed","150","keyboard pitch turning speed"};
// clamp after the move to prevent rendering with bad angles
CL_AdjustAngles ();
+
+ if(cl_movecliptokeyboard.integer)
+ {
+ vec_t f = 1;
+ if (in_speed.state & 1)
+ f *= cl_movespeedkey.value;
+ if(cl_movecliptokeyboard.integer == 2)
+ {
+ // digital direction, analog amount
+ vec_t wishvel_x, wishvel_y;
+ f *= max(cl_sidespeed.value, max(cl_forwardspeed.value, cl_backspeed.value));
+ wishvel_x = fabs(cl.cmd.forwardmove);
+ wishvel_y = fabs(cl.cmd.sidemove);
+ if(wishvel_x != 0 && wishvel_y != 0 && wishvel_x != wishvel_y)
+ {
+ vec_t wishspeed = sqrt(wishvel_x * wishvel_x + wishvel_y * wishvel_y);
+ if(wishvel_x >= 2 * wishvel_y)
+ {
+ // pure X motion
+ if(cl.cmd.forwardmove > 0)
+ cl.cmd.forwardmove = wishspeed;
+ else
+ cl.cmd.forwardmove = -wishspeed;
+ cl.cmd.sidemove = 0;
+ }
+ else if(wishvel_y >= 2 * wishvel_x)
+ {
+ // pure Y motion
+ cl.cmd.forwardmove = 0;
+ if(cl.cmd.sidemove > 0)
+ cl.cmd.sidemove = wishspeed;
+ else
+ cl.cmd.sidemove = -wishspeed;
+ }
+ else
+ {
+ // diagonal
+ if(cl.cmd.forwardmove > 0)
+ cl.cmd.forwardmove = 0.70710678118654752440 * wishspeed;
+ else
+ cl.cmd.forwardmove = -0.70710678118654752440 * wishspeed;
+ if(cl.cmd.sidemove > 0)
+ cl.cmd.sidemove = 0.70710678118654752440 * wishspeed;
+ else
+ cl.cmd.sidemove = -0.70710678118654752440 * wishspeed;
+ }
+ }
+ }
+ else if(cl_movecliptokeyboard.integer)
+ {
+ // digital direction, digital amount
+ if(cl.cmd.sidemove >= cl_sidespeed.value * f * 0.5)
+ cl.cmd.sidemove = cl_sidespeed.value * f;
+ else if(cl.cmd.sidemove <= -cl_sidespeed.value * f * 0.5)
+ cl.cmd.sidemove = -cl_sidespeed.value * f;
+ else
+ cl.cmd.sidemove = 0;
+ if(cl.cmd.forwardmove >= cl_forwardspeed.value * f * 0.5)
+ cl.cmd.forwardmove = cl_forwardspeed.value * f;
+ else if(cl.cmd.forwardmove <= -cl_backspeed.value * f * 0.5)
+ cl.cmd.forwardmove = -cl_backspeed.value * f;
+ else
+ cl.cmd.forwardmove = 0;
+ }
+ }
}
#include "cl_collision.h"
vec_t vel_straight, vel_z;
vec3_t vel_perpend;
vec_t addspeed;
+ vec_t savespeed;
+
+ savespeed = VectorLength2(s->velocity);
vel_straight = DotProduct(s->velocity, wishdir);
vel_z = s->velocity[2];
if(wishspeed > 0)
vel_straight = vel_straight + min(wishspeed, accel * s->cmd.frametime * wishspeed) * (1 - accelqw);
- VectorScale(vel_perpend, 1 - s->cmd.frametime * wishspeed * sidefric, vel_perpend);
+ if(sidefric < 0 && VectorLength2(vel_perpend))
+ {
+ vec_t f, fmin;
+ f = 1 + s->cmd.frametime * wishspeed * sidefric;
+ fmin = (savespeed - vel_straight*vel_straight) / VectorLength2(vel_perpend);
+ if(fmin <= 0)
+ VectorScale(vel_perpend, f, vel_perpend);
+ else
+ VectorScale(vel_perpend, min(1.0f, max(fmin, f)), vel_perpend);
+ }
+ else
+ VectorScale(vel_perpend, 1 - s->cmd.frametime * wishspeed * sidefric, vel_perpend);
VectorMA(vel_perpend, vel_straight, wishdir, s->velocity);
s->velocity[2] += vel_z;
}
else if (cl.stats[STAT_MOVEVARS_TICRATE])
{
+ cl.movevars_ticrate = cl.statsf[STAT_MOVEVARS_TICRATE];
cl.movevars_timescale = cl.statsf[STAT_MOVEVARS_TIMESCALE];
cl.movevars_gravity = cl.statsf[STAT_MOVEVARS_GRAVITY];
cl.movevars_stopspeed = cl.statsf[STAT_MOVEVARS_STOPSPEED] ;
}
else
{
+ cl.movevars_ticrate = slowmo.value / bound(1.0f, cl_netfps.value, 1000.0f);
cl.movevars_timescale = slowmo.value;
cl.movevars_gravity = sv_gravity.value;
cl.movevars_stopspeed = cl_movement_stopspeed.value;
// don't send too often or else network connections can get clogged by a
// high renderer framerate
packettime = 1.0 / bound(1, cl_netfps.value, 1000);
+ if (cl.movevars_timescale && cl.movevars_ticrate)
+ {
+ float maxtic = cl.movevars_ticrate / cl.movevars_timescale;
+ packettime = min(packettime, maxtic);
+ }
// send input every frame in singleplayer
if (cl.islocalgame)
packettime = 0;
+
+ // do not send if we do not have anything useful to send
+ if(msecdelta <= 0 && cls.signon == SIGNONS && !cl.paused)
+ return;
// always send if buttons changed or an impulse is pending
// even if it violates the rate limit!
if (!cl.movecmd[0].impulse && (!cl_netimmediatebuttons.integer || cl.movecmd[0].buttons == cl.movecmd[1].buttons))
case PROTOCOL_DARKPLACES6:
case PROTOCOL_DARKPLACES7:
// set the maxusercmds variable to limit how many should be sent
- maxusercmds = bound(1, cl_netrepeatinput.integer + 1, CL_MAX_USERCMDS);
+ maxusercmds = bound(1, cl_netrepeatinput.integer + 1, min(3, CL_MAX_USERCMDS));
// when movement prediction is off, there's not much point in repeating old input as it will just be ignored
if (!cl.cmd.predicted)
maxusercmds = 1;
// LordHavoc: added bestweapon command
Cmd_AddCommand ("bestweapon", IN_BestWeapon, "send an impulse number to server to select the first usable weapon out of several (example: 8 7 6 5 4 3 2 1)");
+#if 0
Cmd_AddCommand ("cycleweapon", IN_CycleWeapon, "send an impulse number to server to select the next usable weapon out of several (example: 9 4 8) if you are holding one of these, and choose the first one if you are holding none of these");
+#endif
Cmd_AddCommand ("register_bestweapon", IN_BestWeapon_Register_f, "(for QC usage only) change weapon parameters to be used by bestweapon; stuffcmd this in ClientConnect");
+ Cvar_RegisterVariable(&cl_movecliptokeyboard);
Cvar_RegisterVariable(&cl_movement);
Cvar_RegisterVariable(&cl_movement_minping);
Cvar_RegisterVariable(&cl_movement_track_canjump);