Weapon selector fixes

This commit is contained in:
Petr Bartos 2022-04-08 18:13:46 +02:00 committed by Simon
parent 4b3de1f360
commit 5cd7e2adeb
2 changed files with 10 additions and 2 deletions

View file

@ -1868,6 +1868,11 @@ void CG_DrawWeaponSelect( void ) {
return;
}
// don't display when weapon wheel is opened
if (vr->weapon_select) {
return;
}
color = CG_FadeColor( cg.weaponSelectTime, WEAPON_SELECT_TIME );
if ( !color ) {
return;
@ -2120,7 +2125,8 @@ void CG_DrawWeaponSelector( void )
float thumbstickAxisX = 0.0f;
float thumbstickAxisY = 0.0f;
float a = atan2(vr->thumbstick_location[thumb][0], vr->thumbstick_location[thumb][1]);
if (length(vr->thumbstick_location[thumb][0], vr->thumbstick_location[thumb][1]) > 0.95f)
float thumbstickValue = length(vr->thumbstick_location[thumb][0], vr->thumbstick_location[thumb][1]);
if (thumbstickValue > 0.95f)
{
thumbstickAxisX = sinf(a) * 0.95f;
thumbstickAxisY = cosf(a) * 0.95f;
@ -2390,12 +2396,13 @@ void CG_DrawWeaponSelector( void )
// In case was invoked by thumbstick axis and thumbstick is centered
// select weapon (if any selected) and close the selector
if (vr->weapon_select_autoclose && frac > 0.25f) {
if (thumbstickAxisX > -0.1f && thumbstickAxisX < 0.1f && thumbstickAxisY > -0.1f && thumbstickAxisY < 0.1f) {
if (thumbstickValue < 0.1f) {
if (selected) {
cg.weaponSelect = cg.weaponSelectorSelection;
}
vr->weapon_select = qfalse;
vr->weapon_select_autoclose = qfalse;
vr->weapon_select_using_thumbstick = qfalse;
}
}
}

View file

@ -24,6 +24,7 @@ typedef struct {
vrFollowMode_t follow_mode;
qboolean weapon_select;
qboolean weapon_select_autoclose;
qboolean weapon_select_using_thumbstick;
qboolean no_crosshair;
int realign; // used to realign the fake 6DoF playspace in a multiplayer game