mirror of
https://github.com/DrBeef/QuakeQuest.git
synced 2024-11-21 19:51:13 +00:00
Changes to weapon pitch adjustment
Positional value multiplier unfortunately needed to change Toggle to adjust walk direction based on off-hand controller or HMD
This commit is contained in:
parent
aa6ec84a38
commit
af4fa71858
9 changed files with 117 additions and 72 deletions
|
@ -438,7 +438,7 @@ cvar_t cl_movespeedkey = {CVAR_SAVE, "cl_movespeedkey","2.0","how much +speed mu
|
|||
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 cl_controllerstrafe = {CVAR_SAVE, "cl_controllerstrafe","1","0 = Disable GearVR Controller Strafing, 1 = Use GearVR Controller Mode 1, 2 = Use GearVR Controller Mode 2"};
|
||||
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"};
|
||||
cvar_t cl_pitchspeed = {CVAR_SAVE, "cl_pitchspeed","150","keyboard pitch turning speed"};
|
||||
|
@ -446,7 +446,9 @@ 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 cl_weapon_offset_ud = {CVAR_SAVE, "cl_weapon_offset_ud","0.0","up/down weapon offset (+ve move up)"};
|
||||
cvar_t cl_weapon_offset_lr = {CVAR_SAVE, "cl_weapon_offset_lr","0.0","left/right weapon offset (+ve move right)"};
|
||||
cvar_t cl_weapon_offset_fb = {CVAR_SAVE, "cl_weapon_offset_fb","0.15","front/back weapon offset (+ve move back)"};
|
||||
|
||||
|
@ -2259,15 +2261,17 @@ void CL_InitInput (void)
|
|||
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(&cl_controllerstrafe);
|
||||
Cvar_RegisterVariable(&cl_walkdirection);
|
||||
Cvar_RegisterVariable(&cl_comfort);
|
||||
Cvar_RegisterVariable(&cl_yawspeed);
|
||||
Cvar_RegisterVariable(&cl_pitchmult);
|
||||
Cvar_RegisterVariable(&cl_yawmult);
|
||||
Cvar_RegisterVariable(&cl_controllerdeadzone);
|
||||
Cvar_RegisterVariable(&cl_righthanded);
|
||||
Cvar_RegisterVariable(&cl_weapon_offset_ud);
|
||||
Cvar_RegisterVariable(&cl_weapon_offset_lr);
|
||||
Cvar_RegisterVariable(&cl_weapon_offset_fb);
|
||||
Cvar_RegisterVariable(&cl_weaponpitchadjust);
|
||||
|
||||
Cvar_RegisterVariable(&cl_movecliptokeyboard);
|
||||
Cvar_RegisterVariable(&cl_movement);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
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, "fov","100", "field of vision, 1-170 degrees, default 110, some players use 110-130"};
|
||||
cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1", "opacity of console background gfx/conback"};
|
||||
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"};
|
||||
cvar_t scr_conalpha3factor = {CVAR_SAVE, "scr_conalpha3factor", "0", "opacity of console background gfx/conback3 relative to scr_conalpha; when 0, gfx/conback3 is not drawn"};
|
||||
|
@ -28,9 +28,9 @@ cvar_t scr_conscroll2_y = {CVAR_SAVE, "scr_conscroll2_y", "0", "scroll speed of
|
|||
cvar_t scr_conscroll3_x = {CVAR_SAVE, "scr_conscroll3_x", "0", "scroll speed of gfx/conback3 in x direction"};
|
||||
cvar_t scr_conscroll3_y = {CVAR_SAVE, "scr_conscroll3_y", "0", "scroll speed of gfx/conback3 in y direction"};
|
||||
cvar_t scr_menuforcewhiledisconnected = {0, "scr_menuforcewhiledisconnected", "0", "forces menu while disconnected"};
|
||||
cvar_t scr_centertime = {0, "scr_centertime","3", "how long centerprint messages show"};
|
||||
cvar_t scr_centertime = {0, "scr_centertime","4", "how long centerprint messages show"};
|
||||
cvar_t scr_showram = {CVAR_SAVE, "showram","1", "show ram icon if low on surface cache memory (not used)"};
|
||||
cvar_t scr_showturtle = {CVAR_SAVE, "showturtle","0", "show turtle icon when framerate is too low"};
|
||||
cvar_t scr_showturtle = {CVAR_SAVE, "showturtle","1", "show turtle icon when framerate is too low"};
|
||||
cvar_t scr_showpause = {CVAR_SAVE, "showpause","1", "show pause icon when game is paused"};
|
||||
cvar_t scr_showbrand = {0, "showbrand","0", "shows gfx/brand.tga in a corner of the screen (different values select different positions, including centered)"};
|
||||
cvar_t scr_printspeed = {0, "scr_printspeed","0", "speed of intermission printing (episode end texts), a value of 0 disables the slow printing"};
|
||||
|
|
|
@ -1490,7 +1490,6 @@ extern cvar_t cl_sidespeed;
|
|||
extern cvar_t cl_movespeedkey;
|
||||
|
||||
extern cvar_t cl_yawmode;
|
||||
extern cvar_t cl_controllerstrafe;
|
||||
extern cvar_t cl_comfort;
|
||||
extern cvar_t cl_yawspeed;
|
||||
extern cvar_t cl_pitchspeed;
|
||||
|
|
|
@ -46,7 +46,7 @@ static qboolean r_loaddds;
|
|||
static qboolean r_savedds;
|
||||
static qboolean r_gpuskeletal;
|
||||
|
||||
cvar_t r_worldscale = {CVAR_SAVE, "r_worldscale", "30.0", "World scale multiplier (default is 30)"};
|
||||
cvar_t r_worldscale = {CVAR_SAVE, "r_worldscale", "40", "World scale multiplier (default is 40)"};
|
||||
|
||||
float GetStereoSeparation()
|
||||
{
|
||||
|
|
|
@ -52,12 +52,9 @@ extern char *strGameFolder;
|
|||
extern cvar_t r_worldscale;
|
||||
extern cvar_t r_lasersight;
|
||||
extern cvar_t cl_righthanded;
|
||||
extern cvar_t cl_walkdirection;
|
||||
|
||||
extern void BigScreenMode(int mode);
|
||||
extern void SwitchStereoMode(int mode);
|
||||
extern void ControllerStrafeMode(int mode);
|
||||
|
||||
extern bool jni_isPositionTrackingSupported();
|
||||
|
||||
//Record yaw at the moment the menu is invoked
|
||||
static float hmdYaw = 0;
|
||||
|
@ -77,7 +74,7 @@ void M_Menu_Main_f (void);
|
|||
void M_Menu_Keys_f (void);
|
||||
void M_Menu_Reset_f (void);
|
||||
void M_Menu_Video_f (void);
|
||||
void M_Menu_YawPitchControl_f (void);
|
||||
void M_Menu_Controller_f (void);
|
||||
void M_Menu_Help_f (void);
|
||||
void M_Menu_Credits_f (void);
|
||||
void M_Menu_Quit_f (void);
|
||||
|
@ -101,7 +98,7 @@ static void M_Main_Draw (void);
|
|||
static void M_Keys_Draw (void);
|
||||
static void M_Reset_Draw (void);
|
||||
static void M_Video_Draw (void);
|
||||
static void M_Menu_YawPitchControl_Draw (void);
|
||||
static void M_Menu_Controller_Draw (void);
|
||||
static void M_Help_Draw (void);
|
||||
static void M_Credits_Draw (void);
|
||||
static void M_Quit_Draw (void);
|
||||
|
@ -126,7 +123,7 @@ static void M_Main_Key (int key, int ascii);
|
|||
static void M_Keys_Key (int key, int ascii);
|
||||
static void M_Reset_Key (int key, int ascii);
|
||||
static void M_Video_Key (int key, int ascii);
|
||||
static void M_Menu_YawPitchControl_Key (int key, int ascii);
|
||||
static void M_Menu_Controller_Key (int key, int ascii);
|
||||
static void M_Help_Key (int key, int ascii);
|
||||
static void M_Credits_Key (int key, int ascii);
|
||||
static void M_Quit_Key (int key, int ascii);
|
||||
|
@ -1916,7 +1913,7 @@ static void M_Options_Key (int k, int ascii)
|
|||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
M_Menu_YawPitchControl_f ();
|
||||
M_Menu_Controller_f ();
|
||||
break;
|
||||
case 2:
|
||||
m_state = m_none;
|
||||
|
@ -2996,14 +2993,14 @@ static void M_Reset_Draw (void)
|
|||
|
||||
static int controllermode_cursor;
|
||||
|
||||
void M_Menu_YawPitchControl_f (void)
|
||||
void M_Menu_Controller_f (void)
|
||||
{
|
||||
key_dest = key_menu;
|
||||
m_state = m_yawpitchcontrol;
|
||||
m_state = m_controller;
|
||||
m_entersound = true;
|
||||
}
|
||||
|
||||
static void M_Menu_YawPitchControl_AdjustSliders (int dir)
|
||||
static void M_Menu_Controller_AdjustSliders (int dir)
|
||||
{
|
||||
int optnum;
|
||||
S_LocalSound ("sound/misc/menu3.wav");
|
||||
|
@ -3012,6 +3009,7 @@ static void M_Menu_YawPitchControl_AdjustSliders (int dir)
|
|||
|
||||
if (controllermode_cursor == optnum++) ;
|
||||
else if (controllermode_cursor == optnum++) ;
|
||||
else if (controllermode_cursor == optnum++) ;
|
||||
else if (controllermode_cursor == optnum++ && cl_yawmode.integer == 1)
|
||||
{
|
||||
float value = 45.0f;
|
||||
|
@ -3048,7 +3046,7 @@ static void M_Menu_YawPitchControl_AdjustSliders (int dir)
|
|||
Cvar_SetValueQuick (&sensitivity, bound(1, (sensitivity.value + (dir * 0.25)), 10));
|
||||
}
|
||||
|
||||
static void M_Menu_YawPitchControl_Key (int key, int ascii)
|
||||
static void M_Menu_Controller_Key (int key, int ascii)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -3073,9 +3071,13 @@ static void M_Menu_YawPitchControl_Key (int key, int ascii)
|
|||
case K_LEFTARROW:
|
||||
if (controllermode_cursor == 0)
|
||||
{
|
||||
Cvar_SetValueQuick (&cl_righthanded, 1 - cl_righthanded.integer);
|
||||
Cvar_SetValueQuick (&cl_walkdirection, 1 - cl_walkdirection.integer);
|
||||
}
|
||||
else if (controllermode_cursor == 1)
|
||||
{
|
||||
Cvar_SetValueQuick (&cl_righthanded, 1 - cl_righthanded.integer);
|
||||
}
|
||||
else if (controllermode_cursor == 2)
|
||||
{
|
||||
int newYawMode = cl_yawmode.integer;
|
||||
if (--newYawMode < 0)
|
||||
|
@ -3084,16 +3086,20 @@ static void M_Menu_YawPitchControl_Key (int key, int ascii)
|
|||
Cvar_SetValueQuick (&cl_yawmode, newYawMode);
|
||||
}
|
||||
else
|
||||
M_Menu_YawPitchControl_AdjustSliders(-1);
|
||||
M_Menu_Controller_AdjustSliders(-1);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
case K_RIGHTARROW:
|
||||
if (controllermode_cursor == 0)
|
||||
{
|
||||
Cvar_SetValueQuick (&cl_righthanded, 1 - cl_righthanded.integer);
|
||||
Cvar_SetValueQuick (&cl_walkdirection, 1 - cl_walkdirection.integer);
|
||||
}
|
||||
else if (controllermode_cursor == 1)
|
||||
{
|
||||
Cvar_SetValueQuick (&cl_righthanded, 1 - cl_righthanded.integer);
|
||||
}
|
||||
else if (controllermode_cursor == 2)
|
||||
{
|
||||
int newYawMode = cl_yawmode.integer;
|
||||
if (++newYawMode > 2)
|
||||
|
@ -3102,7 +3108,7 @@ static void M_Menu_YawPitchControl_Key (int key, int ascii)
|
|||
Cvar_SetValueQuick (&cl_yawmode, newYawMode);
|
||||
}
|
||||
else
|
||||
M_Menu_YawPitchControl_AdjustSliders(1);
|
||||
M_Menu_Controller_AdjustSliders(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3110,7 +3116,7 @@ static void M_Menu_YawPitchControl_Key (int key, int ascii)
|
|||
}
|
||||
}
|
||||
|
||||
static void M_Menu_YawPitchControl_Draw (void)
|
||||
static void M_Menu_Controller_Draw (void)
|
||||
{
|
||||
int visible;
|
||||
cachepic_t *p;
|
||||
|
@ -3126,9 +3132,15 @@ static void M_Menu_YawPitchControl_Draw (void)
|
|||
visible = (int)((menu_height - 32) / 8);
|
||||
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, YAWCONTROL_ITEMS - visible)) * 8;
|
||||
|
||||
|
||||
if (cl_walkdirection.integer == 0)
|
||||
M_Options_PrintCommand("Heading Mode: Off-hand Controller", true);
|
||||
else
|
||||
M_Options_PrintCommand("Heading Mode: HMD", true);
|
||||
|
||||
if (cl_righthanded.integer == 0)
|
||||
M_Options_PrintCommand("Controller: Left Handed", true);
|
||||
else if (cl_righthanded.integer == 1)
|
||||
else
|
||||
M_Options_PrintCommand("Controller: Right Handed", true);
|
||||
|
||||
if (cl_yawmode.integer == 0)
|
||||
|
@ -5177,7 +5189,7 @@ static void M_Init (void)
|
|||
Cmd_AddCommand ("menu_keys", M_Menu_Keys_f, "open the key binding menu");
|
||||
Cmd_AddCommand ("menu_video", M_Menu_Video_f, "open the video options menu");
|
||||
Cmd_AddCommand ("menu_reset", M_Menu_Reset_f, "open the reset to defaults menu");
|
||||
Cmd_AddCommand ("menu_reset", M_Menu_YawPitchControl_f, "open the yaw/pitch control menu");
|
||||
Cmd_AddCommand ("menu_reset", M_Menu_Controller_f, "open the yaw/pitch control menu");
|
||||
Cmd_AddCommand ("menu_mods", M_Menu_ModList_f, "open the mods browser menu");
|
||||
Cmd_AddCommand ("help", M_Menu_Help_f, "open the help menu");
|
||||
Cmd_AddCommand ("menu_quit", M_Menu_Quit_f, "open the quit menu");
|
||||
|
@ -5266,8 +5278,8 @@ void M_Draw (void)
|
|||
M_Video_Draw ();
|
||||
break;
|
||||
|
||||
case m_yawpitchcontrol:
|
||||
M_Menu_YawPitchControl_Draw ();
|
||||
case m_controller:
|
||||
M_Menu_Controller_Draw ();
|
||||
break;
|
||||
|
||||
case m_help:
|
||||
|
@ -5414,8 +5426,8 @@ void M_KeyEvent (int key, int ascii, qboolean downevent)
|
|||
M_Video_Key (key, ascii);
|
||||
return;
|
||||
|
||||
case m_yawpitchcontrol:
|
||||
M_Menu_YawPitchControl_Key (key, ascii);
|
||||
case m_controller:
|
||||
M_Menu_Controller_Key (key, ascii);
|
||||
return;
|
||||
|
||||
case m_help:
|
||||
|
|
|
@ -34,7 +34,7 @@ enum m_state_e {
|
|||
m_setup,
|
||||
m_options,
|
||||
m_video,
|
||||
m_yawpitchcontrol,
|
||||
m_controller,
|
||||
m_keys,
|
||||
m_help,
|
||||
m_credits,
|
||||
|
|
|
@ -75,7 +75,7 @@ cvar_t cl_followmodel_up_highpass1 = {CVAR_SAVE, "cl_followmodel_up_highpass1",
|
|||
cvar_t cl_followmodel_up_highpass = {CVAR_SAVE, "cl_followmodel_up_highpass", "2", "gun following upward highpass in 1/s"};
|
||||
cvar_t cl_followmodel_up_lowpass = {CVAR_SAVE, "cl_followmodel_up_lowpass", "10", "gun following upward lowpass in 1/s"};
|
||||
|
||||
cvar_t cl_viewmodel_scale = {0, "cl_viewmodel_scale", "0.5", "changes size of gun model, lower values prevent poking into walls but cause strange artifacts on lighting and especially r_stereo/vid_stereobuffer options where the size of the gun becomes visible"};
|
||||
cvar_t cl_viewmodel_scale = {0, "cl_viewmodel_scale", "0.65", "changes size of gun model, lower values prevent poking into walls but cause strange artifacts on lighting and especially r_stereo/vid_stereobuffer options where the size of the gun becomes visible"};
|
||||
|
||||
cvar_t v_kicktime = {0, "v_kicktime", "0.0", "how long a view kick from damage lasts"};
|
||||
cvar_t v_kickroll = {0, "v_kickroll", "0.0", "how much a view kick from damage rolls your view"};
|
||||
|
@ -120,7 +120,6 @@ float worldPosition[3];
|
|||
extern float weaponOffset[3];
|
||||
extern float hmdPosition[3];
|
||||
extern float playerHeight;
|
||||
extern qboolean rightHanded;
|
||||
|
||||
extern cvar_t r_worldscale;
|
||||
extern cvar_t cl_positionaltrackingmode;
|
||||
|
@ -881,7 +880,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
|
|||
{
|
||||
vieworg[0] += (weaponOffset[2] * r_worldscale.value); // Forward/Back
|
||||
vieworg[1] += (weaponOffset[0] * r_worldscale.value); // Left/Right
|
||||
vieworg[2] += ((hmdPosition[1]-playerHeight) * r_worldscale.value); // Up/Down
|
||||
vieworg[2] += (((hmdPosition[1] - playerHeight) + 0.4f) * r_worldscale.value); // Up/Down - Make played a bit taller
|
||||
}
|
||||
|
||||
Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, vieworg[0], vieworg[1], vieworg[2],
|
||||
|
@ -898,7 +897,8 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
|
|||
Matrix4x4_CreateFromQuakeEntity(&viewmodelmatrix_withbob, gunorg[0],
|
||||
gunorg[1],
|
||||
gunorg[2],
|
||||
gunangles[0], gunangles[1], 0.0f, cl_viewmodel_scale.value);
|
||||
gunangles[0],
|
||||
gunangles[1], 0.0f, cl_viewmodel_scale.value);
|
||||
|
||||
|
||||
VectorCopy(vieworg, cl.csqc_vieworiginfromengine);
|
||||
|
|
|
@ -119,11 +119,13 @@ extern cvar_t r_worldscale;
|
|||
extern cvar_t r_lasersight;
|
||||
extern cvar_t cl_forwardspeed;
|
||||
extern cvar_t cl_postrackmultiplier;
|
||||
extern cvar_t cl_controllerstrafe;
|
||||
extern cvar_t cl_walkdirection;
|
||||
extern cvar_t cl_controllerdeadzone;
|
||||
extern cvar_t cl_righthanded;
|
||||
extern cvar_t cl_weapon_offset_ud;
|
||||
extern cvar_t cl_weapon_offset_lr;
|
||||
extern cvar_t cl_weapon_offset_fb;
|
||||
extern cvar_t cl_weaponpitchadjust;
|
||||
|
||||
extern int key_consoleactive;
|
||||
|
||||
|
@ -1000,7 +1002,7 @@ static void ovrRenderer_Create( ovrRenderer * renderer, const ovrJava * java )
|
|||
|
||||
modelScreen = ovrMatrix4f_CreateIdentity();
|
||||
rotation = ovrMatrix4f_CreateIdentity();
|
||||
ovrMatrix4f translation = ovrMatrix4f_CreateTranslation( 0, 0, -3.0f );
|
||||
ovrMatrix4f translation = ovrMatrix4f_CreateTranslation( 0, 0, -5.0f );
|
||||
modelScreen = ovrMatrix4f_Multiply( &modelScreen, &translation );
|
||||
|
||||
horizFOV = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
|
||||
|
@ -1440,6 +1442,15 @@ static void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out)
|
|||
}
|
||||
|
||||
|
||||
static void rotateAboutOrigin2(vec3_t in, float pitch, float yaw, vec3_t out)
|
||||
{
|
||||
vec3_t v;
|
||||
matrix4x4_t matrix;
|
||||
Matrix4x4_CreateFromQuakeEntity(&matrix, 0.0f, 0.0f, 0.0f, pitch, yaw, 0.0f, 1.0f);
|
||||
Matrix4x4_Transform(&matrix, in, v);
|
||||
Vector2Copy(out, v);
|
||||
}
|
||||
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_new;
|
||||
ovrTracking leftRemoteTracking;
|
||||
|
@ -1490,19 +1501,20 @@ static void ovrApp_HandleInput( ovrApp * app )
|
|||
}
|
||||
}
|
||||
|
||||
ovrInputStateTrackedRemote dominantTrackedRemoteState = cl_righthanded.integer ? rightTrackedRemoteState_new : leftTrackedRemoteState_new;
|
||||
ovrInputStateTrackedRemote dominantTrackedRemoteStateOld = cl_righthanded.integer ? rightTrackedRemoteState_old : leftTrackedRemoteState_old;
|
||||
ovrTracking dominantRemoteTracking = cl_righthanded.integer ? rightRemoteTracking : leftRemoteTracking;
|
||||
ovrInputStateTrackedRemote offHandTrackedRemoteState = !cl_righthanded.integer ? rightTrackedRemoteState_new : leftTrackedRemoteState_new;
|
||||
ovrTracking offHandRemoteTracking = !cl_righthanded.integer ? rightRemoteTracking : leftRemoteTracking;
|
||||
ovrInputStateTrackedRemote *dominantTrackedRemoteState = cl_righthanded.integer ? &rightTrackedRemoteState_new : &leftTrackedRemoteState_new;
|
||||
ovrInputStateTrackedRemote *dominantTrackedRemoteStateOld = cl_righthanded.integer ? &rightTrackedRemoteState_old : &leftTrackedRemoteState_old;
|
||||
ovrTracking *dominantRemoteTracking = cl_righthanded.integer ? &rightRemoteTracking : &leftRemoteTracking;
|
||||
ovrInputStateTrackedRemote *offHandTrackedRemoteState = !cl_righthanded.integer ? &rightTrackedRemoteState_new : &leftTrackedRemoteState_new;
|
||||
ovrInputStateTrackedRemote *offHandTrackedRemoteStateOld = !cl_righthanded.integer ? &rightTrackedRemoteState_old : &leftTrackedRemoteState_old;
|
||||
ovrTracking *offHandRemoteTracking = !cl_righthanded.integer ? &rightRemoteTracking : &leftRemoteTracking;
|
||||
|
||||
//dominant hand stuff first
|
||||
{
|
||||
weaponOffset[0] = dominantRemoteTracking.HeadPose.Pose.Position.x - hmdPosition[0];
|
||||
weaponOffset[1] = dominantRemoteTracking.HeadPose.Pose.Position.y - hmdPosition[1];
|
||||
weaponOffset[2] = dominantRemoteTracking.HeadPose.Pose.Position.z - hmdPosition[2];
|
||||
weaponOffset[0] = dominantRemoteTracking->HeadPose.Pose.Position.x - hmdPosition[0];
|
||||
weaponOffset[1] = dominantRemoteTracking->HeadPose.Pose.Position.y - hmdPosition[1];
|
||||
weaponOffset[2] = dominantRemoteTracking->HeadPose.Pose.Position.z - hmdPosition[2];
|
||||
|
||||
setWorldPosition(dominantRemoteTracking.HeadPose.Pose.Position.x, dominantRemoteTracking.HeadPose.Pose.Position.y, dominantRemoteTracking.HeadPose.Pose.Position.z);
|
||||
setWorldPosition(dominantRemoteTracking->HeadPose.Pose.Position.x, dominantRemoteTracking->HeadPose.Pose.Position.y, dominantRemoteTracking->HeadPose.Pose.Position.z);
|
||||
|
||||
///Weapon location relative to view
|
||||
vec2_t v;
|
||||
|
@ -1510,25 +1522,25 @@ static void ovrApp_HandleInput( ovrApp * app )
|
|||
weaponOffset[0] = v[0];
|
||||
weaponOffset[2] = v[1];
|
||||
|
||||
//Doesn't work - leaving out for now
|
||||
/* // Adjust right (+ve), adjust Back (+ve)
|
||||
rotateAboutOrigin(cl_weapon_offset_lr.value, cl_weapon_offset_fb.value, -gunangles[YAW]-yawOffset, v);
|
||||
//Set gun angles
|
||||
const ovrQuatf quatRemote = dominantRemoteTracking->HeadPose.Pose.Orientation;
|
||||
QuatToYawPitchRoll(quatRemote, gunangles);
|
||||
|
||||
//TODO: THIS NEEDS WORK!! - can't get it working and it is doing my head in!!
|
||||
/* // Adjust right (+ve), adjust Back (+ve), up (+ve)
|
||||
vec3_t adjustment;
|
||||
VectorSet(adjustment, v[0], 0.0f, v[1]);
|
||||
VectorAdd(adjustment, weaponOffset, weaponOffset);
|
||||
*/
|
||||
//VectorSet(adjustment, cl_weapon_offset_lr.value, cl_weapon_offset_ud.value, cl_weapon_offset_fb.value);
|
||||
VectorSet(adjustment, 0.0f, 0.2f, 0.2f);
|
||||
rotateAboutOrigin2(adjustment, gunangles[PITCH], gunangles[YAW]-yawOffset, adjustment);
|
||||
VectorAdd(adjustment, weaponOffset, weaponOffset);*/
|
||||
|
||||
//Set gun angles
|
||||
const ovrQuatf quatRemote = dominantRemoteTracking.HeadPose.Pose.Orientation;
|
||||
QuatToYawPitchRoll(quatRemote, gunangles);
|
||||
|
||||
//Adjust gun pitch down slightly
|
||||
gunangles[PITCH] += 8.0f;
|
||||
//Adjust gun pitch for user preference
|
||||
gunangles[PITCH] += cl_weaponpitchadjust.value;
|
||||
gunangles[YAW] += yawOffset;
|
||||
|
||||
//Change laser sight on joystick click
|
||||
if ((dominantTrackedRemoteState.Buttons & ovrButton_Joystick) &&
|
||||
(dominantTrackedRemoteState.Buttons & ovrButton_Joystick) != (dominantTrackedRemoteStateOld.Buttons & ovrButton_Joystick))
|
||||
if ((dominantTrackedRemoteState->Buttons & ovrButton_Joystick) &&
|
||||
(dominantTrackedRemoteState->Buttons & ovrButton_Joystick) != (dominantTrackedRemoteStateOld->Buttons & ovrButton_Joystick))
|
||||
{
|
||||
Cvar_SetValueQuick (&r_lasersight, (r_lasersight.integer+1) % 3);
|
||||
}
|
||||
|
@ -1536,11 +1548,26 @@ static void ovrApp_HandleInput( ovrApp * app )
|
|||
|
||||
//off-hand stuff
|
||||
float controllerYawHeading;
|
||||
float hmdYawHeading;
|
||||
{
|
||||
QuatToYawPitchRoll(offHandRemoteTracking.HeadPose.Pose.Orientation,
|
||||
QuatToYawPitchRoll(offHandRemoteTracking->HeadPose.Pose.Orientation,
|
||||
controllerAngles);
|
||||
|
||||
controllerYawHeading = controllerAngles[YAW] - gunangles[YAW] + yawOffset;
|
||||
hmdYawHeading = hmdorientation[YAW] - gunangles[YAW] + yawOffset;
|
||||
|
||||
//Change heading mode on click of off=hand joystick
|
||||
if ((offHandTrackedRemoteState->Buttons & ovrButton_Joystick) && bigScreen == 0 &&
|
||||
(offHandTrackedRemoteState->Buttons & ovrButton_Joystick) != (offHandTrackedRemoteStateOld->Buttons & ovrButton_Joystick))
|
||||
{
|
||||
Cvar_SetValueQuick (&cl_walkdirection, 1 - cl_walkdirection.integer);
|
||||
if (cl_walkdirection.integer == 1) {
|
||||
SCR_CenterPrint("Heading Mode: Direction of HMD");
|
||||
} else{
|
||||
SCR_CenterPrint("Heading Mode: Direction of off-hand controller");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Right-hand specific stuff
|
||||
|
@ -1549,8 +1576,8 @@ static void ovrApp_HandleInput( ovrApp * app )
|
|||
|
||||
//This section corrects for the fact that the controller actually controls direction of movement, but we want to move relative to the direction the
|
||||
//player is facing for positional tracking
|
||||
float multiplier = /*arbitrary value that works - The date Quake was released, 22nd June 1996 ->*/
|
||||
(1996.0622f * cl_postrackmultiplier.value) / cl_forwardspeed.value;
|
||||
float multiplier = /*arbitrary value that works ->*/
|
||||
(2500.0f * cl_postrackmultiplier.value) / cl_forwardspeed.value;
|
||||
|
||||
vec2_t v;
|
||||
rotateAboutOrigin(-positionDeltaThisFrame[0] * multiplier, positionDeltaThisFrame[2] * multiplier, -hmdorientation[YAW], v);
|
||||
|
@ -1609,17 +1636,19 @@ static void ovrApp_HandleInput( ovrApp * app )
|
|||
//Next Weapon
|
||||
handleTrackedControllerButton(&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, ovrButton_GripTrigger, '/');
|
||||
|
||||
#ifndef NDEBUG
|
||||
//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;
|
||||
}
|
||||
|
||||
//Adjust Weapon Offset
|
||||
if ((leftTrackedRemoteState_new.Buttons & ovrButton_B) && bigScreen == 0 &&
|
||||
(leftTrackedRemoteState_new.Buttons & ovrButton_B) != (leftTrackedRemoteState_old.Buttons & ovrButton_B))
|
||||
{
|
||||
SCR_CenterPrint("Mmmm Sausage!");
|
||||
Cvar_SetValueQuick(&cl_weaponpitchadjust, newPitchAdjust);
|
||||
ALOGV("Pitch Adjust: %f", newPitchAdjust );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
rightTrackedRemoteState_old = rightTrackedRemoteState_new;
|
||||
|
||||
}
|
||||
|
@ -1653,7 +1682,7 @@ static void ovrApp_HandleInput( ovrApp * app )
|
|||
|
||||
//Adjust to be off-hand controller oriented
|
||||
vec2_t v;
|
||||
rotateAboutOrigin(leftTrackedRemoteState_new.Joystick.x, leftTrackedRemoteState_new.Joystick.y, controllerYawHeading, v);
|
||||
rotateAboutOrigin(leftTrackedRemoteState_new.Joystick.x, leftTrackedRemoteState_new.Joystick.y, cl_walkdirection.integer == 1 ? hmdYawHeading : controllerYawHeading, v);
|
||||
remote_movementSideways = v[0];
|
||||
remote_movementForward = v[1];
|
||||
|
||||
|
|
|
@ -56,5 +56,6 @@ bind MOUSE3 "+mlook"
|
|||
"fov" "100"
|
||||
"sensitivity" "4"
|
||||
"snd_speed" "44100"
|
||||
"cl_weapon_offset_ud" "0.1"
|
||||
"cl_weapon_offset_lr" "0.0"
|
||||
"cl_weapon_offset_fb" "0.16"
|
||||
|
|
Loading…
Reference in a new issue