mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-25 05:21:00 +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,23 +827,19 @@ 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,12 +3454,39 @@ 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)
|
||||||
|
{
|
||||||
|
if (vr->primaryVelocityTriggeredAttack && vr->secondaryVelocityTriggeredAttack)
|
||||||
|
{
|
||||||
|
position = 4;
|
||||||
|
}
|
||||||
|
else if (vr->primaryVelocityTriggeredAttack)
|
||||||
|
{
|
||||||
|
position = (vr->right_handed ? 2 : 1);
|
||||||
|
}
|
||||||
|
else if (vr->secondaryVelocityTriggeredAttack) // secondary triggered
|
||||||
|
{
|
||||||
|
position = (vr->right_handed ? 1 : 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
position = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
cgi_HapticEvent("chainsaw_fire", position, 0, 40, 0, 0);
|
||||||
break;
|
break;
|
||||||
case WP_BRYAR_PISTOL:
|
case WP_BRYAR_PISTOL:
|
||||||
|
|
|
@ -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