Added cvar to switch sticks

Particularly useful for left handed players who favour right handed stick configuration
Added the Venom mod scripting update pak to the assets (thanks _HELLBARON_!)
This commit is contained in:
Simon 2020-08-16 18:31:46 +01:00
parent b3d7586f76
commit 8d54ccd46e
11 changed files with 88 additions and 31 deletions

1
.gitignore vendored
View file

@ -52,3 +52,4 @@ VrSamples-Quake2Quest.iml
assets/pak0.pk3
assets/sp_pak_weapons.pk3
assets/z_zvr_weapons.pk3
assets/sp_vpak8.pk3

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.rtcwquest"
android:versionCode="34"
android:versionName="0.27.0" android:installLocation="auto" >
android:versionCode="35"
android:versionName="0.28.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -1302,6 +1302,7 @@ void RTCWVR_Init()
//Defaults
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
vr_switch_sticks = Cvar_Get( "vr_switch_sticks", "0", CVAR_ARCHIVE);
//Set up vr client info
vr.backpackitemactive = 0;

View file

@ -8,3 +8,4 @@ cvar_t *vr_weapon_pitchadjust;
cvar_t *vr_lasersight;
cvar_t *vr_control_scheme;
cvar_t *vr_teleport;
cvar_t *vr_switch_sticks;

View file

@ -18,6 +18,7 @@ Authors : Simon Brown
#include "VrCvars.h"
#include "../rtcw/src/client/client.h"
#include "../../../../../../VrApi/Include/VrApi_Input.h"
#define WP_AKIMBO 20
@ -51,6 +52,21 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
pOff = pDominantTracking;
}
ovrVector2f *pPrimaryJoystick;
ovrVector2f *pSecondaryJoystick;
if (vr_switch_sticks->integer)
{
pSecondaryJoystick = &pDominantTrackedRemoteNew->Joystick;
pPrimaryJoystick = &pOffTrackedRemoteNew->Joystick;
}
else
{
pPrimaryJoystick = &pDominantTrackedRemoteNew->Joystick;
pSecondaryJoystick = &pOffTrackedRemoteNew->Joystick;
}
{
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
vec3_t rotation = {0};
@ -442,12 +458,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Weapon/Inventory Chooser
static qboolean itemSwitched = false;
if (between(-0.2f, pDominantTrackedRemoteNew->Joystick.x, 0.2f) &&
(between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f) ||
between(-1.0f, pDominantTrackedRemoteNew->Joystick.y, -0.8f)))
if (between(-0.2f, pPrimaryJoystick->x, 0.2f) &&
(between(0.8f, pPrimaryJoystick->y, 1.0f) ||
between(-1.0f, pPrimaryJoystick->y, -0.8f)))
{
if (!itemSwitched) {
if (between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f))
if (between(0.8f, pPrimaryJoystick->y, 1.0f))
{
sendButtonActionSimple("weapprev");
}
@ -473,10 +489,10 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
//Apply a filter and quadratic scaler so small movements are easier to make
float dist = length(pOffTrackedRemoteNew->Joystick.x, pOffTrackedRemoteNew->Joystick.y);
float dist = length(pSecondaryJoystick->x, pSecondaryJoystick->y);
float nlf = nonLinearFilter(dist);
float x = nlf * pOffTrackedRemoteNew->Joystick.x;
float y = nlf * pOffTrackedRemoteNew->Joystick.y;
float x = nlf * pSecondaryJoystick->x;
float y = nlf * pSecondaryJoystick->y;
vr.player_moving = (fabs(x) + fabs(y)) > 0.05f;
@ -570,7 +586,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//No snap turn when using mounted gun
static int increaseSnap = true;
if (!vr.mountedgun && !vr.scopeengaged) {
if (pDominantTrackedRemoteNew->Joystick.x > 0.7f) {
if (pPrimaryJoystick->x > 0.7f) {
if (increaseSnap) {
float turnAngle = vr_turn_mode->integer ? (vr_turn_angle->value / 9.0f) : vr_turn_angle->value;
snapTurn -= turnAngle;
@ -585,12 +601,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
RTCWVR_ResyncClientYawWithGameYaw();
}
} else if (pDominantTrackedRemoteNew->Joystick.x < 0.3f) {
} else if (pPrimaryJoystick->x < 0.3f) {
increaseSnap = true;
}
static int decreaseSnap = true;
if (pDominantTrackedRemoteNew->Joystick.x < -0.7f) {
if (pPrimaryJoystick->x < -0.7f) {
if (decreaseSnap) {
float turnAngle = vr_turn_mode->integer ? (vr_turn_angle->value / 9.0f) : vr_turn_angle->value;
@ -607,12 +623,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
RTCWVR_ResyncClientYawWithGameYaw();
}
} else if (pDominantTrackedRemoteNew->Joystick.x > -0.3f) {
} else if (pPrimaryJoystick->x > -0.3f) {
decreaseSnap = true;
}
}
else {
if (fabs(pDominantTrackedRemoteNew->Joystick.x) > 0.5f) {
if (fabs(pPrimaryJoystick->x) > 0.5f) {
if (increaseSnap)
{
RTCWVR_ResyncClientYawWithGameYaw();

View file

@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
#define Q3_VERSION "RTCWQuest 0.27.0 (Wolf 1.41)"
#define Q3_VERSION "RTCWQuest 0.28.0 (Wolf 1.41)"
// ver 1.0.0 - release
// ver 1.0.1 - post-release work
// ver 1.1.0 - patch 1 (12/12/01)

View file

@ -135,9 +135,9 @@ itemDef
itemDef {
name vr
group grpControls
text "Teleport: "
text "Switch Thumbsticks: "
type ITEM_TYPE_YESNO
cvar "vr_teleport"
cvar "vr_switch_sticks"
rect 82 45 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
@ -149,13 +149,31 @@ itemDef
visible 1
}
itemDef {
name vr
group grpControls
text "Teleport: "
type ITEM_TYPE_YESNO
cvar "vr_teleport"
rect 82 60 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
textscale .22
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .07
forecolor 1 1 1 1
visible 1
}
itemDef {
name vr
group grpControls
type ITEM_TYPE_YESNO
text "Laser Sight: "
cvar "vr_lasersight"
rect 82 60 290 12
rect 82 75 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -173,7 +191,7 @@ itemDef
type ITEM_TYPE_SLIDER
text "Height Adjust:"
cvarfloat "cg_heightAdjust" .0 .01 1
rect 82 75 290 12
rect 82 90 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -192,7 +210,7 @@ itemDef
type ITEM_TYPE_MULTI
cvar "vr_turn_mode"
cvarFloatList {"Snap Turn" 0 "Smooth Turn" 1 }
rect 82 90 290 12
rect 82 105 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -210,7 +228,7 @@ itemDef
type ITEM_TYPE_SLIDER
text "Turn Angle:"
cvarfloat "vr_turn_angle" .0 1 90
rect 82 105 290 12
rect 82 120 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -228,7 +246,7 @@ itemDef
type ITEM_TYPE_YESNO
text "Gaze Movement Direction: "
cvar "vr_walkdirection"
rect 82 120 290 12
rect 82 135 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -245,7 +263,7 @@ itemDef
type ITEM_TYPE_SLIDER
text "Movement Speed:"
cvarfloat "vr_movement_multiplier" .0 0.05 1.0
rect 82 135 290 12
rect 82 150 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10

View file

@ -109,9 +109,9 @@ itemDef
itemDef {
name ingame_vr
group grpControls
text "Teleport: "
text "Switch Thumbsticks: "
type ITEM_TYPE_YESNO
cvar "vr_teleport"
cvar "vr_switch_sticks"
rect 82 45 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
@ -123,13 +123,30 @@ itemDef
visible 1
}
itemDef {
name ingame_vr
group grpControls
text "Teleport: "
type ITEM_TYPE_YESNO
cvar "vr_teleport"
rect 82 60 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
textscale .22
style WINDOW_STYLE_FILLED
backcolor 1 1 1 .07
forecolor 1 1 1 1
visible 1
}
itemDef {
name ingame_vr
group grpControls
type ITEM_TYPE_YESNO
text "Laser Sight: "
cvar "vr_lasersight"
rect 82 60 290 12
rect 82 75 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -147,7 +164,7 @@ itemDef
type ITEM_TYPE_SLIDER
text "Height Adjust:"
cvarfloat "cg_heightAdjust" .0 .01 1
rect 82 75 290 12
rect 82 90 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -166,7 +183,7 @@ itemDef
type ITEM_TYPE_MULTI
cvar "vr_turn_mode"
cvarFloatList {"Snap Turn" 0 "Smooth Turn" 1 }
rect 82 90 290 12
rect 82 105 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -184,7 +201,7 @@ itemDef
type ITEM_TYPE_SLIDER
text "Turn Angle:"
cvarfloat "vr_turn_angle" .0 1 90
rect 82 105 290 12
rect 82 120 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -202,7 +219,7 @@ itemDef
type ITEM_TYPE_YESNO
text "Gaze Movement Direction: "
cvar "vr_walkdirection"
rect 82 120 290 12
rect 82 135 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10
@ -219,7 +236,7 @@ itemDef
type ITEM_TYPE_SLIDER
text "Movement Speed:"
cvarfloat "vr_movement_multiplier" .0 0.05 1.0
rect 82 135 290 12
rect 82 150 290 12
textalign ITEM_ALIGN_RIGHT
textalignx 142
textaligny 10

Binary file not shown.

View file

@ -173,6 +173,9 @@ import static android.system.Os.setenv;
//and the vr menu pk3
copy_asset("/sdcard/RTCWQuest/Main", "z_rtcwquest_vrmenu.pk3", true);
//and the venom scripting improvements pak (thank-you _HELLBARON_ !!)
copy_asset("/sdcard/RTCWQuest/Main", "sp_vpak8.pk3", false);
//Read these from a file and pass through
commandLineParams = new String("rtcw");