mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-10 06:41:36 +00:00
Fixes a problem with older thumbsticks misreporting the X value
This commit is contained in:
parent
97bf74cbe6
commit
88c4f85455
3 changed files with 15 additions and 7 deletions
|
@ -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">
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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__
|
||||
|
|
Loading…
Reference in a new issue