2023-07-20 23:20:39 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "include/movement.h"
|
|
|
|
#include "../include/sdk.h"
|
|
|
|
#include "../include/globals.h"
|
2023-07-21 13:45:21 +02:00
|
|
|
#include "../include/cvars.h"
|
2023-07-20 23:20:39 +02:00
|
|
|
|
|
|
|
void bhop(usercmd_t* cmd) {
|
2023-07-21 13:45:21 +02:00
|
|
|
if (!CVAR_ON(bhop) || i_pmove->movetype != MOVETYPE_WALK)
|
2023-07-20 23:20:39 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
static bool was_in_air = false;
|
|
|
|
|
2023-07-21 13:16:38 +02:00
|
|
|
/* 2 frames in air, release jump */
|
2023-07-20 23:20:39 +02:00
|
|
|
if (was_in_air && !(i_pmove->flags & FL_ONGROUND))
|
|
|
|
cmd->buttons &= ~IN_JUMP;
|
|
|
|
|
|
|
|
was_in_air = (i_pmove->flags & FL_ONGROUND) == 0;
|
|
|
|
}
|