if( g_cl.m_pressing_move && g_cfg[ XOR( "misc_wasd_strafe" ) ].get<bool>( ) ) {
// took this idea from stacker, thank u !!!!
enum EDirections {
FORWARDS = 0,
BACKWARDS = 180,
LEFT = 90,
RIGHT = -90,
BACK_LEFT = 135,
BACK_RIGHT = -135
};
float wish_dir{ };
// get our key presses.
bool holding_w = g_cl.m_buttons & IN_FORWARD;
bool holding_a = g_cl.m_buttons & IN_MOVELEFT;
bool holding_s = g_cl.m_buttons & IN_BACK;
bool holding_d = g_cl.m_buttons & IN_MOVERIGHT;
// move in the appropriate direction.
if( holding_w ) {
// forward left
if( holding_a ) {
wish_dir += ( EDirections::LEFT / 2 );
}
// forward right
else if( holding_d ) {
wish_dir += ( EDirections::RIGHT / 2 );
}
// forward
else {
wish_dir += EDirections::FORWARDS;
}
}
else if( holding_s ) {
// back left
if( holding_a ) {
wish_dir += EDirections::BACK_LEFT;
}
// back right
else if( holding_d ) {
wish_dir += EDirections::BACK_RIGHT;
}
// back
else {
wish_dir += EDirections::BACKWARDS;
}
g_cl.m_cmd->m_forward_move = 0;
}
else if( holding_a ) {
// left
wish_dir += EDirections::LEFT;
}
else if( holding_d ) {
// right
wish_dir += EDirections::RIGHT;
}
g_cl.m_strafe_angles.y += math::NormalizeYaw(wish_dir);
}