Merge branch 'pr/51'

This commit is contained in:
Simon 2022-04-06 22:31:53 +01:00
commit c5bcec3e05
7 changed files with 101 additions and 27 deletions

View file

@ -91,7 +91,7 @@ static void Controls3_SetMenuItems( void ) {
s_controls3.righthanded.curvalue = trap_Cvar_VariableValue( "vr_righthanded" ) != 0;
s_controls3.weaponpitch.curvalue = trap_Cvar_VariableValue( "vr_weaponPitch" ) + 25;
s_controls3.weaponselectormode.curvalue = (int)trap_Cvar_VariableValue( "vr_weaponSelectorMode" ) % 2;
s_controls3.controlschema.curvalue = (int)trap_Cvar_VariableValue( "vr_controlSchema" ) % 2;
s_controls3.controlschema.curvalue = (int)trap_Cvar_VariableValue( "vr_controlSchema" ) % 3;
s_controls3.switchthumbsticks.curvalue = trap_Cvar_VariableValue( "vr_switchThumbsticks" ) != 0;
}
@ -137,16 +137,16 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
case ID_UTURN:
{
if (s_controls3.uturn.curvalue) {
if (s_controls3.controlschema.curvalue == 0) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn");
} else {
if (s_controls3.controlschema.curvalue == 1) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "uturn");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn");
}
} else {
if (s_controls3.controlschema.curvalue == 0) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "");
if (s_controls3.controlschema.curvalue == 1) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "");
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "weapprev");
}
}
}
@ -157,7 +157,7 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
{
switch (s_controls3.controlschema.curvalue)
{
case 0: // Default schema
case 0: // Default schema (weapon wheel on grip)
trap_Cvar_Set("vr_button_map_RTHUMBLEFT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "weapnext"); // next weapon
@ -181,8 +181,7 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", ""); // unmapped
break;
default: // Now we have only two schemas
// All directions as weapon select (useful for HMD wheel)
case 1: // Weapon wheel on thumbstick - all directions as weapon select (useful for HMD wheel)
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "+weapon_select");
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT", "+weapon_select");
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "+weapon_select");
@ -206,6 +205,30 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT_ALT", "blank"); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", "blank"); // unmapped
break;
default: // Weapon wheel disabled - only prev/next weapon switch is active
trap_Cvar_Set("vr_button_map_RTHUMBLEFT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "weapnext"); // next weapon
if (s_controls3.uturn.curvalue) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn"); // u-turn
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "weapprev"); // previous weapon
}
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", ""); // unmapped
trap_Cvar_Set("vr_button_map_PRIMARYTHUMBSTICK", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKRIGHT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBLEFT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", ""); // unmapped
break;
}
}
trap_Cvar_SetValue( "vr_controlSchema", s_controls3.controlschema.curvalue );
@ -250,6 +273,7 @@ static void Controls3_MenuInit( void ) {
{
"Weapon Wheel on Grip",
"Weapon Wheel on Thumbstick",
"Weapon Wheel Disabled",
NULL
};
@ -390,7 +414,7 @@ static void Controls3_MenuInit( void ) {
s_controls3.controlschema.generic.callback = Controls3_MenuEvent;
s_controls3.controlschema.generic.id = ID_CONTROLSCHEMA;
s_controls3.controlschema.itemnames = s_controlschema;
s_controls3.controlschema.numitems = 2;
s_controls3.controlschema.numitems = 3;
s_controls3.back.generic.type = MTYPE_BITMAP;
s_controls3.back.generic.name = ART_BACK0;

View file

@ -3174,7 +3174,7 @@ static void UI_Update(const char *name) {
qboolean uturn = trap_Cvar_VariableValue( "vr_uturn" ) != 0;
switch (val)
{
case 0: // Default schema
case 0: // Default schema (weapon wheel on grip)
trap_Cvar_Set("vr_button_map_RTHUMBLEFT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "weapnext"); // next weapon
@ -3198,8 +3198,7 @@ static void UI_Update(const char *name) {
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", ""); // unmapped
break;
default: // Now we have only two schemas
// All directions as weapon select (useful for HMD wheel)
case 1: // Weapon wheel on thumbstick - all directions as weapon select (useful for HMD wheel)
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "+weapon_select");
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT", "+weapon_select");
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "+weapon_select");
@ -3223,20 +3222,44 @@ static void UI_Update(const char *name) {
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT_ALT", "blank"); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", "blank"); // unmapped
break;
default: // Weapon wheel disabled - only prev/next weapon switch is active
trap_Cvar_Set("vr_button_map_RTHUMBLEFT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", "weapnext"); // next weapon
if (uturn) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn"); // u-turn
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "weapprev"); // previous weapon
}
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", ""); // unmapped
trap_Cvar_Set("vr_button_map_PRIMARYTHUMBSTICK", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKRIGHT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKRIGHT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBBACKLEFT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBLEFT_ALT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT", ""); // unmapped
trap_Cvar_Set("vr_button_map_RTHUMBFORWARDLEFT_ALT", ""); // unmapped
break;
}
} else if (Q_stricmp(name, "vr_uturn") == 0) {
int controlSchema = (int)trap_Cvar_VariableValue( "vr_controlSchema" ) % 2;
int controlSchema = (int)trap_Cvar_VariableValue( "vr_controlSchema" ) % 3;
if (val) {
if (controlSchema == 0) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn");
} else {
if (controlSchema == 1) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "uturn");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "uturn");
}
} else {
if (controlSchema == 0) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "");
if (controlSchema == 1) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "");
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "weapprev");
}
}
} else if (Q_stricmp(name, "vr_goreLevel") == 0) {

View file

@ -110,8 +110,9 @@ void VR_InitCvars( void )
Cvar_Get ("vr_uturn", "0", CVAR_ARCHIVE);
Cvar_Get ("vr_controlSchema", "0", CVAR_ARCHIVE);
qboolean uturnEnabled = Cvar_VariableValue( "vr_uturn" ) != 0;
int controlSchema = (int)Cvar_VariableValue( "vr_controlSchema" ) % 2;
int controlSchema = (int)Cvar_VariableValue( "vr_controlSchema" ) % 3;
if (controlSchema == 0) {
// Default schema (weapon wheel on grip)
Cvar_Get ("vr_button_map_RTHUMBLEFT", "turnleft", CVAR_ARCHIVE); // turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT", "turnright", CVAR_ARCHIVE); // turn right
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "weapnext", CVAR_ARCHIVE); // next weapon
@ -134,8 +135,8 @@ void VR_InitCvars( void )
Cvar_Get ("vr_button_map_RTHUMBLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
} else {
// All directions as weapon select (useful for HMD wheel)
} else if (controlSchema == 1) {
// Weapon wheel on thumbstick - all directions as weapon select (useful for HMD wheel)
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "+weapon_select", CVAR_ARCHIVE);
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT", "+weapon_select", CVAR_ARCHIVE);
Cvar_Get ("vr_button_map_RTHUMBRIGHT", "+weapon_select", CVAR_ARCHIVE);
@ -158,6 +159,30 @@ void VR_InitCvars( void )
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT_ALT", "blank", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT_ALT", "blank", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "blank", CVAR_ARCHIVE); // unmapped
} else {
// Weapon wheel disabled - only prev/next weapon switch is active
Cvar_Get ("vr_button_map_RTHUMBLEFT", "turnleft", CVAR_ARCHIVE); // turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT", "turnright", CVAR_ARCHIVE); // turn right
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "weapnext", CVAR_ARCHIVE); // next weapon
if (uturnEnabled) {
Cvar_Get ("vr_button_map_RTHUMBBACK", "uturn", CVAR_ARCHIVE); // u-turn
} else {
Cvar_Get ("vr_button_map_RTHUMBBACK", "weapprev", CVAR_ARCHIVE); // previous weapon
}
Cvar_Get ("vr_button_map_PRIMARYGRIP", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKRIGHT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBBACKLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT", "", CVAR_ARCHIVE); // unmapped
Cvar_Get ("vr_button_map_RTHUMBFORWARDLEFT_ALT", "", CVAR_ARCHIVE); // unmapped
}
//Remaining button mapping (buttons not affected by schemas)

View file

@ -567,7 +567,9 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
//forward/back
Com_QueueEvent(in_vrEventTime, SE_JOYSTICK_AXIS, 1, joystick[1] * 127.0f + positional[1] * 127.0f, 0, NULL);
}
else if (!vr.weapon_select) //right controller
// In case weapon wheel is opened, and is in HMD/thumbstick mode or was opened by thumbstick, ignore standard thumbstick inputs
// In case weapon wheel is in controller mode and is opened by grip, allow use use of thumbstick e.g. to not block turning while wheel is open
else if (!vr.weapon_select || ((int)Cvar_VariableValue("vr_weaponSelectorMode") == WS_CONTROLLER && !vr.weapon_select_autoclose))
{
float absoluteAxisValue = sqrt(joystickY*joystickY + joystickX*joystickX);

View file

@ -196,7 +196,7 @@ itemDef {
type ITEM_TYPE_MULTI
text "Control Schema:"
cvar "vr_controlSchema"
cvarFloatList { "Weapon Wheel on Grip" 0 "Weapon Wheel on Thumbstick" 1 }
cvarFloatList { "Weapon Wheel on Grip" 0 "Weapon Wheel on Thumbstick" 1 "Weapon Wheel Disabled" 2 }
rect 99 325 256 20
textalign ITEM_ALIGN_RIGHT
textalignx 100

View file

@ -318,7 +318,7 @@ itemDef {
type ITEM_TYPE_MULTI
text "Control Schema:"
cvar "vr_controlSchema"
cvarFloatList { "Weapon Wheel on Grip" 0 "Weapon Wheel on Thumbstick" 1 }
cvarFloatList { "Weapon Wheel on Grip" 0 "Weapon Wheel on Thumbstick" 1 "Weapon Wheel Disabled" 2 }
rect 30 200 200 20
textalign ITEM_ALIGN_RIGHT
textalignx 143