Made saber block debounce configurable

This commit is contained in:
Simon 2022-11-12 17:05:39 +00:00
parent 18140d2340
commit a1b76ee5cb
7 changed files with 30 additions and 10 deletions

View file

@ -1324,6 +1324,7 @@ void JKVR_Init()
vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE);
vr_force_motion_controlled = Cvar_Get ("vr_force_motion_controlled", "1", CVAR_ARCHIVE);
vr_crouch_toggle = Cvar_Get ("vr_crouch_toggle", "0", CVAR_ARCHIVE);
vr_saber_block_debounce_time = Cvar_Get ("vr_saber_block_debounce_time", "200", CVAR_ARCHIVE);
cvar_t *expanded_menu_enabled = Cvar_Get ("expanded_menu_enabled", "0", CVAR_ARCHIVE);
if (FS_FileExists("expanded_menu.pk3")) {

View file

@ -14,4 +14,5 @@ extern cvar_t *vr_force_velocity_trigger;
extern cvar_t *vr_two_handed_weapons;
extern cvar_t *vr_force_motion_controlled;
extern cvar_t *vr_crouch_toggle;
extern cvar_t *vr_saber_block_debounce_time;

View file

@ -34,6 +34,7 @@ cvar_t *vr_force_velocity_trigger;
cvar_t *vr_two_handed_weapons;
cvar_t *vr_force_motion_controlled;
cvar_t *vr_crouch_toggle;
cvar_t *vr_saber_block_debounce_time;
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
ovrInputStateTrackedRemote leftTrackedRemoteState_new;

View file

@ -790,12 +790,11 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
vec3_t start, end;
VectorSubtract(vr.secondaryVelocityTriggerLocation, vr.hmdposition, start);
VectorSubtract(vr.offhandposition, vr.hmdposition, end);
if (VectorLength(end) < VectorLength(start))
{
float deltaLength = VectorLength(end) - VectorLength(start);
if (fabs(deltaLength) > 0.25f) {
if (deltaLength < 0) {
sendButtonActionSimple(va("useGivenForce %i", FP_PULL));
}
else
{
} else {
sendButtonActionSimple(va("useGivenForce %i", FP_PUSH));
}
@ -804,6 +803,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
}
}
}
}
//Save state

View file

@ -4790,7 +4790,8 @@ Ghoul2 Insert End
cent->gent->client->ps.saberEventFlags & (SEF_BLOCKED|SEF_PARRIED) &&
vr->saberBlockDebounce < cg.time)
{
vr->saberBlockDebounce = cg.time + 200;
cvar_t *vr_saber_block_debounce_time = gi.cvar("vr_saber_block_debounce_time", "200", CVAR_ARCHIVE); // defined in VrCvars.h
vr->saberBlockDebounce = cg.time + vr_saber_block_debounce_time->integer;
}
if (CG_getPlayer1stPersonSaber(cent) &&

View file

@ -601,6 +601,21 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point,
VectorRotate( point, m, dst );
}
void AxisMultiply (matrix3_t out, const matrix3_t axis1, const matrix3_t axis2)
{
out[0][0] = axis1[0][0] * axis2[0][0] + axis1[0][1] * axis2[1][0] + axis1[0][2] * axis2[2][0];
out[0][1] = axis1[0][0] * axis2[0][1] + axis1[0][1] * axis2[1][1] + axis1[0][2] * axis2[2][1];
out[0][2] = axis1[0][0] * axis2[0][2] + axis1[0][1] * axis2[1][2] + axis1[0][2] * axis2[2][2];
out[1][0] = axis1[1][0] * axis2[0][0] + axis1[1][1] * axis2[1][0] + axis1[1][2] * axis2[2][0];
out[1][1] = axis1[1][0] * axis2[0][1] + axis1[1][1] * axis2[1][1] + axis1[1][2] * axis2[2][1];
out[1][2] = axis1[1][0] * axis2[0][2] + axis1[1][1] * axis2[1][2] + axis1[1][2] * axis2[2][2];
out[2][0] = axis1[2][0] * axis2[0][0] + axis1[2][1] * axis2[1][0] + axis1[2][2] * axis2[2][0];
out[2][1] = axis1[2][0] * axis2[0][1] + axis1[2][1] * axis2[1][1] + axis1[2][2] * axis2[2][1];
out[2][2] = axis1[2][0] * axis2[0][2] + axis1[2][1] * axis2[1][2] + axis1[2][2] * axis2[2][2];
}
void RotateAroundDirection( matrix3_t axis, float yaw ) {
// create an arbitrary axis[1]

View file

@ -144,6 +144,7 @@ float AngleDelta( float angle1, float angle2 );
qboolean PlaneFromPoints( vec4_t plane, const vec3_t a, const vec3_t b, const vec3_t c );
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
void RotateAroundDirection( matrix3_t axis, float yaw );
void AxisMultiply (matrix3_t out, const matrix3_t axis1, const matrix3_t axis2);
void vectoangles( const vec3_t value1, vec3_t angles );
vec_t GetYawForDirection( const vec3_t p1, const vec3_t p2 );
void GetAnglesForDirection( const vec3_t p1, const vec3_t p2, vec3_t out );