Skip to content

Commit

Permalink
Many fixes..
Browse files Browse the repository at this point in the history
- Stair transitions are now smooth as butter!
- Ability to turn off two handed weapons and map grip button instead
- Ability to turn off "alt-key" dominant grip button  and map that to a single button instead
- Weapon no longer jitters or moves independently of player, it should be fixed to controller location (this should fix hexen weapon in water issue)
- Added comment to menu to tell people for to use < 10 angle for smooth turn
- Fix issue where orientation is wrong after using teleporter
  • Loading branch information
DrBeef committed May 24, 2020
1 parent fc838d9 commit 649d27c
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 53 deletions.
4 changes: 2 additions & 2 deletions Projects/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -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="16"
android:versionName="1.0.0" android:installLocation="auto" >
android:versionCode="17"
android:versionName="1.0.1" android:installLocation="auto" >

<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
Expand Down
2 changes: 2 additions & 0 deletions Projects/Android/jni/QzDoom/QzDoom_SurfaceView.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ float vr_weapon_pitchadjust;
bool vr_moveuseoffhand;
float vr_snapturn_angle;
bool vr_switchsticks;
bool vr_secondarybuttonmappings;
bool vr_twohandedweapons;
float vr_use_teleport;
vec3_t offhandangles;
vec3_t offhandoffset;
Expand Down
2 changes: 2 additions & 0 deletions Projects/Android/jni/QzDoom/VrCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ extern bool weaponStabilised;
extern float vr_weapon_pitchadjust;
extern bool vr_moveuseoffhand;
extern bool vr_switchsticks;
extern bool vr_secondarybuttonmappings;
extern bool vr_twohandedweapons;
extern float vr_snapturn_angle;
extern float vr_use_teleport;

Expand Down
137 changes: 95 additions & 42 deletions Projects/Android/jni/QzDoom/VrInputDefault.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
bool dominantGripPushedNew =
(pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0;


ovrInputStateTrackedRemote *pPrimaryTrackedRemoteNew, *pPrimaryTrackedRemoteOld, *pSecondaryTrackedRemoteNew, *pSecondaryTrackedRemoteOld;
if (vr_switchsticks)
{
Expand Down Expand Up @@ -79,7 +78,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
pDominantTracking->HeadPose.Pose.Position.z, 2));

//Turn on weapon stabilisation?
if ((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) !=
if (vr_twohandedweapons &&
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) !=
(pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) {

if (pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) {
Expand Down Expand Up @@ -330,26 +330,47 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,



//Dominant Hand - Secondary keys (grip pushed)
//Alt-Fire
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTRIGGER);

//Crouch
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton1) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & domButton1) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTHUMB);

//No Binding
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton2) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & domButton2) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_RSHIFT);

//No Binding
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_TAB);
if (vr_secondarybuttonmappings) {
//Dominant Hand - Secondary keys (grip pushed)
//Alt-Fire
Joy_GenerateButtonEvents(
((pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTRIGGER);

//Crouch
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton1) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & domButton1) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTHUMB);

//No Binding
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton2) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & domButton2) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_RSHIFT);

//No Binding
Joy_GenerateButtonEvents(
((pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_TAB);
} else {
//Use grip as an extra button
//Alt-Fire
Joy_GenerateButtonEvents(
((pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_LTRIGGER);
}



Expand All @@ -375,29 +396,61 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && !dominantGripPushedNew ? 1 : 0,
1, KEY_SPACE);

if (!vr_twohandedweapons)
{
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0) &&
!dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0) &&
!dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_RTHUMB);
}


//Off Hand - Secondary keys (grip pushed)

//No Default Binding
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_LALT);

//Move Down
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton1) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & offButton1) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PGDN);

//Move Up
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton2) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & offButton2) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_PGUP);

//Land
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
1, KEY_HOME);
if (vr_secondarybuttonmappings) {
//No Default Binding
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_LALT);

//Move Down
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Buttons & offButton1) != 0) && dominantGripPushedOld
? 1 : 0,
((pOffTrackedRemoteNew->Buttons & offButton1) != 0) && dominantGripPushedNew
? 1 : 0,
1, KEY_PGDN);

//Move Up
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Buttons & offButton2) != 0) && dominantGripPushedOld
? 1 : 0,
((pOffTrackedRemoteNew->Buttons & offButton2) != 0) && dominantGripPushedNew
? 1 : 0,
1, KEY_PGUP);

//Land
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_HOME);

if (!vr_twohandedweapons)
{
Joy_GenerateButtonEvents(
((pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0) &&
dominantGripPushedOld ? 1 : 0,
((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0) &&
dominantGripPushedNew ? 1 : 0,
1, KEY_PAD_DPAD_UP);
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

EXTERN_CVAR(Int, screenblocks);
EXTERN_CVAR(Float, movebob);
EXTERN_CVAR(Bool, cl_noprediction)
EXTERN_CVAR(Bool, gl_billboard_faces_camera);
EXTERN_CVAR(Int, gl_multisample);
EXTERN_CVAR(Float, vr_vunits_per_meter)
Expand All @@ -67,6 +68,8 @@ EXTERN_CVAR(Float, vr_ipd);
EXTERN_CVAR(Float, vr_weaponScale);
EXTERN_CVAR(Bool, vr_teleport);
EXTERN_CVAR(Bool, vr_switch_sticks);
EXTERN_CVAR(Bool, vr_secondary_button_mappings);
EXTERN_CVAR(Bool, vr_two_handed_weapons);

//HUD control
EXTERN_CVAR(Float, vr_hud_scale);
Expand All @@ -92,13 +95,13 @@ extern bool automapactive; // in AM_map.c
//bit of a hack, assume player is at "normal" height when not crouching
float getDoomPlayerHeightWithoutCrouch(const player_t *player)
{
static float height = player->viewheight;
if (player->crouching == 0 &&
player->crouchfactor == 1.0)
static float height = 0;
if (height == 0)
{
// Doom thinks this is where you are
height = player->viewheight;
}

return height;
}

Expand Down Expand Up @@ -293,6 +296,7 @@ namespace s3d

bool OculusQuestMode::GetHandTransform(int hand, VSMatrix* mat) const
{
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
if (player)
{
Expand All @@ -301,12 +305,11 @@ namespace s3d

mat->loadIdentity();

mat->translate(pos.X, pos.Z + (player->viewheight -
getDoomPlayerHeightWithoutCrouch(player)), pos.Y);
//We want to offset the weapon exactly from where we are seeing from
mat->translate(r_viewpoint.CenterEyePos.X, r_viewpoint.CenterEyePos.Z - getDoomPlayerHeightWithoutCrouch(player), r_viewpoint.CenterEyePos.Y);

mat->scale(vr_vunits_per_meter, vr_vunits_per_meter, -vr_vunits_per_meter);

double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
if ((vr_control_scheme < 10 && hand == 1)
|| (vr_control_scheme >= 10 && hand == 0)) {
mat->translate(-weaponoffset[0], (hmdPosition[1] + weaponoffset[1] + vr_height_adjust) / pixelstretch, weaponoffset[2]);
Expand Down Expand Up @@ -452,6 +455,8 @@ namespace s3d
vr_switchsticks = vr_switch_sticks;
vr_moveuseoffhand = !vr_move_use_offhand;
vr_use_teleport = vr_teleport;
vr_secondarybuttonmappings = vr_secondary_button_mappings;
vr_twohandedweapons = vr_two_handed_weapons;
QzDoom_getTrackedRemotesOrientation(vr_control_scheme);

//Some crazy stuff to ascertain the actual yaw that doom is using at the right times!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ CVAR(Float, vr_snapTurn, 45.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Int, vr_move_speed, 19, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_run_multiplier, 1.5, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_switch_sticks, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_secondary_button_mappings, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_two_handed_weapons, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

CVAR(Float, vr_pickup_haptic_level, 0.2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_quake_haptic_level, 0.8, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
Expand Down
3 changes: 3 additions & 0 deletions Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/p_teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//-----------------------------------------------------------------------------


#include <QzDoom/VrCommon.h>
#include "templates.h"
#include "doomtype.h"
#include "doomdef.h"
Expand Down Expand Up @@ -198,6 +199,8 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
// [BC] && bHaltVelocity.
if (telezoom && thing->player->mo == thing && !(flags & TELF_KEEPVELOCITY))
thing->player->FOV = MIN (175.f, thing->player->DesiredFOV + 45.f);

resetDoomYaw = true;
}
}
// [BC] && bHaltVelocity.
Expand Down
2 changes: 1 addition & 1 deletion Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const char *GetVersionString();

/** Lots of different version numbers **/

#define VERSIONSTR "DrBeef's QuestZDoom-1.0.0 (LZDoom 3.83a)"
#define VERSIONSTR "DrBeef's QuestZDoom-1.0.1 (LZDoom 3.83a)"

// The version as seen in the Windows resource
#define RC_FILEVERSION 3,83,1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2280,6 +2280,9 @@ OptionMenu VRHUDOptions protected
StaticText ""
StaticText "HUD"
Slider "VR HUD Scale", "vr_hud_scale", 0.05, 1.0, 0.05, 2
ScaleSlider "VR HUD Item Scale", "hud_scale", -1.0, 8.0, 1.0, "$SCALEMNU_USEUI", "$SCALEMNU_USEFS"
ScaleSlider "VR Alt-HUD Item Scale","hud_althudscale", 0.0, 8.0, 1.0, "$SCALEMNU_USEUI"
StaticText ""
Slider "VR HUD Stereo Effect", "vr_hud_stereo", 0.0, 5.0, 0.1, 2
Slider "VR HUD Pitch Rotate", "vr_hud_rotate", 0.0, 50.0, 1.0, 2
Option "VR HUD Fix Pitch", "vr_hud_fixed_pitch", "OnOff"
Expand All @@ -2301,19 +2304,24 @@ OptionMenu VROptionsMenu protected
Title "VR OPTIONS"

StaticText "Misc"
Slider "Height Adjust", "vr_height_adjust", 0.0, 1.0, 0.01, 2
Slider "Height Adjust", "vr_height_adjust", -0.5, 1.0, 0.01, 2

StaticText ""
StaticText "VR Controls"
Option "Control Scheme", "vr_control_scheme", "ControlScheme"
Option "Switch Thumsticks", "vr_switch_sticks", "OnOff"
Option "Use Secondary Button Mappings", "vr_secondary_button_mappings", "OnOff"
Option "Two Handed Weapons", "vr_two_handed_weapons", "OnOff"
Option "Off-hand Move Direction", "vr_move_use_offhand", "OffOn"
StaticText ""
StaticText "Set Snap-Turn to < 10 for Smooth Turn"
Slider "Snap-turn Angle", "vr_snapTurn", 0.0, 90.0, 1.0, 2

StaticText ""
StaticText "Locomotion"
Option "Use Teleport", "vr_teleport", "OnOff"
Slider "Walking Speed", "vr_move_speed", 5, 50, 1, 2
Slider "Run Multiplier", "vr_run_multiplier", 0.0, 4.0, 0.1, 2
Slider "Run Multiplier", "vr_run_multiplier", 0.0, 5.0, 0.1, 2

StaticText ""
StaticText "Haptics"
Expand Down
Binary file modified assets/res/lzdoom.pk3
Binary file not shown.

0 comments on commit 649d27c

Please sign in to comment.