diff --git a/Projects/Android/jni/JKVR/VrInputDefault.cpp b/Projects/Android/jni/JKVR/VrInputDefault.cpp index a9409fd..2587f07 100644 --- a/Projects/Android/jni/JKVR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKVR/VrInputDefault.cpp @@ -156,15 +156,15 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG bool offhandGripPushed = (pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger); if ( (offhandGripPushed != (pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) && offhandGripPushed && (distance < STABILISATION_DISTANCE)) -//#ifndef DEBUG +#ifndef DEBUG { stabilised = qtrue; } -//#else -// { -// Cvar_Set("vr_control_scheme", "99"); -// } -//#endif +#else + { + Cvar_Set("vr_control_scheme", "99"); + } +#endif dominantGripPushed = (pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0; @@ -559,10 +559,10 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG static bool firing = false; + if (!vr.velocitytriggered) // Don't fire velocity triggered weapons { //Fire Primary - Doesn't trigger the saber - if (!vr.velocitytriggered && // Don't fire velocity triggered weapons - (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != + if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != (pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) { ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack", @@ -571,6 +571,15 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG 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 diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp index 8f50936..91b63c4 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_consolecmds.cpp @@ -210,6 +210,7 @@ int cmdcmp( const void *a, const void *b ) { void CG_ItemSelectorSelect_f( void ); void CG_ItemSelectorNext_f( void ); void CG_ItemSelectorPrev_f( void ); +void CG_ToggleSaber_f( void ); /* This array MUST be sorted correctly by alphabetical name field */ static consoleCommand_t commands[] = { @@ -251,6 +252,7 @@ static consoleCommand_t commands[] = { { "itemselectorselect", CG_ItemSelectorSelect_f }, { "itemselectornext", CG_ItemSelectorNext_f }, { "itemselectorprev", CG_ItemSelectorPrev_f }, + { "togglesaber", CG_ToggleSaber_f }, }; static const size_t numCommands = ARRAY_LEN( commands ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index cb2be7a..98fd2aa 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -2650,6 +2650,15 @@ void CG_Weapon_f( void ) 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) void CG_ItemSelectorSelect_f( void ) {