mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
Couple of movement fixes
- Make 3rd person movement adhere to a compass direction so that special moves can be executed - Reduced speed of smooth turn as it was too fast on lowest setting
This commit is contained in:
parent
5bf7075115
commit
6a714b3398
5 changed files with 20 additions and 4 deletions
|
@ -2,6 +2,7 @@ extern cvar_t *vr_turn_mode;
|
||||||
extern cvar_t *vr_turn_angle;
|
extern cvar_t *vr_turn_angle;
|
||||||
extern cvar_t *vr_positional_factor;
|
extern cvar_t *vr_positional_factor;
|
||||||
extern cvar_t *vr_walkdirection;
|
extern cvar_t *vr_walkdirection;
|
||||||
|
extern cvar_t *vr_3rdperson_digital_direction;
|
||||||
extern cvar_t *vr_weapon_pitchadjust;
|
extern cvar_t *vr_weapon_pitchadjust;
|
||||||
extern cvar_t *vr_saber_pitchadjust;
|
extern cvar_t *vr_saber_pitchadjust;
|
||||||
extern cvar_t *vr_control_scheme;
|
extern cvar_t *vr_control_scheme;
|
||||||
|
|
|
@ -15,6 +15,7 @@ cvar_t *vr_turn_mode;
|
||||||
cvar_t *vr_turn_angle;
|
cvar_t *vr_turn_angle;
|
||||||
cvar_t *vr_positional_factor;
|
cvar_t *vr_positional_factor;
|
||||||
cvar_t *vr_walkdirection;
|
cvar_t *vr_walkdirection;
|
||||||
|
cvar_t *vr_3rdperson_digital_direction;
|
||||||
cvar_t *vr_weapon_pitchadjust;
|
cvar_t *vr_weapon_pitchadjust;
|
||||||
cvar_t *vr_saber_pitchadjust;
|
cvar_t *vr_saber_pitchadjust;
|
||||||
cvar_t *vr_control_scheme;
|
cvar_t *vr_control_scheme;
|
||||||
|
|
|
@ -39,6 +39,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
vr.right_handed = vr_control_scheme->value < 10 ||
|
vr.right_handed = vr_control_scheme->value < 10 ||
|
||||||
vr_control_scheme->value == 99; // Always right-handed for weapon calibration
|
vr_control_scheme->value == 99; // Always right-handed for weapon calibration
|
||||||
|
|
||||||
|
bool thirdPersonActive = !!((int) Cvar_VariableValue("cg_thirdPerson"));
|
||||||
|
|
||||||
static bool dominantGripPushed = false;
|
static bool dominantGripPushed = false;
|
||||||
|
|
||||||
//Need this for the touch screen
|
//Need this for the touch screen
|
||||||
|
@ -808,7 +810,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
vr.offhandoffset[1] = pOff->Pose.position.y - vr.hmdposition[1];
|
vr.offhandoffset[1] = pOff->Pose.position.y - vr.hmdposition[1];
|
||||||
vr.offhandoffset[2] = pOff->Pose.position.z - vr.hmdposition[2];
|
vr.offhandoffset[2] = pOff->Pose.position.z - vr.hmdposition[2];
|
||||||
|
|
||||||
if (vr_walkdirection->value == 0) {
|
if (vr_walkdirection->value == 0 && !thirdPersonActive) {
|
||||||
controllerYawHeading = vr.offhandangles[ANGLES_ADJUSTED][YAW] - vr.hmdorientation[YAW];
|
controllerYawHeading = vr.offhandangles[ANGLES_ADJUSTED][YAW] - vr.hmdorientation[YAW];
|
||||||
} else {
|
} else {
|
||||||
controllerYawHeading = 0.0f;
|
controllerYawHeading = 0.0f;
|
||||||
|
@ -954,6 +956,17 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
vec2_t v;
|
vec2_t v;
|
||||||
rotateAboutOrigin(x, y, controllerYawHeading, v);
|
rotateAboutOrigin(x, y, controllerYawHeading, v);
|
||||||
|
|
||||||
|
// If in third person, use digital input (North, North-East, East, South-East etc)
|
||||||
|
// for movement as it allows execution of player special moves correctly in JKA
|
||||||
|
if (thirdPersonActive && vr_3rdperson_digital_direction->integer)
|
||||||
|
{
|
||||||
|
float angle = RAD2DEG(atan2f(v[1], v[0])) + 22.5;
|
||||||
|
int segment = angle / 45.0f;
|
||||||
|
angle = segment * 45.0f;
|
||||||
|
v[0] = nlf * cosf(DEG2RAD(angle));
|
||||||
|
v[1] = nlf * sinf(DEG2RAD(angle));
|
||||||
|
}
|
||||||
|
|
||||||
float move_speed_multiplier = 1.0f;
|
float move_speed_multiplier = 1.0f;
|
||||||
switch (vr.move_speed)
|
switch (vr.move_speed)
|
||||||
{
|
{
|
||||||
|
@ -968,7 +981,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vr_always_run->integer)
|
if (vr_always_run->integer || vr_3rdperson_digital_direction->integer)
|
||||||
{
|
{
|
||||||
move_speed_multiplier = 1.0f;
|
move_speed_multiplier = 1.0f;
|
||||||
}
|
}
|
||||||
|
@ -1072,7 +1085,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
|
|
||||||
if (!usingSnapTurn && fabs(primaryJoystickX) > 0.1f) //smooth turn
|
if (!usingSnapTurn && fabs(primaryJoystickX) > 0.1f) //smooth turn
|
||||||
{
|
{
|
||||||
vr.snapTurn -= ((vr_turn_angle->value / 10.0f) *
|
vr.snapTurn -= ((vr_turn_angle->value / 25.0f) *
|
||||||
primaryJoystickX);
|
primaryJoystickX);
|
||||||
if (vr.snapTurn > 180.0f) {
|
if (vr.snapTurn > 180.0f) {
|
||||||
vr.snapTurn -= 360.f;
|
vr.snapTurn -= 360.f;
|
||||||
|
@ -1158,7 +1171,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
|
|
||||||
// Process "use" gesture
|
// Process "use" gesture
|
||||||
if (vr_gesture_triggered_use->integer) {
|
if (vr_gesture_triggered_use->integer) {
|
||||||
bool thirdPersonActive = !!((int) Cvar_VariableValue("cg_thirdPerson"));
|
|
||||||
bool gestureUseAllowed = !vr.weapon_stabilised && !vr.cin_camera && !vr.misc_camera && !vr.remote_turret && !vr.emplaced_gun && !vr.in_vehicle && !thirdPersonActive;
|
bool gestureUseAllowed = !vr.weapon_stabilised && !vr.cin_camera && !vr.misc_camera && !vr.remote_turret && !vr.emplaced_gun && !vr.in_vehicle && !thirdPersonActive;
|
||||||
// Off-hand gesture
|
// Off-hand gesture
|
||||||
float distanceToBody = sqrt(vr.offhandoffset[0]*vr.offhandoffset[0] + vr.offhandoffset[2]*vr.offhandoffset[2]);
|
float distanceToBody = sqrt(vr.offhandoffset[0]*vr.offhandoffset[0] + vr.offhandoffset[2]*vr.offhandoffset[2]);
|
||||||
|
|
|
@ -328,6 +328,7 @@ void VR_Init()
|
||||||
vr_turn_angle = Cvar_Get( "vr_turn_angle", "45", CVAR_ARCHIVE);
|
vr_turn_angle = Cvar_Get( "vr_turn_angle", "45", CVAR_ARCHIVE);
|
||||||
vr_positional_factor = Cvar_Get( "vr_positional_factor", "12", CVAR_ARCHIVE);
|
vr_positional_factor = Cvar_Get( "vr_positional_factor", "12", CVAR_ARCHIVE);
|
||||||
vr_walkdirection = Cvar_Get( "vr_walkdirection", "1", CVAR_ARCHIVE);
|
vr_walkdirection = Cvar_Get( "vr_walkdirection", "1", CVAR_ARCHIVE);
|
||||||
|
vr_3rdperson_digital_direction = Cvar_Get( "vr_3rdperson_digital_direction", "1", CVAR_ARCHIVE);
|
||||||
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
|
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
|
||||||
vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-13.36", CVAR_ARCHIVE);
|
vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-13.36", CVAR_ARCHIVE);
|
||||||
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
|
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
|
||||||
|
|
|
@ -246,6 +246,7 @@ void VR_Init()
|
||||||
vr_turn_angle = Cvar_Get( "vr_turn_angle", "45", CVAR_ARCHIVE);
|
vr_turn_angle = Cvar_Get( "vr_turn_angle", "45", CVAR_ARCHIVE);
|
||||||
vr_positional_factor = Cvar_Get( "vr_positional_factor", "12", CVAR_ARCHIVE);
|
vr_positional_factor = Cvar_Get( "vr_positional_factor", "12", CVAR_ARCHIVE);
|
||||||
vr_walkdirection = Cvar_Get( "vr_walkdirection", "1", CVAR_ARCHIVE);
|
vr_walkdirection = Cvar_Get( "vr_walkdirection", "1", CVAR_ARCHIVE);
|
||||||
|
vr_3rdperson_digital_direction = Cvar_Get( "vr_3rdperson_digital_direction", "1", CVAR_ARCHIVE);
|
||||||
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
|
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
|
||||||
vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-13.36", CVAR_ARCHIVE);
|
vr_saber_pitchadjust = Cvar_Get( "vr_saber_pitchadjust", "-13.36", CVAR_ARCHIVE);
|
||||||
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
|
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
|
||||||
|
|
Loading…
Reference in a new issue