Skip to content

client: input: fix cl_movespeedkey handling - #399

Merged
Velaron merged 1 commit into
Velaron:mainfrom
Vladislav4KZ:movespeedkey-fix
Aug 21, 2026
Merged

client: input: fix cl_movespeedkey handling#399
Velaron merged 1 commit into
Velaron:mainfrom
Vladislav4KZ:movespeedkey-fix

Conversation

@Vladislav4KZ

Copy link
Copy Markdown
Contributor

Fixes: #109

Match the original CS 1.6 client behavior by moving IN_Move before the maxspeed clamp, applying cl_movespeedkey after the clamp, and capping the multiplier at 0.52.

Remove the additional cl_movespeedkey multiplication from IN_Move to avoid applying the multiplier twice.

Pseudocode from the original Steam version of CS 1.6, decompiled from client.so using IDA Pro

IN_Move(frametime, cmd);
v48 = gEngfuncs.GetClientMaxspeed();
if ( v48 != 0.0 )
{
  v64 = sqrt(cmd->forwardmove * cmd->forwardmove + cmd->sidemove * cmd->sidemove + cmd->upmove * cmd->upmove);
  if ( v64 > v48 )
  {
	v65 = v48 / v64;
	cmd->forwardmove = cmd->forwardmove * v65;
	cmd->sidemove = cmd->sidemove * v65;
	cmd->upmove = v65 * cmd->upmove;
  }
}
if ( (in_speed.state & 1) != 0 )
{
  v49 = cl_movespeedkey->value;
  if ( v49 > 0.51999998 )
	v49 = 0.51999998;
  cmd->forwardmove = cmd->forwardmove * v49;
  cmd->sidemove = cmd->sidemove * v49;
  cmd->upmove = v49 * cmd->upmove;
}

Match the original CS 1.6 client behavior by moving IN_Move before the
maxspeed clamp, applying cl_movespeedkey after the clamp, and capping
the multiplier at 0.52.

Remove the additional cl_movespeedkey multiplication from IN_Move to
avoid applying the multiplier twice.
@Velaron
Velaron merged commit 63f346f into Velaron:main Aug 21, 2026
9 checks passed
@Vladislav4KZ
Vladislav4KZ deleted the movespeedkey-fix branch August 21, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Кнопка +speed ходьба

2 participants