Enable prev/next weapon switch only if weapon wheel is disabled

This commit is contained in:
Petr Bartos 2022-04-12 22:34:42 +02:00
parent cca1c051f1
commit 95736ffef9
3 changed files with 20 additions and 16 deletions

View file

@ -144,9 +144,11 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
}
} else {
if (s_controls3.controlschema.curvalue == 1) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "blank");
} else if (s_controls3.controlschema.curvalue == 2) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "weapprev");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "blank");
}
}
}
@ -160,11 +162,11 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
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
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", ""); // unmapped
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_RTHUMBBACK", ""); // unmapped
}
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", "+weapon_select"); // weapon selector
trap_Cvar_Set("vr_button_map_PRIMARYTHUMBSTICK", ""); // unmapped
@ -182,11 +184,11 @@ static void Controls3_MenuEvent( void* ptr, int notification ) {
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", "+alt"); // switch to alt layout
trap_Cvar_Set("vr_button_map_RTHUMBLEFT_ALT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT_ALT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", "weapnext");
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", "blank");
if (s_controls3.uturn.curvalue) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "uturn");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "blank");
}
break;
default: // Weapon wheel disabled - only prev/next weapon switch is active

View file

@ -3177,11 +3177,11 @@ static void UI_Update(const char *name) {
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
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD", ""); // unmapped
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_RTHUMBBACK", ""); // unmapped
}
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", "+weapon_select"); // weapon selector
trap_Cvar_Set("vr_button_map_PRIMARYTHUMBSTICK", ""); // unmapped
@ -3199,11 +3199,11 @@ static void UI_Update(const char *name) {
trap_Cvar_Set("vr_button_map_PRIMARYGRIP", "+alt"); // switch to alt layout
trap_Cvar_Set("vr_button_map_RTHUMBLEFT_ALT", "turnleft"); // turn left
trap_Cvar_Set("vr_button_map_RTHUMBRIGHT_ALT", "turnright"); // turn right
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", "weapnext");
trap_Cvar_Set("vr_button_map_RTHUMBFORWARD_ALT", "blank");
if (uturn) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "uturn");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "blank");
}
break;
default: // Weapon wheel disabled - only prev/next weapon switch is active
@ -3233,9 +3233,11 @@ static void UI_Update(const char *name) {
}
} else {
if (controlSchema == 1) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "weapprev");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK_ALT", "blank");
} else if (controlSchema == 2) {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "weapprev");
} else {
trap_Cvar_Set("vr_button_map_RTHUMBBACK", "");
}
}
} else if (Q_stricmp(name, "vr_goreLevel") == 0) {

View file

@ -115,11 +115,11 @@ void VR_InitCvars( void )
// 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
Cvar_Get ("vr_button_map_RTHUMBFORWARD", "", CVAR_ARCHIVE); // unmapped
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_RTHUMBBACK", "", CVAR_ARCHIVE); // unmapped
}
Cvar_Get ("vr_button_map_PRIMARYGRIP", "+weapon_select", CVAR_ARCHIVE); // weapon selector
Cvar_Get ("vr_button_map_PRIMARYTHUMBSTICK", "", CVAR_ARCHIVE); // unmapped
@ -137,11 +137,11 @@ void VR_InitCvars( void )
Cvar_Get ("vr_button_map_PRIMARYGRIP", "+alt", CVAR_ARCHIVE); // switch to alt layout
Cvar_Get ("vr_button_map_RTHUMBLEFT_ALT", "turnleft", CVAR_ARCHIVE); // turn left
Cvar_Get ("vr_button_map_RTHUMBRIGHT_ALT", "turnright", CVAR_ARCHIVE); // turn right
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "weapnext", CVAR_ARCHIVE);
Cvar_Get ("vr_button_map_RTHUMBFORWARD_ALT", "blank", CVAR_ARCHIVE);
if (uturnEnabled) {
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "uturn", CVAR_ARCHIVE);
} else {
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "weapprev", CVAR_ARCHIVE);
Cvar_Get ("vr_button_map_RTHUMBBACK_ALT", "blank", CVAR_ARCHIVE);
}
} else {
// Weapon wheel disabled - only prev/next weapon switch is active