Fix incorrect Pitch calculation

This commit is contained in:
Simon 2020-05-10 23:13:07 +01:00
parent 97906c50d1
commit 9ba23bd449
7 changed files with 22 additions and 9 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.questzdoom"
android:versionCode="13"
android:versionName="0.6.0" android:installLocation="auto" >
android:versionCode="14"
android:versionName="0.7.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -47,7 +47,9 @@ long long global_time;
float playerHeight;
float playerYaw;
bool resetDoomYaw;
bool resetPreviousPitch;
float doomYaw;
float previousPitch;
float vrFOV;
vec3_t worldPosition;
vec3_t hmdPosition;
@ -1283,6 +1285,7 @@ void VR_Init()
//Initialise all our variables
playerYaw = 0.0f;
resetDoomYaw = true;
resetPreviousPitch = true;
remote_movementSideways = 0.0f;
remote_movementForward = 0.0f;
remote_movementUp = 0.0f;

View file

@ -35,6 +35,8 @@ extern float playerHeight;
extern float playerYaw;
extern bool resetDoomYaw;
extern float doomYaw;
extern bool resetPreviousPitch;
extern float previousPitch;
extern float vrFOV;

View file

@ -578,11 +578,18 @@ namespace s3d
// Pitch
{
double viewPitchInDoom = GLRenderer->mAngles.Pitch.Radians();
double dPitch =
- DEG2RAD(pitch)
- viewPitchInDoom;
G_AddViewPitch(mAngleFromRadians(dPitch));
if (resetPreviousPitch)
{
previousPitch = GLRenderer->mAngles.Pitch.Degrees;
resetPreviousPitch = false;
}
double hmdPitchDeltaDegrees = pitch - previousPitch;
ALOGV("dPitch = %f", hmdPitchDeltaDegrees );
G_AddViewPitch(mAngleFromRadians(DEG2RAD(-hmdPitchDeltaDegrees)));
previousPitch = pitch;
}
if (gamestate == GS_LEVEL && !getMenuState())

View file

@ -3807,8 +3807,9 @@ void P_SetupLevel(const char *lumpname, int position, bool newGame)
AnnounceGameStart();
}
//Trigger a Yaw recalc in the QuestZDoom code to avoid moving in the wrong direction
//Trigger a Yaw/Pitch recalc in the QuestZDoom code to avoid moving in the wrong direction
resetDoomYaw = true;
resetPreviousPitch = true;
// This check was previously done at run time each time the heightsec was checked.
// However, since 3D floors are static data, we can easily precalculate this and store it in the sector's flags for quick access.

View file

@ -41,7 +41,7 @@ const char *GetVersionString();
/** Lots of different version numbers **/
#define VERSIONSTR "DrBeef's QuestZDoom-0.6.0 (LZDoom 3.83a)"
#define VERSIONSTR "DrBeef's QuestZDoom-0.7.0 (LZDoom 3.83a)"
// The version as seen in the Windows resource
#define RC_FILEVERSION 3,83,1

Binary file not shown.