Add legit autostrafe
This commit is contained in:
parent
2141daae27
commit
1affa52bc8
|
@ -6,6 +6,17 @@
|
||||||
#include "../include/globals.h"
|
#include "../include/globals.h"
|
||||||
#include "../include/cvars.h"
|
#include "../include/cvars.h"
|
||||||
|
|
||||||
|
static void autostrafe_legit(usercmd_t* cmd) {
|
||||||
|
/* Get mouse delta */
|
||||||
|
int dx = 0, dy = 0;
|
||||||
|
i_engine->pfnVguiWrap2_GetMouseDelta(&dx, &dy);
|
||||||
|
|
||||||
|
if (dx < 0)
|
||||||
|
cmd->sidemove = -450.0f;
|
||||||
|
else if (dx > 0)
|
||||||
|
cmd->sidemove = 450.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void bhop(usercmd_t* cmd) {
|
void bhop(usercmd_t* cmd) {
|
||||||
if (!CVAR_ON(bhop) || i_pmove->movetype != MOVETYPE_WALK)
|
if (!CVAR_ON(bhop) || i_pmove->movetype != MOVETYPE_WALK)
|
||||||
return;
|
return;
|
||||||
|
@ -17,4 +28,16 @@ void bhop(usercmd_t* cmd) {
|
||||||
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. */
|
||||||
|
if (was_in_air) {
|
||||||
|
switch ((int)cv_autostrafe->value) {
|
||||||
|
case 1:
|
||||||
|
autostrafe_legit(cmd);
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue