A few small fixes

- Corrected FOV to 104
- Added same non-liner movement on the stick as QuestZDoom
- Made snap turn the default turn mode
- Weapon pitch adjustment default is better and increments are bigger when adjusting using B button
This commit is contained in:
Simon 2020-06-23 22:44:18 +01:00
parent 064f2edfd2
commit 135d563dcc
8 changed files with 84 additions and 64 deletions

View file

@ -437,7 +437,7 @@ cvar_t cl_sidespeed = {CVAR_SAVE, "cl_sidespeed","150","strafe movement speed"};
cvar_t cl_movespeedkey = {CVAR_SAVE, "cl_movespeedkey","2.0","how much +speed multiplies keyboard movement speed"};
cvar_t cl_movecliptokeyboard = {0, "cl_movecliptokeyboard", "0", "if set to 1, any move is clipped to the nine keyboard states; if set to 2, only the direction is clipped, not the amount"};
cvar_t cl_yawmode = {CVAR_SAVE, "cl_yawmode","0","0 = swivel-chair, 1 = comfort, 2 = stick"};
cvar_t vr_yawmode = {CVAR_SAVE, "vr_yawmode","1","0 = swivel-chair, 1 = snap, 2 = stick"};
cvar_t cl_walkdirection = {CVAR_SAVE, "cl_walkdirection","1","0 - Walk in direction of off-hand controller, 1 - Walk in direction of HMD"};
cvar_t cl_comfort = {CVAR_SAVE, "cl_comfort","45.0","angle by which comfort mode adjusts yaw"};
cvar_t cl_yawspeed = {CVAR_SAVE, "cl_yawspeed","150","keyboard yaw turning speed"};
@ -446,7 +446,7 @@ cvar_t cl_yawmult = {CVAR_SAVE, "cl_yawmult","1.0","Multiplier for yaw (leave at
cvar_t cl_pitchmult = {CVAR_SAVE, "cl_pitchmult","1.0","Multiplier for yaw (leave at 1.0)"};
cvar_t cl_controllerdeadzone = {0, "cl_controllerdeadzone","0.05","Amount of deadzone to prevent movement drift due to badly calibrated controller (0.0 to 1.0)"};
cvar_t cl_righthanded = {CVAR_SAVE, "cl_righthanded","1","right-handed?"};
cvar_t cl_weaponpitchadjust = {CVAR_SAVE, "cl_weaponpitchadjust","8.0","Weapon pitch adjustment"};
cvar_t vr_weaponpitchadjust = {CVAR_SAVE, "vr_weaponpitchadjust","-30.0","Weapon pitch adjustment"};
cvar_t cl_trackingmode = {CVAR_SAVE, "cl_trackingmode","1","Tracking Mode:- 1 - 6DoF or 0 - 3DoF"};
@ -513,12 +513,12 @@ static void CL_AdjustAngles (qboolean firstCall)
if (!(in_strafe.state & 1))
{
//Comfort mode
if ((cl_yawmode.integer == 1) && firstCall)
if ((vr_yawmode.integer == 1) && firstCall)
{
cl.viewangles[YAW] = (float)(cl.comfortInc) * cl_comfort.value;
}
//Stick control mode
if (cl_yawmode.integer == 2)
if (vr_yawmode.integer == 2)
{
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right);
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left);
@ -2257,7 +2257,7 @@ void CL_InitInput (void)
#endif
Cmd_AddCommand ("register_bestweapon", IN_BestWeapon_Register_f, "(for QC usage only) change weapon parameters to be used by bestweapon; stuffcmd this in ClientConnect");
Cvar_RegisterVariable(&cl_yawmode);
Cvar_RegisterVariable(&vr_yawmode);
Cvar_RegisterVariable(&cl_walkdirection);
Cvar_RegisterVariable(&cl_comfort);
Cvar_RegisterVariable(&cl_yawspeed);
@ -2265,7 +2265,7 @@ void CL_InitInput (void)
Cvar_RegisterVariable(&cl_yawmult);
Cvar_RegisterVariable(&cl_controllerdeadzone);
Cvar_RegisterVariable(&cl_righthanded);
Cvar_RegisterVariable(&cl_weaponpitchadjust);
Cvar_RegisterVariable(&vr_weaponpitchadjust);
Cvar_RegisterVariable(&cl_trackingmode);
Cvar_RegisterVariable(&cl_movecliptokeyboard);

View file

@ -14,7 +14,7 @@
#include "snd_main.h"
cvar_t scr_viewsize = {CVAR_SAVE, "viewsize","100", "how large the view should be, 110 disables inventory bar, 120 disables status bar"};
cvar_t scr_fov = {CVAR_SAVE, "vr_fov","106", "field of vision for VR - defaulted to 106"};
cvar_t scr_fov = {CVAR_SAVE, "vr_fov_fixed","104", "field of vision for VR - defaulted to 104"};
cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "0.85", "opacity of console background gfx/conback"};
cvar_t scr_conalphafactor = {CVAR_SAVE, "scr_conalphafactor", "1", "opacity of console background gfx/conback relative to scr_conalpha; when 0, gfx/conback is not drawn"};
cvar_t scr_conalpha2factor = {CVAR_SAVE, "scr_conalpha2factor", "0", "opacity of console background gfx/conback2 relative to scr_conalpha; when 0, gfx/conback2 is not drawn"};
@ -2718,8 +2718,8 @@ void CL_BeginUpdateScreen()
// bound field of view
if (scr_fov.value < 1)
Cvar_Set ("fov","1");
if (scr_fov.value > 170)
Cvar_Set ("fov","170");
if (scr_fov.value > 104)
Cvar_Set ("fov","104");
// intermission is always full screen
if (cl.intermission)

View file

@ -1489,7 +1489,7 @@ extern cvar_t cl_sidespeed;
extern cvar_t cl_movespeedkey;
extern cvar_t cl_yawmode;
extern cvar_t vr_yawmode;
extern cvar_t cl_comfort;
extern cvar_t cl_yawspeed;
extern cvar_t cl_pitchspeed;

View file

@ -126,7 +126,7 @@ cvar_t r_fakelight_intensity = {0, "r_fakelight_intensity","0.75", "fakelight in
cvar_t r_lasersight = {CVAR_SAVE, "r_lasersight", "0","Whether laser sight aim is used"};
cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","1", "opacity of water polygons"};
cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","0.7", "opacity of water polygons"};
cvar_t r_dynamic = {CVAR_SAVE, "r_dynamic","1", "enables dynamic lights (rocket glow and such)"};
cvar_t r_fullbrights = {CVAR_SAVE, "r_fullbrights", "1", "enables glowing pixels in quake textures (changes need r_restart to take effect)"};
cvar_t r_shadows = {CVAR_SAVE, "r_shadows", "0", "casts fake stencil shadows from models onto the world (rtlights are unaffected by this); when set to 2, always cast the shadows in the direction set by r_shadows_throwdirection, otherwise use the model lighting."};
@ -199,7 +199,7 @@ cvar_t r_glsl_postprocess_uservec2_enable = {CVAR_SAVE, "r_glsl_postprocess_user
cvar_t r_glsl_postprocess_uservec3_enable = {CVAR_SAVE, "r_glsl_postprocess_uservec3_enable", "1", "enables postprocessing uservec3 usage, creates USERVEC1 define (only useful if default.glsl has been customized)"};
cvar_t r_glsl_postprocess_uservec4_enable = {CVAR_SAVE, "r_glsl_postprocess_uservec4_enable", "1", "enables postprocessing uservec4 usage, creates USERVEC1 define (only useful if default.glsl has been customized)"};
cvar_t r_water = {CVAR_SAVE, "r_water", "0", "whether to use reflections and refraction on water surfaces (note: r_wateralpha must be set below 1)"};
cvar_t r_water = {CVAR_SAVE, "r_water", "1", "whether to use reflections and refraction on water surfaces (note: r_wateralpha must be set below 1)"};
cvar_t r_water_clippingplanebias = {CVAR_SAVE, "r_water_clippingplanebias", "1", "a rather technical setting which avoids black pixels around water edges"};
cvar_t r_water_resolutionmultiplier = {CVAR_SAVE, "r_water_resolutionmultiplier", "0.5", "multiplier for screen resolution when rendering refracted/reflected scenes, 1 is full quality, lower values are faster"};
cvar_t r_water_refractdistort = {CVAR_SAVE, "r_water_refractdistort", "0.01", "how much water refractions shimmer"};
@ -211,7 +211,7 @@ cvar_t r_water_fbo = {CVAR_SAVE, "r_water_fbo", "1", "enables use of render to t
cvar_t r_lerpsprites = {CVAR_SAVE, "r_lerpsprites", "0", "enables animation smoothing on sprites"};
cvar_t r_lerpmodels = {CVAR_SAVE, "r_lerpmodels", "1", "enables animation smoothing on models"};
cvar_t r_lerplightstyles = {CVAR_SAVE, "r_lerplightstyles", "0", "enable animation smoothing on flickering lights"};
cvar_t r_lerplightstyles = {CVAR_SAVE, "r_lerplightstyles", "1", "enable animation smoothing on flickering lights"};
cvar_t r_waterscroll = {CVAR_SAVE, "r_waterscroll", "1", "makes water scroll around, value controls how much"};
cvar_t r_bloom = {CVAR_SAVE, "r_bloom", "0", "enables bloom effect (makes bright pixels affect neighboring pixels)"};

View file

@ -3026,7 +3026,7 @@ static void M_Menu_Controller_AdjustSliders (int dir)
else if (controllermode_cursor == optnum++) ;
else if (controllermode_cursor == optnum++) ;
else if (controllermode_cursor == optnum++) ;
else if (controllermode_cursor == optnum++ && cl_yawmode.integer == 1)
else if (controllermode_cursor == optnum++ && vr_yawmode.integer == 1)
{
float value = 45.0f;
if (dir == 1)
@ -3058,7 +3058,7 @@ static void M_Menu_Controller_AdjustSliders (int dir)
Cvar_SetValueQuick (&cl_comfort, value);
}
else if (controllermode_cursor == optnum++ && cl_yawmode.integer == 2)
else if (controllermode_cursor == optnum++ && vr_yawmode.integer == 2)
Cvar_SetValueQuick (&sensitivity, bound(1, (sensitivity.value + (dir * 0.25)), 10));
}
@ -3099,11 +3099,11 @@ static void M_Menu_Controller_Key (int key, int ascii)
}
else if (controllermode_cursor == 3)
{
int newYawMode = cl_yawmode.integer;
int newYawMode = vr_yawmode.integer;
if (--newYawMode < 0)
newYawMode = 2;
Cvar_SetValueQuick (&cl_yawmode, newYawMode);
Cvar_SetValueQuick (&vr_yawmode, newYawMode);
}
else
M_Menu_Controller_AdjustSliders(-1);
@ -3125,11 +3125,11 @@ static void M_Menu_Controller_Key (int key, int ascii)
}
else if (controllermode_cursor == 3)
{
int newYawMode = cl_yawmode.integer;
int newYawMode = vr_yawmode.integer;
if (++newYawMode > 2)
newYawMode = 0;
Cvar_SetValueQuick (&cl_yawmode, newYawMode);
Cvar_SetValueQuick (&vr_yawmode, newYawMode);
}
else
M_Menu_Controller_AdjustSliders(1);
@ -3172,16 +3172,16 @@ static void M_Menu_Controller_Draw (void)
else
M_Options_PrintCommand("Controller: Right Handed", true);
if (cl_yawmode.integer == 0)
if (vr_yawmode.integer == 0)
M_Options_PrintCommand(" Turn Mode: Swivel-Chair (default)", true);
else if (cl_yawmode.integer == 1)
else if (vr_yawmode.integer == 1)
M_Options_PrintCommand(" Turn Mode: Snap-turn", true);
else
M_Options_PrintCommand(" Turn Mode: Smooth Turn", true);
M_Options_PrintSlider( " Snap Turn Angle", (cl_yawmode.integer == 1), cl_comfort.value, 30, 180);
M_Options_PrintSlider( " Smooth Turn Speed", (cl_yawmode.integer == 2), sensitivity.value, 1, 10);
if (cl_yawmode.integer >= 2)
M_Options_PrintSlider( " Snap Turn Angle", (vr_yawmode.integer == 1), cl_comfort.value, 30, 180);
M_Options_PrintSlider( " Smooth Turn Speed", (vr_yawmode.integer == 2), sensitivity.value, 1, 10);
if (vr_yawmode.integer >= 2)
{
M_Options_PrintCommand(" ", true);
M_Options_PrintCommand(" ", true);
@ -3611,7 +3611,7 @@ static void M_Credits_Draw (void)
" QQQQQQQQ QQQQQQQQ ",
" QQQ QQQ ",
" Q Q ",
" Q Q v1.4.2 ");
" Q Q v1.4.4 ");
int i, l, linelength, firstline, lastline, lines;
for (i = 0, linelength = 0, firstline = 9999, lastline = -1;m_credits_message[i];i++)

View file

@ -485,14 +485,14 @@ void QC_MotionEvent(float delta, float dx, float dy)
static bool canAdjust = true;
//If not in vr mode, then always use yaw stick control
if (cl_yawmode.integer == 2)
if (vr_yawmode.integer == 2)
{
in_mouse_x+=(dx*delta);
in_windowmouse_x += (dx*delta);
if (in_windowmouse_x<0) in_windowmouse_x=0;
if (in_windowmouse_x>andrw-1) in_windowmouse_x=andrw-1;
}
else if (cl_yawmode.integer == 1) {
else if (vr_yawmode.integer == 1) {
if (fabs(dx) > 0.4 && canAdjust && delta != -1.0f) {
if (dx > 0.0)
cl.comfortInc--;
@ -523,9 +523,9 @@ void IN_Move(void)
{
cl.viewangles[PITCH] = move_event.pitch;
if (cl_yawmode.integer == 0) {
if (vr_yawmode.integer == 0) {
cl.viewangles[YAW] = move_event.yaw;
} else if (cl_yawmode.integer == 1) {
} else if (vr_yawmode.integer == 1) {
cl.viewangles[YAW] += move_event.yaw;
} else
{

View file

@ -121,7 +121,7 @@ extern cvar_t cl_forwardspeed;
extern cvar_t cl_walkdirection;
extern cvar_t cl_controllerdeadzone;
extern cvar_t cl_righthanded;
extern cvar_t cl_weaponpitchadjust;
extern cvar_t vr_weaponpitchadjust;
extern cvar_t slowmo;
extern cvar_t bullettime;
extern cvar_t cl_trackingmode;
@ -1627,6 +1627,37 @@ static int getCharacter(float x, float y)
int breakHere = 0;
#define NLF_DEADZONE 0.1
#define NLF_POWER 2.2
float nonLinearFilter(float in)
{
float val = 0.0f;
if (in > NLF_DEADZONE)
{
val = in;
val -= NLF_DEADZONE;
val /= (1.0f - NLF_DEADZONE);
val = powf(val, NLF_POWER);
}
else if (in < -NLF_DEADZONE)
{
val = in;
val += NLF_DEADZONE;
val /= (1.0f - NLF_DEADZONE);
val = -powf(fabsf(val), NLF_POWER);
}
return val;
}
float length(float x, float y)
{
return sqrtf(powf(x, 2.0f) + powf(y, 2.0f));
}
static void ovrApp_HandleInput( ovrApp * app )
{
float remote_movementSideways = 0.0f;
@ -1790,7 +1821,7 @@ static void ovrApp_HandleInput( ovrApp * app )
//Set gun angles
const ovrQuatf quatRemote = dominantRemoteTracking->HeadPose.Pose.Orientation;
QuatToYawPitchRoll(quatRemote, -cl_weaponpitchadjust.value, gunangles);
QuatToYawPitchRoll(quatRemote, vr_weaponpitchadjust.value, gunangles);
gunangles[YAW] += yawOffset;
@ -1884,6 +1915,19 @@ static void ovrApp_HandleInput( ovrApp * app )
//Jump
handleTrackedControllerButton(&rightTrackedRemoteState_new,
&rightTrackedRemoteState_old, ovrButton_A, K_SPACE);
//Adjust weapon aim pitch
if ((rightTrackedRemoteState_new.Buttons & ovrButton_B) &&
(rightTrackedRemoteState_new.Buttons & ovrButton_B) !=
(rightTrackedRemoteState_old.Buttons & ovrButton_B)) {
float newPitchAdjust = vr_weaponpitchadjust.value + 5.0f;
if (newPitchAdjust > 10.0f) {
newPitchAdjust = -40.0f;
}
Cvar_SetValueQuick(&vr_weaponpitchadjust, newPitchAdjust);
ALOGV("Pitch Adjust: %f", newPitchAdjust);
}
}
if (cl_righthanded.integer) {
@ -1902,19 +1946,6 @@ static void ovrApp_HandleInput( ovrApp * app )
handleTrackedControllerButton(&rightTrackedRemoteState_new,
&rightTrackedRemoteState_old, ovrButton_GripTrigger, '/');
//Adjust weapon aim pitch
if ((rightTrackedRemoteState_new.Buttons & ovrButton_B) &&
(rightTrackedRemoteState_new.Buttons & ovrButton_B) !=
(rightTrackedRemoteState_old.Buttons & ovrButton_B)) {
float newPitchAdjust = cl_weaponpitchadjust.value + 1.0f;
if (newPitchAdjust > 23.0f) {
newPitchAdjust = -7.0f;
}
Cvar_SetValueQuick(&cl_weaponpitchadjust, newPitchAdjust);
ALOGV("Pitch Adjust: %f", newPitchAdjust);
}
rightTrackedRemoteState_old = rightTrackedRemoteState_new;
}
@ -1950,10 +1981,17 @@ static void ovrApp_HandleInput( ovrApp * app )
}
//Apply a filter and quadratic scaler so small movements are easier to make
//and we don't get movement jitter when the joystick doesn't quite center properly
float dist = length(leftTrackedRemoteState_new.Joystick.x, leftTrackedRemoteState_new.Joystick.y);
float nlf = nonLinearFilter(dist);
float x = nlf * leftTrackedRemoteState_new.Joystick.x;
float y = nlf * leftTrackedRemoteState_new.Joystick.y;
//Adjust to be off-hand controller oriented
vec2_t v;
rotateAboutOrigin(leftTrackedRemoteState_new.Joystick.x,
leftTrackedRemoteState_new.Joystick.y,
rotateAboutOrigin(x,
y,
cl_walkdirection.integer == 1 ? hmdYawHeading : controllerYawHeading,
v);
remote_movementSideways = v[0];
@ -2225,23 +2263,6 @@ typedef struct
long shutdownCountdown;
float CalcFov( float fov_x, float width, float height )
{
float a;
float x;
if( fov_x < 1 || fov_x > 179 )
fov_x = 90; // error, set to 90
x = width / tan( fov_x / 360 * M_PI );
a = atan ( height / x );
a = a * 360 / M_PI;
return a;
}
void * AppThreadFunction( void * parm )
{
ovrAppThread * appThread = (ovrAppThread *)parm;

View file

@ -53,6 +53,5 @@ bind MOUSE2 "+forward"
bind MOUSE3 "+mlook"
"cl_particles_quality" "2"
"cl_stainmaps" "1"
"vr_fov" "106"
"sensitivity" "4"
"snd_speed" "44100"