mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 14:01:26 +00:00
Several fixes..
- Proper button remapping - Can be configured in autoeec.cfg - Ability to remap all button functions (including forward/back on R stick) - Ability to define an alt-key so that all buttons can have two seperate functions - Slight reduction to SS value to boost perf by maybe a frame or two per secone - set Master 1 to be called "Quake3Quest Master" - QoL tweaks to the VR Options menu
This commit is contained in:
parent
993eada4ee
commit
1dd4b9ab18
9 changed files with 324 additions and 123 deletions
|
@ -2,8 +2,8 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.ioq3quest"
|
||||
android:installLocation="preferExternal"
|
||||
android:versionCode="22"
|
||||
android:versionName="0.15.0">
|
||||
android:versionCode="23"
|
||||
android:versionName="0.16.0">
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
||||
<uses-feature android:glEsVersion="0x00030001" />
|
||||
<!-- <uses-feature android:name="oculus.software.overlay_keyboard" android:required="false"/>-->
|
||||
|
|
|
@ -12,4 +12,31 @@ set cg_bobpitch 0
|
|||
set cg_bobroll 0
|
||||
set cg_weaponbob 0
|
||||
set sv_pure 0
|
||||
set sv_master2 "13.36.227.32:27950"
|
||||
set sv_master1 "13.36.227.32:27950"
|
||||
|
||||
//VR Button mappings
|
||||
set vr_button_map_A "+moveup"
|
||||
set vr_button_map_A_ALT ""
|
||||
set vr_button_map_B "+movedown"
|
||||
set vr_button_map_B_ALT ""
|
||||
set vr_button_map_X "+button2"
|
||||
set vr_button_map_X_ALT ""
|
||||
set vr_button_map_Y "+button3"
|
||||
set vr_button_map_Y_ALT ""
|
||||
set vr_button_map_SECONDARYTHUMBSTICK "+scores"
|
||||
set vr_button_map_SECONDARYTHUMBSTICK_ALT ""
|
||||
set vr_button_map_PRIMARYTHUMBSTICK ""
|
||||
set vr_button_map_PRIMARYTHUMBSTICK_ALT "weapon 1"
|
||||
set vr_button_map_RTHUMBFORWARD "weapnext"
|
||||
set vr_button_map_RTHUMBFORWARD_ALT ""
|
||||
set vr_button_map_RTHUMBBACK "weapprev"
|
||||
set vr_button_map_RTHUMBBACK_ALT ""
|
||||
set vr_button_map_SECONDARYTRIGGER "+moveup"
|
||||
set vr_button_map_SECONDARYTRIGGER_ALT ""
|
||||
set vr_button_map_PRIMARYTRIGGER "+attack"
|
||||
set vr_button_map_PRIMARYTRIGGER_ALT ""
|
||||
set vr_button_map_SECONDARYGRIP "+weapon_stabilise"
|
||||
set vr_button_map_SECONDARYGRIP_ALT ""
|
||||
set vr_button_map_PRIMARYGRIP "+alt"
|
||||
set vr_button_map_PRIMARYGRIP_ALT ""
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ MULTIPLAYER MENU (SERVER BROWSER)
|
|||
static const char *master_items[] = {
|
||||
"Local",
|
||||
"Internet",
|
||||
"Master1",
|
||||
"Quake3Quest Master",
|
||||
"Master2",
|
||||
"Master3",
|
||||
"Master4",
|
||||
|
|
|
@ -44,7 +44,6 @@ VR OPTIONS MENU
|
|||
#define ID_AUTOSWITCH 129
|
||||
#define ID_SNAPTURN 130
|
||||
#define ID_DIRECTIONMODE 131
|
||||
#define ID_JUMPTRIGGER 132
|
||||
#define ID_REFRESHRATE 133
|
||||
#define ID_WEAPONPITCH 134
|
||||
#define ID_HEIGHTADJUST 135
|
||||
|
@ -77,7 +76,6 @@ typedef struct {
|
|||
menuradiobutton_s autoswitch;
|
||||
menulist_s snapturn;
|
||||
menulist_s directionmode;
|
||||
menuradiobutton_s jumptrigger;
|
||||
menulist_s refreshrate;
|
||||
menuslider_s weaponpitch;
|
||||
menuslider_s heightadjust;
|
||||
|
@ -101,7 +99,6 @@ static void VR_SetMenuItems( void ) {
|
|||
s_VR.autoswitch.curvalue = trap_Cvar_VariableValue( "cg_autoswitch" ) != 0;
|
||||
s_VR.snapturn.curvalue = (int)trap_Cvar_VariableValue( "vr_snapturn" ) / 45;
|
||||
s_VR.directionmode.curvalue = (int)trap_Cvar_VariableValue( "vr_directionMode" ) % NUM_DIRECTIONMODE;
|
||||
s_VR.jumptrigger.curvalue = trap_Cvar_VariableValue( "vr_jumpTrigger" ) != 0;
|
||||
int refresh = (int)trap_Cvar_VariableValue( "vr_refreshrate" );
|
||||
switch (refresh)
|
||||
{
|
||||
|
@ -163,10 +160,6 @@ static void VR_Event( void* ptr, int notification ) {
|
|||
trap_Cvar_SetValue( "vr_directionMode", s_VR.directionmode.curvalue );
|
||||
break;
|
||||
|
||||
case ID_JUMPTRIGGER:
|
||||
trap_Cvar_SetValue( "vr_jumpTrigger", s_VR.jumptrigger.curvalue );
|
||||
break;
|
||||
|
||||
case ID_REFRESHRATE: {
|
||||
int refresh;
|
||||
switch (s_VR.refreshrate.curvalue) {
|
||||
|
@ -329,7 +322,7 @@ static void VR_MenuInit( void ) {
|
|||
s_VR.framer.width = 256;
|
||||
s_VR.framer.height = 334;
|
||||
|
||||
y = 144;
|
||||
y = 120;
|
||||
s_VR.drawhud.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_VR.drawhud.generic.name = "Draw HUD:";
|
||||
s_VR.drawhud.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
|
@ -389,15 +382,6 @@ static void VR_MenuInit( void ) {
|
|||
s_VR.directionmode.itemnames = s_directionmode;
|
||||
s_VR.directionmode.numitems = NUM_DIRECTIONMODE;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.jumptrigger.generic.type = MTYPE_RADIOBUTTON;
|
||||
s_VR.jumptrigger.generic.name = "Off-hand Trigger Jump:";
|
||||
s_VR.jumptrigger.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
s_VR.jumptrigger.generic.callback = VR_Event;
|
||||
s_VR.jumptrigger.generic.id = ID_JUMPTRIGGER;
|
||||
s_VR.jumptrigger.generic.x = VR_X_POS;
|
||||
s_VR.jumptrigger.generic.y = y;
|
||||
|
||||
y += BIGCHAR_HEIGHT;
|
||||
s_VR.refreshrate.generic.type = MTYPE_SPINCONTROL;
|
||||
s_VR.refreshrate.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||||
|
@ -511,7 +495,6 @@ static void VR_MenuInit( void ) {
|
|||
Menu_AddItem( &s_VR.menu, &s_VR.autoswitch );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.snapturn );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.directionmode );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.jumptrigger );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.refreshrate );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.weaponpitch );
|
||||
Menu_AddItem( &s_VR.menu, &s_VR.heightadjust );
|
||||
|
|
|
@ -52,7 +52,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define STEAMPATH_APPID "2200"
|
||||
#define GOGPATH_ID "1441704920"
|
||||
#define GAMENAME_FOR_MASTER "Quake3Arena"
|
||||
#define CINEMATICS_LOGO "idlogo.RoQ"
|
||||
// #define CINEMATICS_LOGO "idlogo.RoQ"
|
||||
#define CINEMATICS_INTRO "intro.RoQ"
|
||||
#define LEGACY_PROTOCOL
|
||||
#endif
|
||||
|
|
|
@ -672,9 +672,10 @@ void SV_Init (void)
|
|||
sv_allowDownload = Cvar_Get ("sv_allowDownload", "0", CVAR_SERVERINFO);
|
||||
Cvar_Get ("sv_dlURL", "", CVAR_SERVERINFO | CVAR_ARCHIVE);
|
||||
|
||||
sv_master[0] = Cvar_Get("sv_master1", MASTER_SERVER_NAME, 0);
|
||||
sv_master[1] = Cvar_Get("sv_master2", "master.ioquake3.org", 0);
|
||||
for(index = 2; index < MAX_MASTER_SERVERS; index++)
|
||||
sv_master[0] = Cvar_Get("sv_master1", "", 0); // This is set to our Q3Q master
|
||||
sv_master[1] = Cvar_Get("sv_master2", MASTER_SERVER_NAME, 0);
|
||||
sv_master[2] = Cvar_Get("sv_master3", "master.ioquake3.org", 0);
|
||||
for(index = 3; index < MAX_MASTER_SERVERS; index++)
|
||||
sv_master[index] = Cvar_Get(va("sv_master%d", index + 1), "", CVAR_ARCHIVE);
|
||||
|
||||
sv_reconnectlimit = Cvar_Get ("sv_reconnectlimit", "3", 0);
|
||||
|
|
|
@ -29,7 +29,6 @@ cvar_t *vr_weaponPitch = NULL;
|
|||
cvar_t *vr_twoHandedWeapons = NULL;
|
||||
cvar_t *vr_refreshrate = NULL;
|
||||
cvar_t *vr_weaponScope = NULL;
|
||||
cvar_t *vr_jumpTrigger = NULL;
|
||||
cvar_t *vr_rollWhenHit = NULL;
|
||||
cvar_t *vr_hudYOffset = NULL;
|
||||
|
||||
|
@ -62,7 +61,6 @@ void VR_InitCvars( void )
|
|||
vr_twoHandedWeapons = Cvar_Get ("vr_twoHandedWeapons", "1", CVAR_ARCHIVE);
|
||||
vr_refreshrate = Cvar_Get ("vr_refreshrate", "0", CVAR_ARCHIVE);
|
||||
vr_weaponScope = Cvar_Get ("vr_weaponScope", "1", CVAR_ARCHIVE);
|
||||
vr_jumpTrigger = Cvar_Get ("vr_jumpTrigger", "1", CVAR_ARCHIVE);
|
||||
vr_rollWhenHit = Cvar_Get ("vr_rollWhenHit", "0", CVAR_ARCHIVE);
|
||||
vr_hudYOffset = Cvar_Get ("vr_hudYOffset", "0", CVAR_ARCHIVE);
|
||||
|
||||
|
@ -83,6 +81,34 @@ void VR_InitCvars( void )
|
|||
Cvar_Get ("vr_weapon_adjustment_11", "0.8,-5.5,6,0,0,0,0", CVAR_ARCHIVE);
|
||||
Cvar_Get ("vr_weapon_adjustment_12", "0.8,-5.5,6,0,0,0,0", CVAR_ARCHIVE);
|
||||
|
||||
//Button remapping
|
||||
Cvar_Get ("vr_button_map_A", "+moveup", CVAR_ARCHIVE); // Jump
|
||||
Cvar_Get ("vr_button_map_A_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_B", "+movedown", CVAR_ARCHIVE); // Crouch
|
||||
Cvar_Get ("vr_button_map_B_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_X", "+button2", CVAR_ARCHIVE); // Use Item
|
||||
Cvar_Get ("vr_button_map_X_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_Y", "+button3", CVAR_ARCHIVE); // Gesture
|
||||
Cvar_Get ("vr_button_map_Y_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_SECONDARYTHUMBSTICK", "+scores", CVAR_ARCHIVE); // Scoreboard
|
||||
Cvar_Get ("vr_button_map_SECONDARYTHUMBSTICK_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK_ALT", "weapon 1", CVAR_ARCHIVE); // Switch to gauntlet
|
||||
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "weapnext", CVAR_ARCHIVE); //Next Weapon
|
||||
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_RTHUMBBACK", "weapprev", CVAR_ARCHIVE); // Previous Weapon
|
||||
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_SECONDARYTRIGGER", "+moveup", CVAR_ARCHIVE); // Also Jump
|
||||
Cvar_Get ("vr_button_map_SECONDARYTRIGGER_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_PRIMARYTRIGGER", "+attack", CVAR_ARCHIVE); // Fire
|
||||
Cvar_Get ("vr_button_map_PRIMARYTRIGGER_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
Cvar_Get ("vr_button_map_SECONDARYGRIP", "+weapon_stabilise", CVAR_ARCHIVE); // Weapon stabilisation
|
||||
Cvar_Get ("vr_button_map_SECONDARYGRIP_ALT", "", CVAR_ARCHIVE); // unmapped
|
||||
|
||||
// enables the alt mapping of a button
|
||||
Cvar_Get ("vr_button_map_PRIMARYGRIP", "+alt", CVAR_ARCHIVE);
|
||||
Cvar_Get ("vr_button_map_PRIMARYGRIP_ALT", "", CVAR_ARCHIVE);
|
||||
|
||||
}
|
||||
|
||||
void VR_Destroy( engine_t* engine )
|
||||
|
|
|
@ -71,11 +71,11 @@ extern cvar_t *vr_heightAdjust;
|
|||
extern cvar_t *vr_twoHandedWeapons;
|
||||
extern cvar_t *vr_refreshrate;
|
||||
extern cvar_t *vr_weaponScope;
|
||||
extern cvar_t *vr_jumpTrigger;
|
||||
|
||||
jclass callbackClass;
|
||||
jmethodID android_haptic_event;
|
||||
|
||||
qboolean alt_key_mode_active = qfalse;
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out)
|
||||
{
|
||||
|
@ -187,11 +187,65 @@ void QuatToYawPitchRoll(ovrQuatf q, vec3_t rotation, vec3_t out) {
|
|||
GetAnglesFromVectors(forwardNormal, rightNormal, upNormal, out);
|
||||
}
|
||||
|
||||
static void sendButtonActionSimple(const char* action)
|
||||
static void IN_SendButtonAction(const char* action, qboolean pressed)
|
||||
{
|
||||
char command[256];
|
||||
snprintf( command, sizeof( command ), "%s\n", action );
|
||||
Cbuf_AddText( command );
|
||||
if (action)
|
||||
{
|
||||
//handle our special actions first
|
||||
if (strcmp(action, "+alt") == 0)
|
||||
{
|
||||
alt_key_mode_active = pressed;
|
||||
}
|
||||
else if (strcmp(action, "+weapon_stabilise") == 0)
|
||||
{
|
||||
vr.weapon_stabilised = pressed;
|
||||
}
|
||||
else if (action[0] == '+')
|
||||
{
|
||||
char command[256];
|
||||
Com_sprintf(command, sizeof(command), "%s%s\n", pressed ? "+" : "-", action + 1);
|
||||
Cbuf_AddText(command);
|
||||
}
|
||||
else if (pressed)
|
||||
{
|
||||
char command[256];
|
||||
Com_sprintf(command, sizeof(command), "%s\n", action);
|
||||
Cbuf_AddText(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight )
|
||||
{
|
||||
engine_t* engine = VR_GetEngine();
|
||||
jstring StringArg1 = (*(engine->java.Env))->NewStringUTF(engine->java.Env, event);
|
||||
(*(engine->java.Env))->CallVoidMethod(engine->java.Env, engine->java.ActivityObject, android_haptic_event, StringArg1, position, flags, intensity, angle, yHeight);
|
||||
}
|
||||
|
||||
static qboolean IN_GetButtonAction(const char* button, char* action)
|
||||
{
|
||||
char cvarname[256];
|
||||
Com_sprintf(cvarname, 256, "vr_button_map_%s%s", button, alt_key_mode_active ? "_ALT" : "");
|
||||
char * val = Cvar_VariableString(cvarname);
|
||||
if (val && strlen(val) > 0)
|
||||
{
|
||||
Com_sprintf(action, 256, "%s", val);
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
//If we didn't find something for this button and the alt key is active, then see if the un-alt key has a function
|
||||
if (alt_key_mode_active)
|
||||
{
|
||||
Com_sprintf(cvarname, 256, "vr_button_map_%s", button);
|
||||
char * val = Cvar_VariableString(cvarname);
|
||||
if (val && strlen(val) > 0)
|
||||
{
|
||||
Com_sprintf(action, 256, "%s", val);
|
||||
return qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
static float length(float x, float y)
|
||||
|
@ -210,7 +264,6 @@ void IN_VRInit( void )
|
|||
|
||||
static void IN_VRController( qboolean isRightController, ovrTracking remoteTracking )
|
||||
{
|
||||
|
||||
if (isRightController == (vr_righthanded->integer != 0))
|
||||
{
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
|
@ -280,6 +333,7 @@ static void IN_VRController( qboolean isRightController, ovrTracking remoteTrack
|
|||
|
||||
static void IN_VRJoystick( qboolean isRightController, float joystickX, float joystickY )
|
||||
{
|
||||
char action[256];
|
||||
vrController_t* controller = isRightController == qtrue ? &rightController : &leftController;
|
||||
|
||||
if (vr.virtual_screen ||
|
||||
|
@ -367,20 +421,39 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
|||
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, 0, 0, NULL);
|
||||
}
|
||||
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_UP) && joystickY > pressedThreshold) {
|
||||
//Default up/down on right thumbstick is weapon switch
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_UP) && joystickY > pressedThreshold)
|
||||
{
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_UP;
|
||||
sendButtonActionSimple("weapnext");
|
||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_UP) &&
|
||||
joystickY < releasedThreshold) {
|
||||
if (IN_GetButtonAction("RTHUMBFORWARD", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
}
|
||||
else if ((controller->axisButtons & VR_TOUCH_AXIS_UP) &&
|
||||
joystickY < releasedThreshold)
|
||||
{
|
||||
if (IN_GetButtonAction("RTHUMBFORWARD", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_UP;
|
||||
}
|
||||
|
||||
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_DOWN) && joystickY < -pressedThreshold) {
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_DOWN;
|
||||
sendButtonActionSimple("weapprev");
|
||||
if (IN_GetButtonAction("RTHUMBBACK", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_DOWN) &&
|
||||
joystickY > -releasedThreshold) {
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_DOWN;
|
||||
if (IN_GetButtonAction("RTHUMBBACK", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -389,42 +462,81 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
|
|||
static void IN_VRTriggers( qboolean isRightController, float index ) {
|
||||
vrController_t* controller = isRightController == qtrue ? &rightController : &leftController;
|
||||
|
||||
if (isRightController == (vr_righthanded->integer != 0)) {
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) && index > pressedThreshold) {
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_MOUSE1, qtrue, 0, NULL);
|
||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) && index < releasedThreshold) {
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_MOUSE1, qfalse, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
//off hand trigger Jump as well - if configured
|
||||
if (vr_jumpTrigger->integer) {
|
||||
if (isRightController != (vr_righthanded->integer != 0)) {
|
||||
//Primary controller trigger is mouse click in screen mode or in intermission
|
||||
if (VR_useScreenLayer() || cl.snap.ps.pm_type == PM_INTERMISSION)
|
||||
{
|
||||
if (isRightController == (vr_righthanded->integer != 0))
|
||||
{
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index > pressedThreshold) {
|
||||
index > pressedThreshold)
|
||||
{
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qtrue, 0, NULL);
|
||||
} else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index < releasedThreshold) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_MOUSE1, qtrue, 0, NULL);
|
||||
}
|
||||
else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index < releasedThreshold)
|
||||
{
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qfalse, 0, NULL);
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_MOUSE1, qfalse, 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char action[256];
|
||||
|
||||
//Primary trigger
|
||||
if (isRightController == (vr_righthanded->integer != 0))
|
||||
{
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index > pressedThreshold)
|
||||
{
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
if (IN_GetButtonAction("PRIMARYTRIGGER", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
}
|
||||
else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index < releasedThreshold)
|
||||
{
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
if (IN_GetButtonAction("PRIMARYTRIGGER", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//off hand trigger
|
||||
if (isRightController != (vr_righthanded->integer != 0))
|
||||
{
|
||||
if (!(controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index > pressedThreshold)
|
||||
{
|
||||
controller->axisButtons |= VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
if (IN_GetButtonAction("SECONDARYTRIGGER", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
}
|
||||
else if ((controller->axisButtons & VR_TOUCH_AXIS_TRIGGER_INDEX) &&
|
||||
index < releasedThreshold)
|
||||
{
|
||||
controller->axisButtons &= ~VR_TOUCH_AXIS_TRIGGER_INDEX;
|
||||
if (IN_GetButtonAction("SECONDARYTRIGGER", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight )
|
||||
{
|
||||
engine_t* engine = VR_GetEngine();
|
||||
jstring StringArg1 = (*(engine->java.Env))->NewStringUTF(engine->java.Env, event);
|
||||
(*(engine->java.Env))->CallVoidMethod(engine->java.Env, engine->java.ActivityObject, android_haptic_event, StringArg1, position, flags, intensity, angle, yHeight);
|
||||
}
|
||||
|
||||
|
||||
static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
|
||||
{
|
||||
char action[256];
|
||||
|
||||
vrController_t* controller = isRightController == qtrue ? &rightController : &leftController;
|
||||
|
||||
{
|
||||
|
@ -435,77 +547,129 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
|
|||
}
|
||||
}
|
||||
|
||||
if (isRightController != (vr_righthanded->integer != 0))
|
||||
if (isRightController == !vr_righthanded->integer)
|
||||
{
|
||||
if ((buttons & ovrButton_GripTrigger) && !(controller->buttons & ovrButton_GripTrigger)) {
|
||||
vr.weapon_stabilised = qtrue;
|
||||
} else if (!(buttons & ovrButton_GripTrigger) && (controller->buttons & ovrButton_GripTrigger)) {
|
||||
vr.weapon_stabilised = qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
//Jump
|
||||
if ((buttons & ovrButton_A) && !(controller->buttons & ovrButton_A)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qtrue, 0, NULL);
|
||||
} else if (!(buttons & ovrButton_A) && (controller->buttons & ovrButton_A)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_SPACE, qfalse, 0, NULL);
|
||||
}
|
||||
|
||||
if ((buttons & ovrButton_B) && !(controller->buttons & ovrButton_B)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, 'c', qtrue, 0, NULL);
|
||||
} else if (!(buttons & ovrButton_B) && (controller->buttons & ovrButton_B)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, 'c', qfalse, 0, NULL);
|
||||
}
|
||||
|
||||
if (isRightController) {
|
||||
if (vr_righthanded->integer == 0) {
|
||||
//Right thumbstick is "use item"
|
||||
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ENTER, qtrue, 0, NULL);
|
||||
} else if (!(buttons & ovrButton_RThumb) && (controller->buttons & ovrButton_RThumb)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ENTER, qfalse, 0, NULL);
|
||||
if ((buttons & ovrButton_GripTrigger) && !(controller->buttons & ovrButton_GripTrigger))
|
||||
{
|
||||
if (IN_GetButtonAction("SECONDARYGRIP", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Right thumbstick is nothing
|
||||
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
|
||||
//
|
||||
} else if (!(buttons & ovrButton_RThumb) && (controller->buttons & ovrButton_RThumb)) {
|
||||
//
|
||||
else if (!(buttons & ovrButton_GripTrigger) &&
|
||||
(controller->buttons & ovrButton_GripTrigger))
|
||||
{
|
||||
if (IN_GetButtonAction("SECONDARYGRIP", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (vr_righthanded->integer == 0) {
|
||||
//left thumbstick is scoreboard
|
||||
if ((buttons & ovrButton_LThumb) && !(controller->buttons & ovrButton_LThumb)) {
|
||||
//
|
||||
} else if (!(buttons & ovrButton_LThumb) && (controller->buttons & ovrButton_LThumb)) {
|
||||
//
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((buttons & ovrButton_GripTrigger) && !(controller->buttons & ovrButton_GripTrigger))
|
||||
{
|
||||
if (IN_GetButtonAction("PRIMARYGRIP", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
} else {
|
||||
//left thumbstick is "use item"
|
||||
if ((buttons & ovrButton_LThumb) && !(controller->buttons & ovrButton_LThumb)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ENTER, qtrue, 0, NULL);
|
||||
} else if (!(buttons & ovrButton_LThumb) && (controller->buttons & ovrButton_LThumb)) {
|
||||
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ENTER, qfalse, 0, NULL);
|
||||
}
|
||||
else if (!(buttons & ovrButton_GripTrigger) &&
|
||||
(controller->buttons & ovrButton_GripTrigger))
|
||||
{
|
||||
if (IN_GetButtonAction("PRIMARYGRIP", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Taunt / Gesture
|
||||
|
||||
if (isRightController == !vr_righthanded->integer)
|
||||
{
|
||||
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
|
||||
if (IN_GetButtonAction("SECONDARYTHUMBSTICK", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
|
||||
vr.realign = 4;
|
||||
} else if (!(buttons & ovrButton_RThumb) && (controller->buttons & ovrButton_RThumb)) {
|
||||
if (IN_GetButtonAction("SECONDARYTHUMBSTICK", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
|
||||
if (IN_GetButtonAction("PRIMARYTHUMBSTICK", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
} else if (!(buttons & ovrButton_RThumb) && (controller->buttons & ovrButton_RThumb)) {
|
||||
if (IN_GetButtonAction("PRIMARYTHUMBSTICK", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Jump
|
||||
if ((buttons & ovrButton_A) && !(controller->buttons & ovrButton_A))
|
||||
{
|
||||
if (IN_GetButtonAction("A", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
}
|
||||
else if (!(buttons & ovrButton_A) && (controller->buttons & ovrButton_A))
|
||||
{
|
||||
if (IN_GetButtonAction("A", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
//Crouch
|
||||
if ((buttons & ovrButton_B) && !(controller->buttons & ovrButton_B)) {
|
||||
if (IN_GetButtonAction("B", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
} else if (!(buttons & ovrButton_B) && (controller->buttons & ovrButton_B)) {
|
||||
if (IN_GetButtonAction("B", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
//X default is "use item"
|
||||
if ((buttons & ovrButton_X) && !(controller->buttons & ovrButton_X)) {
|
||||
sendButtonActionSimple("+button3");
|
||||
if (IN_GetButtonAction("X", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
} else if (!(buttons & ovrButton_X) && (controller->buttons & ovrButton_X)) {
|
||||
sendButtonActionSimple("-button3");
|
||||
if (IN_GetButtonAction("X", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
// Y button - show scoreboard (and trigger realign just in case)
|
||||
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
|
||||
sendButtonActionSimple("+scores");
|
||||
vr.realign = 4;
|
||||
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
|
||||
sendButtonActionSimple("-scores");
|
||||
}
|
||||
//Y default is Gesture
|
||||
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
|
||||
if (IN_GetButtonAction("Y", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qtrue);
|
||||
}
|
||||
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
|
||||
if (IN_GetButtonAction("Y", action))
|
||||
{
|
||||
IN_SendButtonAction(action, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
controller->buttons = buttons;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <GLES3/gl32.h>
|
||||
#endif
|
||||
|
||||
#define SUPER_SAMPLE 1.2f
|
||||
#define SUPER_SAMPLE 1.15f
|
||||
|
||||
extern vr_clientinfo_t vr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue