Several Fixes/Improvements

- Refresh Rate command line param
- Fix for Yaw jitter
- Haptic on pain
This commit is contained in:
Simon 2020-04-12 00:34:29 +01:00
parent 6f371800c7
commit 5d3ac4811e
5 changed files with 29 additions and 14 deletions

View file

@ -59,6 +59,7 @@ bool weaponStabilised;
float vr_weapon_pitchadjust;
bool vr_moveuseoffhand;
float vr_snapturn_angle;
float vr_use_teleport;
vec3_t offhandangles;
vec3_t offhandoffset;
bool player_moving;
@ -98,6 +99,7 @@ int CPU_LEVEL = 4;
int GPU_LEVEL = 4;
int NUM_MULTI_SAMPLES = 1;
float SS_MULTIPLIER = 1.0f;
int DISPLAY_REFRESH = 72;
jclass clazz;
@ -114,6 +116,7 @@ struct arg_dbl *ss;
struct arg_int *cpu;
struct arg_int *gpu;
struct arg_int *msaa;
struct arg_int *refresh;
struct arg_end *end;
char **argv;
@ -1474,6 +1477,9 @@ void * AppThreadFunction(void * parm ) {
return NULL;
}
//Set the screen refresh
vrapi_SetDisplayRefreshRate(gAppState.Ovr, DISPLAY_REFRESH);
// Create the scene if not yet created.
ovrScene_Create( m_width, m_height, &gAppState.Scene, &java );
@ -1747,6 +1753,7 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_onCreate( JNIEnv
cpu = arg_int0("c", "cpu", "<int>", "CPU perf index 1-4 (default: 2)"),
gpu = arg_int0("g", "gpu", "<int>", "GPU perf index 1-4 (default: 3)"),
msaa = arg_int0("m", "msaa", "<int>", "MSAA 1-4 (default: 1)"),
refresh = arg_int0("r", "refresh", "<int>", "Display Refresh 60 or 72 (default: 72)"),
end = arg_end(20)
};
@ -1789,9 +1796,12 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_onCreate( JNIEnv
{
NUM_MULTI_SAMPLES = msaa->ival[0];
}
}
//initialize_gl4es();
if (refresh->count > 0 && (refresh->ival[0] == 60 || refresh->ival[0] == 72))
{
DISPLAY_REFRESH = refresh->ival[0];
}
}
ovrAppThread * appThread = (ovrAppThread *) malloc( sizeof( ovrAppThread ) );
ovrAppThread_Create( appThread, env, activity, activityClass );

View file

@ -51,6 +51,7 @@ extern bool weaponStabilised;
extern float vr_weapon_pitchadjust;
extern bool vr_moveuseoffhand;
extern float vr_snapturn_angle;
extern float vr_use_teleport;
extern vec3_t offhandangles;

View file

@ -163,15 +163,14 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
pOffTracking->HeadPose.Pose.Position.z);
//Teleport - only does anything if vr_teleport cvar is true
if (pOffTrackedRemoteOld->Joystick.y > 0.7f && !ready_teleport)
{
ready_teleport = true;
}
else if (pOffTrackedRemoteOld->Joystick.y < 0.7f & ready_teleport)
{
ready_teleport = false;
trigger_teleport = true;
resetDoomYaw = true;
if (vr_use_teleport) {
if (pOffTrackedRemoteOld->Joystick.y > 0.7f && !ready_teleport) {
ready_teleport = true;
} else if (pOffTrackedRemoteOld->Joystick.y < 0.7f & ready_teleport) {
ready_teleport = false;
trigger_teleport = true;
resetDoomYaw = true;
}
}
//Apply a filter and quadratic scaler so small movements are easier to make

View file

@ -418,10 +418,12 @@ namespace s3d
//Get controller state here
QzDoom_getHMDOrientation(&tracking);
//Set up stuff used in the tracking code
//Set up stuff used in the tracking code - getting the CVARS in the C code would be a faff, so just
//set some variables - lazy, should do it properly..
vr_weapon_pitchadjust = vr_weaponRotate;
vr_snapturn_angle = vr_snapTurn;
vr_moveuseoffhand = !vr_move_use_offhand;
vr_use_teleport = vr_teleport;
QzDoom_getTrackedRemotesOrientation(vr_control_scheme);
//Some crazy stuff to ascertain the actual yaw that doom is using at the right times!

View file

@ -1000,7 +1000,7 @@ static int hasBuddha(player_t *player)
return 0;
}
extern "C" void QzDoom_Vibrate(float duration, int channel, float intensity );
// Returns the amount of damage actually inflicted upon the target, or -1 if
// the damage was cancelled.
@ -1352,7 +1352,10 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
temp = damage < 100 ? damage : 100;
if (player == &players[consoleplayer])
{
I_Tactile (40,10,40+temp*2);
//Haptic feedback when hurt - level indicates amount of damage
float level = (float)(0.4 + (0.6 * (temp / 100.0)));
QzDoom_Vibrate(200, 0, level); // left
QzDoom_Vibrate(200, 1, level); // right
}
}
else