Fixes a problem with older thumbsticks misreporting the X value

This commit is contained in:
Simon 2022-09-04 14:32:02 +01:00
parent 97bf74cbe6
commit 88c4f85455
3 changed files with 15 additions and 7 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.doom3quest"
android:versionCode="26"
android:versionName="1.2.2"
android:versionCode="27"
android:versionName="1.2.3"
android:installLocation="auto">

View file

@ -525,11 +525,19 @@ void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGame
int vr_turn_mode = Android_GetCVarInteger("vr_turnmode");
float vr_turn_angle = Android_GetCVarInteger("vr_turnangle");
//This fixes a problem with older thumbsticks misreporting the X value
static float joyx[4] = {0};
for (int j = 3; j > 0; --j)
joyx[j] = joyx[j-1];
joyx[0] = pPrimaryJoystick->x;
float joystickX = (joyx[0] + joyx[1] + joyx[2] + joyx[3]) / 4.0f;
//No snap turn when using mounted gun
snapTurn = 0;
static int increaseSnap = true;
{
if (pPrimaryJoystick->x > 0.7f) {
if (joystickX > 0.7f) {
if (increaseSnap) {
float turnAngle = vr_turn_mode ? (vr_turn_angle / 9.0f) : vr_turn_angle;
snapTurn -= turnAngle;
@ -544,12 +552,12 @@ void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGame
} else {
snapTurn = 0;
}
} else if (pPrimaryJoystick->x < 0.3f) {
} else if (joystickX < 0.2f) {
increaseSnap = true;
}
static int decreaseSnap = true;
if (pPrimaryJoystick->x < -0.7f) {
if (joystickX < -0.7f) {
if (decreaseSnap) {
float turnAngle = vr_turn_mode ? (vr_turn_angle / 9.0f) : vr_turn_angle;
@ -567,7 +575,7 @@ void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGame
} else {
snapTurn = 0;
}
} else if (pPrimaryJoystick->x > -0.3f) {
} else if (joystickX > -0.2f) {
decreaseSnap = true;
}
}

View file

@ -41,7 +41,7 @@ If you have questions concerning this license or the applicable additional terms
#define GAME_NAME "Doom3Quest" // appears on window titles and errors
#endif
#define ENGINE_VERSION "Doom3Quest 1.2.2" // printed in console
#define ENGINE_VERSION "Doom3Quest 1.2.3" // printed in console
#ifdef ID_REPRODUCIBLE_BUILD
// for reproducible builds we hardcode values that would otherwise come from __DATE__ and __TIME__