mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 13:31:03 +00:00
Turn Saber on/off right trigger
This commit is contained in:
parent
f73fbfa451
commit
d0185c169c
3 changed files with 28 additions and 8 deletions
|
@ -156,15 +156,15 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
bool offhandGripPushed = (pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger);
|
bool offhandGripPushed = (pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger);
|
||||||
if ( (offhandGripPushed != (pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) &&
|
if ( (offhandGripPushed != (pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) &&
|
||||||
offhandGripPushed && (distance < STABILISATION_DISTANCE))
|
offhandGripPushed && (distance < STABILISATION_DISTANCE))
|
||||||
//#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
{
|
{
|
||||||
stabilised = qtrue;
|
stabilised = qtrue;
|
||||||
}
|
}
|
||||||
//#else
|
#else
|
||||||
// {
|
{
|
||||||
// Cvar_Set("vr_control_scheme", "99");
|
Cvar_Set("vr_control_scheme", "99");
|
||||||
// }
|
}
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
dominantGripPushed = (pDominantTrackedRemoteNew->Buttons &
|
dominantGripPushed = (pDominantTrackedRemoteNew->Buttons &
|
||||||
ovrButton_GripTrigger) != 0;
|
ovrButton_GripTrigger) != 0;
|
||||||
|
@ -559,10 +559,10 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
|
|
||||||
static bool firing = false;
|
static bool firing = false;
|
||||||
|
|
||||||
|
if (!vr.velocitytriggered) // Don't fire velocity triggered weapons
|
||||||
{
|
{
|
||||||
//Fire Primary - Doesn't trigger the saber
|
//Fire Primary - Doesn't trigger the saber
|
||||||
if (!vr.velocitytriggered && // Don't fire velocity triggered weapons
|
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||||
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
|
||||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||||
|
|
||||||
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack",
|
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack",
|
||||||
|
@ -571,6 +571,15 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
sendButtonAction("+attack", firing);
|
sendButtonAction("+attack", firing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (vr.weaponid == WP_SABER)
|
||||||
|
{
|
||||||
|
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||||
|
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||||
|
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||||
|
sendButtonActionSimple("togglesaber");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Duck - off hand joystick
|
//Duck - off hand joystick
|
||||||
|
|
|
@ -210,6 +210,7 @@ int cmdcmp( const void *a, const void *b ) {
|
||||||
void CG_ItemSelectorSelect_f( void );
|
void CG_ItemSelectorSelect_f( void );
|
||||||
void CG_ItemSelectorNext_f( void );
|
void CG_ItemSelectorNext_f( void );
|
||||||
void CG_ItemSelectorPrev_f( void );
|
void CG_ItemSelectorPrev_f( void );
|
||||||
|
void CG_ToggleSaber_f( void );
|
||||||
|
|
||||||
/* This array MUST be sorted correctly by alphabetical name field */
|
/* This array MUST be sorted correctly by alphabetical name field */
|
||||||
static consoleCommand_t commands[] = {
|
static consoleCommand_t commands[] = {
|
||||||
|
@ -251,6 +252,7 @@ static consoleCommand_t commands[] = {
|
||||||
{ "itemselectorselect", CG_ItemSelectorSelect_f },
|
{ "itemselectorselect", CG_ItemSelectorSelect_f },
|
||||||
{ "itemselectornext", CG_ItemSelectorNext_f },
|
{ "itemselectornext", CG_ItemSelectorNext_f },
|
||||||
{ "itemselectorprev", CG_ItemSelectorPrev_f },
|
{ "itemselectorprev", CG_ItemSelectorPrev_f },
|
||||||
|
{ "togglesaber", CG_ToggleSaber_f },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const size_t numCommands = ARRAY_LEN( commands );
|
static const size_t numCommands = ARRAY_LEN( commands );
|
||||||
|
|
|
@ -2650,6 +2650,15 @@ void CG_Weapon_f( void )
|
||||||
|
|
||||||
void Cmd_UseInventory_f(gentity_t *ent);
|
void Cmd_UseInventory_f(gentity_t *ent);
|
||||||
|
|
||||||
|
void CG_ToggleSaber_f( )
|
||||||
|
{
|
||||||
|
player->client->ps.saberActive = (qboolean)!player->client->ps.saberActive;
|
||||||
|
if (!player->client->ps.saberActive)
|
||||||
|
{
|
||||||
|
G_SoundOnEnt( player, CHAN_WEAPON, "sound/weapons/saber/saberoff.wav" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Selects the currently selected thing (if one _is_ selected)
|
//Selects the currently selected thing (if one _is_ selected)
|
||||||
void CG_ItemSelectorSelect_f( void )
|
void CG_ItemSelectorSelect_f( void )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue