mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 13:31:03 +00:00
Improved dual saber haptics
This commit is contained in:
parent
34bb30d714
commit
9202d2896e
6 changed files with 161 additions and 108 deletions
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.drbeef.jkxr"
|
package="com.drbeef.jkxr"
|
||||||
android:versionCode="51"
|
android:versionCode="52"
|
||||||
android:versionName="1.0.1" android:installLocation="auto" >
|
android:versionName="1.1.0" android:installLocation="auto" >
|
||||||
|
|
||||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||||
|
|
|
@ -504,10 +504,7 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f
|
||||||
|
|
||||||
//Controller Haptic Support
|
//Controller Haptic Support
|
||||||
int weaponFireChannel = vr.weapon_stabilised ? 3 : (vr_control_scheme->integer ? 2 : 1);
|
int weaponFireChannel = vr.weapon_stabilised ? 3 : (vr_control_scheme->integer ? 2 : 1);
|
||||||
if (cl.frame.ps.weapon == WP_SABER && vr.dualsabers)
|
|
||||||
{
|
|
||||||
weaponFireChannel = 3;
|
|
||||||
}
|
|
||||||
if (flags != 0)
|
if (flags != 0)
|
||||||
{
|
{
|
||||||
weaponFireChannel = flags;
|
weaponFireChannel = flags;
|
||||||
|
@ -530,8 +527,34 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f
|
||||||
{
|
{
|
||||||
TBXR_Vibrate(150, 3, fIntensity);
|
TBXR_Vibrate(150, 3, fIntensity);
|
||||||
}
|
}
|
||||||
else if (strcmp(event, "chainsaw_fire") == 0 ||
|
else if (strcmp(event, "chainsaw_fire") == 0) // Saber
|
||||||
strcmp(event, "RTCWQuest:fire_tesla") == 0)
|
{
|
||||||
|
//Special handling for dual sabers
|
||||||
|
if (vr.dualsabers)
|
||||||
|
{
|
||||||
|
if (position == 4 ||
|
||||||
|
position == 0) // both hands
|
||||||
|
{
|
||||||
|
weaponFireChannel = 3;
|
||||||
|
}
|
||||||
|
else if (position == 1) // left hand
|
||||||
|
{
|
||||||
|
weaponFireChannel = 2;
|
||||||
|
}
|
||||||
|
else if (position == 2) // right hand
|
||||||
|
{
|
||||||
|
weaponFireChannel = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//no longer need to trigger haptic
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TBXR_Vibrate(200, weaponFireChannel, fIntensity);
|
||||||
|
}
|
||||||
|
else if (strcmp(event, "RTCWQuest:fire_tesla") == 0) // Weapon power build up
|
||||||
{
|
{
|
||||||
TBXR_Vibrate(500, weaponFireChannel, fIntensity);
|
TBXR_Vibrate(500, weaponFireChannel, fIntensity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
vr_control_scheme->value == 99; // Always right-handed for weapon calibration
|
vr_control_scheme->value == 99; // Always right-handed for weapon calibration
|
||||||
|
|
||||||
static bool dominantGripPushed = false;
|
static bool dominantGripPushed = false;
|
||||||
static bool canUseBackpack = false;
|
|
||||||
static bool canUseQuickSave = false;
|
|
||||||
|
|
||||||
//Need this for the touch screen
|
//Need this for the touch screen
|
||||||
ovrTrackedController * pWeapon = pDominantTracking;
|
ovrTrackedController * pWeapon = pDominantTracking;
|
||||||
|
@ -829,22 +827,18 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
||||||
remote_movementForward);
|
remote_movementForward);
|
||||||
|
|
||||||
|
|
||||||
if (!canUseQuickSave) {
|
if (((secondaryButtonsNew & secondaryButton1) !=
|
||||||
if (((secondaryButtonsNew & secondaryButton1) !=
|
(secondaryButtonsOld & secondaryButton1)) &&
|
||||||
(secondaryButtonsOld & secondaryButton1)) &&
|
(secondaryButtonsNew & secondaryButton1)) {
|
||||||
(secondaryButtonsNew & secondaryButton1)) {
|
//Toggle walk/run somehow?!
|
||||||
//Toggle walk/run somehow?!
|
vr.move_speed = (++vr.move_speed) % 3;
|
||||||
vr.move_speed = (++vr.move_speed) % 3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Open the datapad
|
//Open the datapad
|
||||||
if (!canUseQuickSave) {
|
if (((secondaryButtonsNew & secondaryButton2) !=
|
||||||
if (((secondaryButtonsNew & secondaryButton2) !=
|
(secondaryButtonsOld & secondaryButton2)) &&
|
||||||
(secondaryButtonsOld & secondaryButton2)) &&
|
(secondaryButtonsNew & secondaryButton2)) {
|
||||||
(secondaryButtonsNew & secondaryButton2)) {
|
Sys_QueEvent(0, SE_KEY, A_TAB, true, 0, NULL);
|
||||||
Sys_QueEvent(0, SE_KEY, A_TAB, true, 0, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Use Force - off hand trigger
|
//Use Force - off hand trigger
|
||||||
|
|
|
@ -1460,8 +1460,8 @@ void CG_AddViewWeapon( playerState_t *ps )
|
||||||
val = 1.0f;
|
val = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 1 : 2);
|
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 2 : 1);
|
||||||
cgi_HapticEvent("chainsaw_fire", position, 0, 60 * val, 0, 0);
|
cgi_HapticEvent("RTCWQuest:fire_tesla", position, 0, 60 * val, 0, 0);
|
||||||
|
|
||||||
val += Q_flrand(0.0f, 1.0f) * 0.5f;
|
val += Q_flrand(0.0f, 1.0f) * 0.5f;
|
||||||
|
|
||||||
|
@ -3454,92 +3454,119 @@ void CG_FireWeapon( centity_t *cent, qboolean alt_fire )
|
||||||
//Are we the player?
|
//Are we the player?
|
||||||
if (cent->gent->client->ps.clientNum == 0)
|
if (cent->gent->client->ps.clientNum == 0)
|
||||||
{
|
{
|
||||||
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 1 : 2);
|
/*
|
||||||
|
These are specific to external haptics vest/arms/face combinations
|
||||||
|
position values:
|
||||||
|
0 - Will play on vest and both arms if pattern files present for both
|
||||||
|
1 - Will play on (left) vest and on left arm only if pattern files present for left
|
||||||
|
2 - Will play on (right) vest and on right arm only if pattern files present for right
|
||||||
|
3 - Will play on head only (if present)
|
||||||
|
4 - Will play on all devices (that have a pattern defined for them)
|
||||||
|
*/
|
||||||
|
int position = vr->weapon_stabilised ? 0 : (vr->right_handed ? 2 : 1);
|
||||||
|
|
||||||
//Haptics
|
//Haptics
|
||||||
switch (ent->weapon) {
|
switch (ent->weapon) {
|
||||||
case WP_SABER:
|
case WP_SABER:
|
||||||
if (cent->gent->client->ps.dualSabers) position = 4;
|
if (cent->gent->client->ps.dualSabers)
|
||||||
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
{
|
||||||
break;
|
if (vr->primaryVelocityTriggeredAttack && vr->secondaryVelocityTriggeredAttack)
|
||||||
case WP_BRYAR_PISTOL:
|
{
|
||||||
case WP_BOWCASTER:
|
position = 4;
|
||||||
case WP_BLASTER:
|
}
|
||||||
case WP_ATST_MAIN:
|
else if (vr->primaryVelocityTriggeredAttack)
|
||||||
cgi_HapticEvent("machinegun_fire", position, 0, (ent->weapon == WP_BRYAR_PISTOL) ? 60 : 100, 0, 0);
|
{
|
||||||
break;
|
position = (vr->right_handed ? 2 : 1);
|
||||||
case WP_BLASTER_PISTOL:
|
}
|
||||||
cgi_HapticEvent("shotgun_fire", position, 0, 100, 0, 0);
|
else if (vr->secondaryVelocityTriggeredAttack) // secondary triggered
|
||||||
break;
|
{
|
||||||
case WP_THERMAL:
|
position = (vr->right_handed ? 1 : 2);
|
||||||
case WP_DET_PACK:
|
}
|
||||||
case WP_TRIP_MINE:
|
else
|
||||||
cgi_HapticEvent("handgrenade_fire", position, 0, 80, 0, 0);
|
{
|
||||||
break;
|
position = -1;
|
||||||
case WP_ROCKET_LAUNCHER:
|
}
|
||||||
case WP_ATST_SIDE:
|
}
|
||||||
cgi_HapticEvent("rocket_fire", position, 0, 100, 0, 0);
|
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
||||||
break;
|
break;
|
||||||
case WP_DISRUPTOR:
|
case WP_BRYAR_PISTOL:
|
||||||
cgi_HapticEvent("RTCWQuest:fire_sniper", position, 0, 100, 0, 0);
|
case WP_BOWCASTER:
|
||||||
break;
|
case WP_BLASTER:
|
||||||
case WP_FLECHETTE:
|
case WP_ATST_MAIN:
|
||||||
case WP_REPEATER:
|
cgi_HapticEvent("machinegun_fire", position, 0, (ent->weapon == WP_BRYAR_PISTOL) ? 60 : 100, 0, 0);
|
||||||
cgi_HapticEvent("plasmagun_fire", position, 0, 100, 0, 0);
|
break;
|
||||||
break;
|
case WP_BLASTER_PISTOL:
|
||||||
case WP_DEMP2:
|
cgi_HapticEvent("shotgun_fire", position, 0, 100, 0, 0);
|
||||||
case WP_EMPLACED_GUN:
|
break;
|
||||||
cgi_HapticEvent("bfg_fire", position, 0, 100, 0, 0);
|
case WP_THERMAL:
|
||||||
break;
|
case WP_DET_PACK:
|
||||||
}
|
case WP_TRIP_MINE:
|
||||||
|
cgi_HapticEvent("handgrenade_fire", position, 0, 80, 0, 0);
|
||||||
|
break;
|
||||||
|
case WP_ROCKET_LAUNCHER:
|
||||||
|
case WP_ATST_SIDE:
|
||||||
|
cgi_HapticEvent("rocket_fire", position, 0, 100, 0, 0);
|
||||||
|
break;
|
||||||
|
case WP_DISRUPTOR:
|
||||||
|
cgi_HapticEvent("RTCWQuest:fire_sniper", position, 0, 100, 0, 0);
|
||||||
|
break;
|
||||||
|
case WP_FLECHETTE:
|
||||||
|
case WP_REPEATER:
|
||||||
|
cgi_HapticEvent("plasmagun_fire", position, 0, 100, 0, 0);
|
||||||
|
break;
|
||||||
|
case WP_DEMP2:
|
||||||
|
case WP_EMPLACED_GUN:
|
||||||
|
cgi_HapticEvent("bfg_fire", position, 0, 100, 0, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do overcharge sound that get's added to the top
|
// Do overcharge sound that get's added to the top
|
||||||
/* if (( ent->powerups & ( 1<<PW_WEAPON_OVERCHARGE )))
|
/* if (( ent->powerups & ( 1<<PW_WEAPON_OVERCHARGE )))
|
||||||
{
|
{
|
||||||
if ( alt_fire )
|
if ( alt_fire )
|
||||||
{
|
{
|
||||||
switch( ent->weapon )
|
switch( ent->weapon )
|
||||||
{
|
{
|
||||||
case WP_THERMAL:
|
case WP_THERMAL:
|
||||||
case WP_DET_PACK:
|
case WP_DET_PACK:
|
||||||
case WP_TRIP_MINE:
|
case WP_TRIP_MINE:
|
||||||
case WP_ROCKET_LAUNCHER:
|
case WP_ROCKET_LAUNCHER:
|
||||||
case WP_FLECHETTE:
|
case WP_FLECHETTE:
|
||||||
// these weapon fires don't overcharge
|
// these weapon fires don't overcharge
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WP_BLASTER:
|
case WP_BLASTER:
|
||||||
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeFastSound );
|
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeFastSound );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeSlowSound );
|
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeSlowSound );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( ent->weapon )
|
switch( ent->weapon )
|
||||||
{
|
{
|
||||||
case WP_THERMAL:
|
case WP_THERMAL:
|
||||||
case WP_DET_PACK:
|
case WP_DET_PACK:
|
||||||
case WP_TRIP_MINE:
|
case WP_TRIP_MINE:
|
||||||
case WP_ROCKET_LAUNCHER:
|
case WP_ROCKET_LAUNCHER:
|
||||||
// these weapon fires don't overcharge
|
// these weapon fires don't overcharge
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WP_REPEATER:
|
case WP_REPEATER:
|
||||||
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeFastSound );
|
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeFastSound );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeSlowSound );
|
cgi_S_StartSound( NULL, ent->number, CHAN_AUTO, cgs.media.overchargeSlowSound );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
// Current version of the single player game
|
// Current version of the single player game
|
||||||
#include "../win32/AutoVersion.h"
|
#include "../win32/AutoVersion.h"
|
||||||
|
|
||||||
#define JKXR_VERSION "1.0.1-ea"
|
#define JKXR_VERSION "1.1.0-ea"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION
|
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION
|
||||||
|
|
|
@ -1349,8 +1349,8 @@ void CG_AddViewWeapon( playerState_t *ps )
|
||||||
val = 1.0f;
|
val = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 1 : 2);
|
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 2 : 1);
|
||||||
cgi_HapticEvent("chainsaw_fire", position, 0, 60 * val, 0, 0);
|
cgi_HapticEvent("RTCWQuest:fire_tesla", position, 0, 60 * val, 0, 0);
|
||||||
|
|
||||||
val += Q_flrand(0.0f, 1.0f) * 0.5f;
|
val += Q_flrand(0.0f, 1.0f) * 0.5f;
|
||||||
|
|
||||||
|
@ -3295,7 +3295,16 @@ void CG_FireWeapon( centity_t *cent, qboolean alt_fire )
|
||||||
//Are we the player?
|
//Are we the player?
|
||||||
if (cent->gent->client->ps.clientNum == 0)
|
if (cent->gent->client->ps.clientNum == 0)
|
||||||
{
|
{
|
||||||
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 1 : 2);
|
/*
|
||||||
|
These are specific to external haptics vest/arms/face combinations
|
||||||
|
position values:
|
||||||
|
0 - Will play on vest and both arms if pattern files present for both
|
||||||
|
1 - Will play on (left) vest and on left arm only if pattern files present for left
|
||||||
|
2 - Will play on (right) vest and on right arm only if pattern files present for right
|
||||||
|
3 - Will play on head only (if present)
|
||||||
|
4 - Will play on all devices (that have a pattern defined for them)
|
||||||
|
*/
|
||||||
|
int position = vr->weapon_stabilised ? 4 : (vr->right_handed ? 2 : 1);
|
||||||
|
|
||||||
//Haptics
|
//Haptics
|
||||||
switch (ent->weapon) {
|
switch (ent->weapon) {
|
||||||
|
|
Loading…
Reference in a new issue