Small tweaks to menu and railgun scope

This commit is contained in:
Simon 2022-02-19 23:41:08 +00:00
parent 1841ee1892
commit 4985ab8a8d
3 changed files with 28 additions and 33 deletions

View file

@ -237,18 +237,6 @@ static void VR_Event( void* ptr, int notification ) {
} }
} }
/*
=================
Controls_StatusBar
=================
*/
static void VR_StatusBar( void *self )
{
UI_DrawString(SCREEN_WIDTH * 0.50, SCREEN_HEIGHT * 0.80, "Use Arrow Keys or CLICK to change", UI_SMALLFONT|UI_CENTER, colorWhite );
}
static void VR_MenuInit( void ) { static void VR_MenuInit( void ) {
int y; int y;
@ -273,7 +261,7 @@ static void VR_MenuInit( void ) {
static const char *s_directionmode[] = static const char *s_directionmode[] =
{ {
"HMD", "HMD (Default)",
"Off-hand Controller", "Off-hand Controller",
NULL NULL
}; };
@ -281,7 +269,7 @@ static void VR_MenuInit( void ) {
static const char *s_refreshrate[] = static const char *s_refreshrate[] =
{ {
"60", "60",
"72", "72 (Default)",
"80", "80",
"90", "90",
"120", "120",
@ -292,7 +280,7 @@ static void VR_MenuInit( void ) {
{ {
"None", "None",
"Blood Only", "Blood Only",
"Blood & Gibs", "Blood & Gibs (Default)",
"Extra Gore (Performance Hit)", "Extra Gore (Performance Hit)",
NULL NULL
}; };
@ -406,9 +394,8 @@ static void VR_MenuInit( void ) {
s_VR.weaponpitch.generic.name = "Weapon Pitch:"; s_VR.weaponpitch.generic.name = "Weapon Pitch:";
s_VR.weaponpitch.generic.id = ID_WEAPONPITCH; s_VR.weaponpitch.generic.id = ID_WEAPONPITCH;
s_VR.weaponpitch.generic.callback = VR_Event; s_VR.weaponpitch.generic.callback = VR_Event;
s_VR.weaponpitch.minvalue = -25; s_VR.weaponpitch.minvalue = 0;
s_VR.weaponpitch.maxvalue = 5; s_VR.weaponpitch.maxvalue = 30;
s_VR.weaponpitch.generic.statusbar = VR_StatusBar;
y += BIGCHAR_HEIGHT; y += BIGCHAR_HEIGHT;
s_VR.heightadjust.generic.type = MTYPE_SLIDER; s_VR.heightadjust.generic.type = MTYPE_SLIDER;
@ -420,7 +407,6 @@ static void VR_MenuInit( void ) {
s_VR.heightadjust.generic.callback = VR_Event; s_VR.heightadjust.generic.callback = VR_Event;
s_VR.heightadjust.minvalue = 0.0f; s_VR.heightadjust.minvalue = 0.0f;
s_VR.heightadjust.maxvalue = 1.0f; s_VR.heightadjust.maxvalue = 1.0f;
s_VR.heightadjust.generic.statusbar = VR_StatusBar;
y += BIGCHAR_HEIGHT; y += BIGCHAR_HEIGHT;
s_VR.twohanded.generic.type = MTYPE_RADIOBUTTON; s_VR.twohanded.generic.type = MTYPE_RADIOBUTTON;

View file

@ -32,10 +32,12 @@ typedef struct {
vec3_t weaponangles_delta; vec3_t weaponangles_delta;
vec3_t weaponoffset; vec3_t weaponoffset;
vec3_t weaponoffset_last[2];
vec3_t weaponposition; vec3_t weaponposition;
vec3_t offhandangles; vec3_t offhandangles;
vec3_t offhandoffset; vec3_t offhandoffset;
vec3_t offhandoffset_last[2];
vec3_t offhandposition; vec3_t offhandposition;
////////////////////////////////////// //////////////////////////////////////

View file

@ -219,9 +219,9 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
vr.weaponposition[1] = remoteTracking.HeadPose.Pose.Position.y + vr_heightAdjust->value; vr.weaponposition[1] = remoteTracking.HeadPose.Pose.Position.y + vr_heightAdjust->value;
vr.weaponposition[2] = remoteTracking.HeadPose.Pose.Position.z; vr.weaponposition[2] = remoteTracking.HeadPose.Pose.Position.z;
vr.weaponoffset[0] = vr.weaponposition[0] - vr.hmdposition[0]; VectorCopy(vr.weaponoffset_last[1], vr.weaponoffset_last[0]);
vr.weaponoffset[1] = vr.weaponposition[1] - vr.hmdposition[1]; VectorCopy(vr.weaponoffset, vr.weaponoffset_last[1]);
vr.weaponoffset[2] = vr.weaponposition[2] - vr.hmdposition[2]; VectorSubtract(vr.weaponposition, vr.hmdposition, vr.weaponoffset);
if (vr.virtual_screen || if (vr.virtual_screen ||
cl.snap.ps.pm_type == PM_INTERMISSION) cl.snap.ps.pm_type == PM_INTERMISSION)
@ -239,27 +239,34 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
vr.offhandposition[1] = remoteTracking.HeadPose.Pose.Position.y + vr_heightAdjust->value; vr.offhandposition[1] = remoteTracking.HeadPose.Pose.Position.y + vr_heightAdjust->value;
vr.offhandposition[2] = remoteTracking.HeadPose.Pose.Position.z; vr.offhandposition[2] = remoteTracking.HeadPose.Pose.Position.z;
vr.offhandoffset[0] = vr.offhandposition[0] - vr.hmdposition[0]; VectorCopy(vr.offhandoffset_last[1], vr.offhandoffset_last[0]);
vr.offhandoffset[1] = vr.offhandposition[1] - vr.hmdposition[1]; VectorCopy(vr.offhandoffset, vr.offhandoffset_last[1]);
vr.offhandoffset[2] = vr.offhandposition[2] - vr.hmdposition[2]; VectorSubtract(vr.offhandposition, vr.hmdposition, vr.offhandoffset);
} }
vr.weapon_zoomed = vr_weaponScope->integer && vr.weapon_zoomed = vr_weaponScope->integer &&
vr.weapon_stabilised && vr.weapon_stabilised &&
(cl.snap.ps.weapon == WP_RAILGUN) && (cl.snap.ps.weapon == WP_RAILGUN) &&
(VectorLength(vr.weaponoffset) < 0.2f) && (VectorLength(vr.weaponoffset) < 0.24f) &&
cl.snap.ps.stats[STAT_HEALTH] > 0; cl.snap.ps.stats[STAT_HEALTH] > 0;
if (vr_twoHandedWeapons->integer && vr.weapon_stabilised) if (vr_twoHandedWeapons->integer && vr.weapon_stabilised)
{ {
float x = vr.offhandoffset[0] - (vr.weapon_zoomed ? 0 : vr.weaponoffset[0]); vec3_t vec[3];
float y = vr.offhandoffset[1] - (vr.weapon_zoomed ? 0 : vr.weaponoffset[1]); VectorSubtract(vr.offhandoffset, vr.weaponoffset, vec[0]);
float z = vr.offhandoffset[2] - (vr.weapon_zoomed ? 0 : vr.weaponoffset[2]); VectorSubtract(vr.offhandoffset_last[0], vr.weaponoffset_last[0], vec[1]);
float zxDist = length(x, z); VectorSubtract(vr.offhandoffset_last[1], vr.weaponoffset_last[1], vec[2]);
if (zxDist != 0.0f && z != 0.0f) { vec3_t v;
VectorSet(vr.weaponangles, -degrees(atanf(y / zxDist)), VectorAdd(vec[0], vec[1], v);
-degrees(atan2f(x, -z)), vr.weaponangles[ROLL] / 2.0f); //Dampen roll on stabilised weapon VectorAdd(v, vec[2], v);
VectorScale(v, 1.0f/3.0f, v);
float zxDist = length(v[0], v[2]);
if (zxDist != 0.0f && v[2] != 0.0f) {
VectorSet(vr.weaponangles, -degrees(atanf(v[1] / zxDist)),
-degrees(atan2f(v[0], -v[2])), vr.weaponangles[ROLL] / 2.0f); //Dampen roll on stabilised weapon
} }
} }