Only autostrafe if holding space

This commit is contained in:
8dcc 2023-07-24 10:29:34 +02:00
parent c131e5251d
commit 913e1c9a69
1 changed files with 6 additions and 2 deletions

View File

@ -70,14 +70,18 @@ void bhop(usercmd_t* cmd) {
static bool was_in_air = false; static bool was_in_air = false;
/* Used bellow to check if we should autostrafe before. Store since we might
* change cmd->buttons (autostrafe only when user hold space) */
bool is_jumping = cmd->buttons & IN_JUMP;
/* 2 frames in air, release jump */ /* 2 frames in air, release jump */
if (was_in_air && !(i_pmove->flags & FL_ONGROUND)) if (was_in_air && !(i_pmove->flags & FL_ONGROUND))
cmd->buttons &= ~IN_JUMP; cmd->buttons &= ~IN_JUMP;
was_in_air = (i_pmove->flags & FL_ONGROUND) == 0; was_in_air = (i_pmove->flags & FL_ONGROUND) == 0;
/* Autostrafe if enabled. Check if we are in the air. */ /* Autostrafe if enabled. Check if we are in the air and holding space. */
if (was_in_air) { if (is_jumping && was_in_air) {
switch ((int)cv_autostrafe->value) { switch ((int)cv_autostrafe->value) {
case 1: case 1:
autostrafe_rage(cmd); autostrafe_rage(cmd);