76 if (k ==
b->down[0] || k ==
b->down[1])
85 Con_Print(
"Three keys down for a button!\n");
104 b->down[0] =
b->down[1] = 0;
111 else if (
b->down[1] == k)
115 if (
b->down[0] ||
b->down[1])
211 Con_Printf(
"no slot left for weapon definition; increase IN_BESTWEAPON_MAX\n");
218 if(activeweaponcode != -1)
277 Con_Printf(
"bestweapon requires 1 or more parameters\n");
318 qbool impulsedown, impulseup, down;
320 impulsedown = (key->
state & 2) != 0;
321 impulseup = (key->
state & 4) != 0;
322 down = (key->
state & 1) != 0;
325 if (impulsedown && !impulseup)
332 if (impulseup && !impulsedown)
339 if (!impulsedown && !impulseup)
346 if (impulsedown && impulseup)
370cvar_t cl_movecliptokeyboard = {
CF_CLIENT,
"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"};
381cvar_t cl_movement_track_canjump = {
CF_CLIENT |
CF_ARCHIVE,
"cl_movement_track_canjump",
"1",
"track if the player released the jump key between two jumps to decide if he is able to jump or not; when off, this causes some \"sliding\" slightly above the floor when the jump key is held too long; if the mod allows repeated jumping by holding space all the time, this has to be set to zero too"};
391cvar_t cl_movement_airaccelerate = {
CF_CLIENT,
"cl_movement_airaccelerate",
"-1",
"how fast you accelerate while in the air (should match sv_airaccelerate), if less than 0 the cl_movement_accelerate variable is used instead"};
392cvar_t cl_movement_wateraccelerate = {
CF_CLIENT,
"cl_movement_wateraccelerate",
"-1",
"how fast you accelerate while in water (should match sv_wateraccelerate), if less than 0 the cl_movement_accelerate variable is used instead"};
394cvar_t cl_movement_airaccel_qw = {
CF_CLIENT,
"cl_movement_airaccel_qw",
"1",
"ratio of QW-style air control as opposed to simple acceleration (reduces speed gain when zigzagging) (should match sv_airaccel_qw); when < 0, the speed is clamped against the maximum allowed forward speed after the move"};
395cvar_t cl_movement_airaccel_sideways_friction = {
CF_CLIENT,
"cl_movement_airaccel_sideways_friction",
"0",
"anti-sideways movement stabilization (should match sv_airaccel_sideways_friction); when < 0, only so much friction is applied that braking (by accelerating backwards) cannot be stronger"};
396cvar_t cl_nopred = {
CF_CLIENT |
CF_ARCHIVE,
"cl_nopred",
"0",
"(QWSV only) disables player movement prediction when playing on QWSV servers (this setting is separate from cl_movement because player expectations are different when playing on DP vs QW servers)"};
402cvar_t m_accelerate = {
CF_CLIENT |
CF_ARCHIVE,
"m_accelerate",
"1",
"linear mouse acceleration factor (set to 1 to disable the linear acceleration and use only the power or natural acceleration; set to 0 to disable all acceleration)"};
415cvar_t cl_netrepeatinput = {
CF_CLIENT |
CF_ARCHIVE,
"cl_netrepeatinput",
"1",
"how many packets in a row can be lost without movement issues when using cl_movement (technically how many input messages to repeat in each packet that have not yet been acknowledged by the server), only affects DP7 and later servers (Quake uses 0, QuakeWorld uses 2, and just for comparison Quake3 uses 1)"};
486 static float old_mouse_x = 0, old_mouse_y = 0;
535 static int oldwindowmouse[2];
555 static float averagespeed = 0;
561 averagespeed = speed *
f + averagespeed * (1 -
f);
573 if(averagespeed <= mi)
577 else if(averagespeed >= ma)
598 float accelsens = 1.0f;
601 if (adjusted_speed_pxms > 0)
612 accelsens += inv_sensitivity;
635 float accelsens = 1.0f;
728 vec_t wishvel_x, wishvel_y;
731 if(wishvel_x != 0 && wishvel_y != 0 && wishvel_x != wishvel_y)
734 if(wishvel_x >= 2 * wishvel_y)
743 else if(wishvel_y >= 2 * wishvel_x)
841 { 0.000, 0.000, 0.000},
843 { 0.000, 0.000, 0.125}, { 0.000, 0.000, -0.125},
844 {-0.125, 0.000, 0.000}, { 0.125, 0.000, 0.000},
845 { 0.000, -0.125, 0.000}, { 0.000, 0.125, 0.000},
847 {-0.125, -0.125, 0.000}, { 0.125, -0.125, 0.000},
848 {-0.125, 0.125, 0.000}, { 0.125, 0.125, 0.000},
850 {-0.125, 0.000, 0.125}, { 0.125, 0.000, 0.125},
851 { 0.000, -0.125, 0.125}, { 0.000, 0.125, 0.125},
852 {-0.125, -0.125, 0.125}, { 0.125, -0.125, 0.125},
853 {-0.125, 0.125, 0.125}, { 0.125, 0.125, 0.125},
855 {-0.125, 0.000, -0.125}, { 0.125, 0.000, -0.125},
856 { 0.000, -0.125, -0.125}, { 0.000, 0.125, -0.125},
857 {-0.125, -0.125, -0.125}, { 0.125, -0.125, -0.125},
858 {-0.125, 0.125, -0.125}, { 0.125, 0.125, -0.125},
868 if (!
CL_TraceBox(neworigin,
cl.
playercrouchmins,
cl.
playercrouchmaxs, neworigin,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true).
startsolid)
900 trace =
CL_TraceBox(s->
origin,
cl.
playerstandmins,
cl.
playerstandmaxs, s->
origin,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true);
919 trace =
CL_TraceBox(origin1, s->
mins, s->
maxs, origin2,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true);
943 origin1[2] = s->
origin[2] + 22;
971 trace =
CL_TraceBox(s->
origin, s->
mins, s->
maxs, neworigin,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true);
978 trace2 =
CL_TraceBox(currentorigin2, s->
mins, s->
maxs, neworigin2,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true);
984 trace3 =
CL_TraceBox(currentorigin2, s->
mins, s->
maxs, neworigin2,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true);
1117 angle = (
ANGLEMOD(angle + 180) - 180) / 45;
1122 return 1 -
fabs(angle);
1146 vec_t zspeed, speed, dot, k;
1182 (accelqw < 0 ? -1 : +1)
1184 bound(0.000001, 1 - (1 -
fabs(accelqw)) * factor, 1);
1194 vec_t vel_xy_current;
1195 vec_t vel_xy_backward, vel_xy_forward;
1198 if(stretchfactor > 0)
1199 speedclamp = stretchfactor;
1200 else if(accelqw < 0)
1221 vel_xy_forward = vel_xy_current +
bound(0,
wishspeed - vel_xy_current, step) * accelqw + step * (1 - accelqw);
1222 vel_xy_backward = vel_xy_current -
bound(0,
wishspeed + vel_xy_current, step) * accelqw - step * (1 - accelqw);
1223 if(vel_xy_backward < 0)
1224 vel_xy_backward = 0;
1226 vel_straight = vel_straight +
bound(0,
wishspeed - vel_straight, step) * accelqw + step * (1 - accelqw);
1233 fmin = (vel_xy_backward*vel_xy_backward - vel_straight*vel_straight) /
VectorLength2(vel_perpend);
1254 vec_t vel_xy_preclamp;
1256 if(vel_xy_preclamp > 0)
1258 vel_xy_current += (vel_xy_forward - vel_xy_current) * speedclamp;
1259 if(vel_xy_current < vel_xy_preclamp)
1269 vec3_t curvel, wishvel, acceldir, curdir;
1270 float addspeed, accelspeed, curspeed;
1304 if( accelspeed > addspeed )
1305 accelspeed = addspeed;
1307 if( backtosideratio < 1.0f )
1312 VectorMA( acceldir, -( 1.0f - backtosideratio ) * dot, curdir, acceldir );
1382 VectorSet(neworigin3, neworigin2[0], neworigin2[1], neworigin2[2] - 34);
1384 trace =
CL_TraceBox(neworigin2, s->
mins, s->
maxs, neworigin3,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true);
1386 trace =
CL_TraceLine(neworigin2, neworigin3,
MOVE_NORMAL, s->
self,
SUPERCONTENTS_SOLID |
SUPERCONTENTS_BODY |
SUPERCONTENTS_PLAYERCLIP, 0, 0,
collision_extendmovelength.
value,
true,
true,
NULL,
true,
false);
1392 speed =
max(speed, 0);
1424 vec_t accel, wishspeed0, wishspeed2, accelqw, strafity;
1610 double totalmovemsec;
1622 memset(&s, 0,
sizeof(s));
1646 for (
i--;
i >= 0;
i--)
1773 int i, j, packetloss;
1779 unsigned char data[1024];
1780 float packettime, lag;
1781 qbool opportune_moment;
1930 opportune_moment =
false;
1934 opportune_moment = lag < 0.999f * (
float)
cl.
realframetime * (frames_per_tic <= 1 ? 1 : sqrtf(frames_per_tic));
1955 if (opportune_moment)
1987 checksumindex =
buf.cursize;
2026 for (
i = 0;
i < 3;
i++)
2031 for (
i = 0;
i < 3;
i++)
2048 for (
i = 0;
i < 3;
i++)
2065 for (
i = 0;
i < 3;
i++)
2088 for (j = 0,
cmd = &
cl.
movecmd[maxusercmds-1];j < maxusercmds;j++,
cmd--)
2099 for (
i = 0;
i < 3;
i++)
2135 if (oldsequence > delta)
2136 oldsequence = oldsequence - delta;
#define SUPERCONTENTS_BODY
#define SUPERCONTENTS_LAVA
#define SUPERCONTENTS_SLIME
#define SUPERCONTENTS_SOLID
#define SUPERCONTENTS_LIQUIDSMASK
#define SUPERCONTENTS_PLAYERCLIP
trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitnetworkbrushmodels, qbool hitnetworkplayers, int *hitnetworkentity, qbool hitcsqcentities, qbool hitsurfaces)
trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, float extend, qbool hitnetworkbrushmodels, qbool hitnetworkplayers, int *hitnetworkentity, qbool hitcsqcentities)
trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int hitsupercontentsmask, int skipsupercontentsmask, int skipmaterialflagsmask, qbool hitnetworkbrushmodels, qbool hitnetworkplayers, int *hitnetworkentity, qbool hitcsqcentities)
float CL_SelectTraceLine(const vec3_t start, const vec3_t end, vec3_t impact, vec3_t normal, int *hitent, entity_render_t *ignoreent)
void CL_DisconnectEx(qbool kicked, const char *fmt,...)
cvar_t cl_prydoncursor_notrace
cvar_t developer_networkentities
#define CL_MAX_DOWNLOADACKS
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
static int Cmd_Argc(cmd_state_t *cmd)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
cvar_t collision_extendmovelength
unsigned char COM_BlockSequenceCRCByteQW(unsigned char *base, int length, int sequence)
#define IS_NEXUIZ_DERIVED(g)
void MSG_WriteShort(sizebuf_t *sb, int c)
void MSG_WriteAngle16i(sizebuf_t *sb, float f)
void MSG_WriteLong(sizebuf_t *sb, int c)
void MSG_WriteByte(sizebuf_t *sb, int c)
void MSG_WriteFloat(sizebuf_t *sb, float f)
void MSG_WriteAngle32f(sizebuf_t *sb, float f)
void MSG_WriteAngle8i(sizebuf_t *sb, float f)
void MSG_WriteCoord16i(sizebuf_t *sb, float f)
@ PROTOCOL_DARKPLACES2
various changes
@ PROTOCOL_DARKPLACES4
various changes
@ PROTOCOL_NEHAHRABJP2
same as NEHAHRABJP but with 16bit soundindex
@ PROTOCOL_DARKPLACES3
uses EntityFrame4 entity snapshot encoder/decoder which is broken, this attempted to do partial snaps...
@ PROTOCOL_NEHAHRABJP
same as QUAKEDP but with 16bit modelindex
@ PROTOCOL_DARKPLACES5
uses EntityFrame5 entity snapshot encoder/decoder which is based on a Tribes networking article at ht...
@ PROTOCOL_DARKPLACES7
added QuakeWorld-style movement protocol to allow more consistent prediction
@ PROTOCOL_QUAKEDP
darkplaces extended quake protocol (used by TomazQuake and others), backwards compatible as long as n...
@ PROTOCOL_DARKPLACES6
various changes
@ PROTOCOL_QUAKE
quake (aka netquake/normalquake/nq) protocol
@ PROTOCOL_DARKPLACES8
added parting messages. WIP
@ PROTOCOL_NEHAHRABJP3
same as NEHAHRABJP2 but with some changes
@ PROTOCOL_NEHAHRAMOVIE
Nehahra movie protocol, a big nasty hack dating back to early days of the Quake Standards Group (but ...
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
@ PROTOCOL_DARKPLACES1
uses EntityFrame entity snapshot encoder/decoder which is a QuakeWorld-like entity snapshot delta com...
#define dp_strlcpy(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
qbool CL_VM_InputEvent(int eventtype, float x, float y)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
GLsizeiptr const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
void AnglesFromVectors(vec3_t angles, const vec3_t forward, const vec3_t up, qbool flippitch)
LadyHavoc: calculates pitch/yaw/roll angles from forward and up vectors.
float VectorNormalizeLength(vec3_t v)
returns vector length
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
#define VectorNormalize(v)
#define bound(min, num, max)
#define VectorMAMAM(scale1, b1, scale2, b2, scale3, b3, out)
#define VectorSet(vec, x, y, z)
#define VectorNormalize2(v, dest)
#define VectorSubtract(a, b, out)
#define VectorCopy(in, out)
#define VectorScale(in, scale, out)
#define VectorMAM(scale1, b1, scale2, b2, out)
#define VectorAdd(a, b, out)
#define VectorMA(a, scale, b, out)
void Matrix4x4_Transform(const matrix4x4_t *in, const float v[3], float out[3])
void Matrix4x4_OriginFromMatrix(const matrix4x4_t *in, float *out)
qbool NetConn_CanSend(netconn_t *conn)
int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data, protocolversion_t protocol, int rate, int burstsize, qbool quakesignon_suppressreliables)
#define NETGRAPH_LOSTPACKET
#define clc_ackdownloaddata
#define CL_MAX_USERCMDS
max number of predicted input packets in queue
#define STAT_MOVEVARS_WARSOWBUNNY_ACCEL
DP.
#define STAT_MOVEFLAGS
DP.
#define STAT_MOVEVARS_MAXAIRSPEED
DP.
#define STAT_MOVEVARS_AIRACCELERATE
DP.
#define STAT_MOVEVARS_WATERACCELERATE
DP.
#define STAT_MOVEVARS_AIRACCEL_QW
DP.
#define STAT_MOVEVARS_AIRSTOPACCELERATE
DP.
#define STAT_MOVEVARS_TIMESCALE
DP.
#define STAT_MOVEVARS_AIRSTRAFEACCEL_QW
DP.
#define STAT_MOVEVARS_AIRCONTROL
DP.
#define STAT_MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO
DP.
#define STAT_MOVEVARS_GRAVITY
DP.
#define STAT_MOVEVARS_AIRSTRAFEACCELERATE
DP.
#define STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR
DP.
#define STAT_MOVEVARS_TICRATE
DP.
#define STAT_MOVEVARS_SPECTATORMAXSPEED
DP.
#define STAT_MOVEVARS_MAXSPEED
DP.
#define STAT_MOVEVARS_WALLFRICTION
DP.
#define STAT_MOVEVARS_STEPHEIGHT
DP.
#define STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW
DP.
#define STAT_MOVEVARS_AIRCONTROL_PENALTY
DP.
#define STAT_MOVEVARS_AIRACCEL_SIDEWAYS_FRICTION
DP.
#define STAT_MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL
DP.
#define STAT_MOVEVARS_MAXAIRSTRAFESPEED
DP.
#define STAT_MOVEVARS_STOPSPEED
DP.
#define STAT_MOVEVARS_ACCELERATE
DP.
#define STAT_MOVEVARS_ENTGRAVITY
DP.
#define STAT_MOVEVARS_WATERFRICTION
DP.
#define STAT_MOVEVARS_EDGEFRICTION
DP.
#define STAT_MOVEVARS_AIRCONTROL_POWER
DP.
#define STAT_ITEMS
FTE, DP.
#define STAT_MOVEVARS_WARSOWBUNNY_TURNACCEL
DP.
#define STAT_MOVEVARS_JUMPVELOCITY
DP.
#define STAT_MOVEVARS_WARSOWBUNNY_TOPSPEED
DP.
#define STAT_MOVEVARS_FRICTION
DP.
#define MOVEFLAG_Q2AIRACCELERATE
#define IT_GRENADE_LAUNCHER
#define IT_ROCKET_LAUNCHER
#define MOVEFLAG_NOGRAVITYONGROUND
#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE
struct prvm_edict_s * self
float movevars_warsowbunny_airforwardaccel
float movevars_maxairstrafespeed
float movevars_entgravity
float movevars_waterfriction
float movevars_jumpvelocity
unsigned int latestsendnums[LATESTFRAMENUMS]
float movevars_warsowbunny_accel
float movevars_spectatormaxspeed
float last_received_message
float movevars_aircontrol
float movevars_airaccel_qw_stretchfactor
uint8_t opt_inputs_since_update
float movevars_airaccel_qw
float movevars_warsowbunny_topspeed
int latestframenumsposition
float movevars_airspeedlimit_nonqw
float movevars_airstrafeaccelerate
float movevars_maxairspeed
qbool csqc_wantsmousemove
float movevars_warsowbunny_turnaccel
float movevars_accelerate
float movevars_aircontrol_power
float movevars_airaccel_sideways_friction
float movevars_edgefriction
float movevars_warsowbunny_backtosideratio
usercmd_t movecmd[CL_MAX_USERCMDS]
int latestframenums[LATESTFRAMENUMS]
float movevars_aircontrol_penalty
float movevars_airaccelerate
float movevars_stepheight
unsigned int qw_validsequence
unsigned int qw_deltasequence[QW_UPDATE_BACKUP]
float movevars_wateraccelerate
float movevars_airstrafeaccel_qw
float movevars_airstopaccelerate
float movevars_wallfriction
unsigned int servermovesequence
cl_downloadack_t dp_downloadack[CL_MAX_DOWNLOADACKS]
protocolversion_t protocol
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
entity_state_t state_current
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
netgraphitem_t incoming_netgraph[NETGRAPH_PACKETS]
unsigned int outgoing_unreliable_sequence
used by both NQ and QW protocols
sizebuf_t message
writing buffer to send to peer as the next reliable message can be added to at any time,...
qbool overflowed
set to true if the buffer size failed
viddef_mode_t mode
currently active video mode
viddef_t vid
global video state
void V_StartPitchDrift_f(cmd_state_t *cmd)
void V_StopPitchDrift(void)