Skip to content

Commit 649d27c

Browse files
committed
Many fixes..
- 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
1 parent fc838d9 commit 649d27c

File tree

10 files changed

+128
-53
lines changed

10 files changed

+128
-53
lines changed

Projects/Android/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.drbeef.questzdoom"
4-
android:versionCode="16"
5-
android:versionName="1.0.0" android:installLocation="auto" >
4+
android:versionCode="17"
5+
android:versionName="1.0.1" android:installLocation="auto" >
66

77
<!-- Tell the system this app requires OpenGL ES 3.1. -->
88
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

Projects/Android/jni/QzDoom/QzDoom_SurfaceView.c

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ float vr_weapon_pitchadjust;
6262
bool vr_moveuseoffhand;
6363
float vr_snapturn_angle;
6464
bool vr_switchsticks;
65+
bool vr_secondarybuttonmappings;
66+
bool vr_twohandedweapons;
6567
float vr_use_teleport;
6668
vec3_t offhandangles;
6769
vec3_t offhandoffset;

Projects/Android/jni/QzDoom/VrCommon.h

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ extern bool weaponStabilised;
5353
extern float vr_weapon_pitchadjust;
5454
extern bool vr_moveuseoffhand;
5555
extern bool vr_switchsticks;
56+
extern bool vr_secondarybuttonmappings;
57+
extern bool vr_twohandedweapons;
5658
extern float vr_snapturn_angle;
5759
extern float vr_use_teleport;
5860

Projects/Android/jni/QzDoom/VrInputDefault.c

+95-42
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
5151
bool dominantGripPushedNew =
5252
(pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0;
5353

54-
5554
ovrInputStateTrackedRemote *pPrimaryTrackedRemoteNew, *pPrimaryTrackedRemoteOld, *pSecondaryTrackedRemoteNew, *pSecondaryTrackedRemoteOld;
5655
if (vr_switchsticks)
5756
{
@@ -79,7 +78,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
7978
pDominantTracking->HeadPose.Pose.Position.z, 2));
8079

8180
//Turn on weapon stabilisation?
82-
if ((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) !=
81+
if (vr_twohandedweapons &&
82+
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) !=
8383
(pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) {
8484

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

331331

332332

333-
//Dominant Hand - Secondary keys (grip pushed)
334-
//Alt-Fire
335-
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
336-
((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
337-
1, KEY_PAD_LTRIGGER);
338-
339-
//Crouch
340-
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton1) != 0) && dominantGripPushedOld ? 1 : 0,
341-
((pDominantTrackedRemoteNew->Buttons & domButton1) != 0) && dominantGripPushedNew ? 1 : 0,
342-
1, KEY_PAD_LTHUMB);
343-
344-
//No Binding
345-
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton2) != 0) && dominantGripPushedOld ? 1 : 0,
346-
((pDominantTrackedRemoteNew->Buttons & domButton2) != 0) && dominantGripPushedNew ? 1 : 0,
347-
1, KEY_RSHIFT);
348-
349-
//No Binding
350-
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
351-
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
352-
1, KEY_TAB);
333+
if (vr_secondarybuttonmappings) {
334+
//Dominant Hand - Secondary keys (grip pushed)
335+
//Alt-Fire
336+
Joy_GenerateButtonEvents(
337+
((pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) &&
338+
dominantGripPushedOld ? 1 : 0,
339+
((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) &&
340+
dominantGripPushedNew ? 1 : 0,
341+
1, KEY_PAD_LTRIGGER);
342+
343+
//Crouch
344+
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton1) != 0) &&
345+
dominantGripPushedOld ? 1 : 0,
346+
((pDominantTrackedRemoteNew->Buttons & domButton1) != 0) &&
347+
dominantGripPushedNew ? 1 : 0,
348+
1, KEY_PAD_LTHUMB);
349+
350+
//No Binding
351+
Joy_GenerateButtonEvents(((pDominantTrackedRemoteOld->Buttons & domButton2) != 0) &&
352+
dominantGripPushedOld ? 1 : 0,
353+
((pDominantTrackedRemoteNew->Buttons & domButton2) != 0) &&
354+
dominantGripPushedNew ? 1 : 0,
355+
1, KEY_RSHIFT);
356+
357+
//No Binding
358+
Joy_GenerateButtonEvents(
359+
((pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) &&
360+
dominantGripPushedOld ? 1 : 0,
361+
((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) &&
362+
dominantGripPushedNew ? 1 : 0,
363+
1, KEY_TAB);
364+
} else {
365+
//Use grip as an extra button
366+
//Alt-Fire
367+
Joy_GenerateButtonEvents(
368+
((pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0) &&
369+
dominantGripPushedOld ? 1 : 0,
370+
((pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0) &&
371+
dominantGripPushedNew ? 1 : 0,
372+
1, KEY_PAD_LTRIGGER);
373+
}
353374

354375

355376

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

399+
if (!vr_twohandedweapons)
400+
{
401+
Joy_GenerateButtonEvents(
402+
((pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0) &&
403+
!dominantGripPushedOld ? 1 : 0,
404+
((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0) &&
405+
!dominantGripPushedNew ? 1 : 0,
406+
1, KEY_PAD_RTHUMB);
407+
}
378408

379409

380410
//Off Hand - Secondary keys (grip pushed)
381-
382-
//No Default Binding
383-
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedOld ? 1 : 0,
384-
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) && dominantGripPushedNew ? 1 : 0,
385-
1, KEY_LALT);
386-
387-
//Move Down
388-
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton1) != 0) && dominantGripPushedOld ? 1 : 0,
389-
((pOffTrackedRemoteNew->Buttons & offButton1) != 0) && dominantGripPushedNew ? 1 : 0,
390-
1, KEY_PGDN);
391-
392-
//Move Up
393-
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & offButton2) != 0) && dominantGripPushedOld ? 1 : 0,
394-
((pOffTrackedRemoteNew->Buttons & offButton2) != 0) && dominantGripPushedNew ? 1 : 0,
395-
1, KEY_PGUP);
396-
397-
//Land
398-
Joy_GenerateButtonEvents(((pOffTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedOld ? 1 : 0,
399-
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) && dominantGripPushedNew ? 1 : 0,
400-
1, KEY_HOME);
411+
if (vr_secondarybuttonmappings) {
412+
//No Default Binding
413+
Joy_GenerateButtonEvents(
414+
((pOffTrackedRemoteOld->Buttons & ovrButton_Trigger) != 0) &&
415+
dominantGripPushedOld ? 1 : 0,
416+
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != 0) &&
417+
dominantGripPushedNew ? 1 : 0,
418+
1, KEY_LALT);
419+
420+
//Move Down
421+
Joy_GenerateButtonEvents(
422+
((pOffTrackedRemoteOld->Buttons & offButton1) != 0) && dominantGripPushedOld
423+
? 1 : 0,
424+
((pOffTrackedRemoteNew->Buttons & offButton1) != 0) && dominantGripPushedNew
425+
? 1 : 0,
426+
1, KEY_PGDN);
427+
428+
//Move Up
429+
Joy_GenerateButtonEvents(
430+
((pOffTrackedRemoteOld->Buttons & offButton2) != 0) && dominantGripPushedOld
431+
? 1 : 0,
432+
((pOffTrackedRemoteNew->Buttons & offButton2) != 0) && dominantGripPushedNew
433+
? 1 : 0,
434+
1, KEY_PGUP);
435+
436+
//Land
437+
Joy_GenerateButtonEvents(
438+
((pOffTrackedRemoteOld->Buttons & ovrButton_Joystick) != 0) &&
439+
dominantGripPushedOld ? 1 : 0,
440+
((pOffTrackedRemoteNew->Buttons & ovrButton_Joystick) != 0) &&
441+
dominantGripPushedNew ? 1 : 0,
442+
1, KEY_HOME);
443+
444+
if (!vr_twohandedweapons)
445+
{
446+
Joy_GenerateButtonEvents(
447+
((pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger) != 0) &&
448+
dominantGripPushedOld ? 1 : 0,
449+
((pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) != 0) &&
450+
dominantGripPushedNew ? 1 : 0,
451+
1, KEY_PAD_DPAD_UP);
452+
}
453+
}
401454
}
402455
}
403456

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/gl/stereo3d/gl_oculusquest.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
EXTERN_CVAR(Int, screenblocks);
5656
EXTERN_CVAR(Float, movebob);
57+
EXTERN_CVAR(Bool, cl_noprediction)
5758
EXTERN_CVAR(Bool, gl_billboard_faces_camera);
5859
EXTERN_CVAR(Int, gl_multisample);
5960
EXTERN_CVAR(Float, vr_vunits_per_meter)
@@ -67,6 +68,8 @@ EXTERN_CVAR(Float, vr_ipd);
6768
EXTERN_CVAR(Float, vr_weaponScale);
6869
EXTERN_CVAR(Bool, vr_teleport);
6970
EXTERN_CVAR(Bool, vr_switch_sticks);
71+
EXTERN_CVAR(Bool, vr_secondary_button_mappings);
72+
EXTERN_CVAR(Bool, vr_two_handed_weapons);
7073

7174
//HUD control
7275
EXTERN_CVAR(Float, vr_hud_scale);
@@ -92,13 +95,13 @@ extern bool automapactive; // in AM_map.c
9295
//bit of a hack, assume player is at "normal" height when not crouching
9396
float getDoomPlayerHeightWithoutCrouch(const player_t *player)
9497
{
95-
static float height = player->viewheight;
96-
if (player->crouching == 0 &&
97-
player->crouchfactor == 1.0)
98+
static float height = 0;
99+
if (height == 0)
98100
{
99101
// Doom thinks this is where you are
100102
height = player->viewheight;
101103
}
104+
102105
return height;
103106
}
104107

@@ -293,6 +296,7 @@ namespace s3d
293296

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

302306
mat->loadIdentity();
303307

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

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

309-
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
310313
if ((vr_control_scheme < 10 && hand == 1)
311314
|| (vr_control_scheme >= 10 && hand == 0)) {
312315
mat->translate(-weaponoffset[0], (hmdPosition[1] + weaponoffset[1] + vr_height_adjust) / pixelstretch, weaponoffset[2]);
@@ -452,6 +455,8 @@ namespace s3d
452455
vr_switchsticks = vr_switch_sticks;
453456
vr_moveuseoffhand = !vr_move_use_offhand;
454457
vr_use_teleport = vr_teleport;
458+
vr_secondarybuttonmappings = vr_secondary_button_mappings;
459+
vr_twohandedweapons = vr_two_handed_weapons;
455460
QzDoom_getTrackedRemotesOrientation(vr_control_scheme);
456461

457462
//Some crazy stuff to ascertain the actual yaw that doom is using at the right times!

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/gl/stereo3d/gl_stereo_cvars.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ CVAR(Float, vr_snapTurn, 45.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
6767
CVAR(Int, vr_move_speed, 19, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
6868
CVAR(Float, vr_run_multiplier, 1.5, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
6969
CVAR(Bool, vr_switch_sticks, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
70+
CVAR(Bool, vr_secondary_button_mappings, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
71+
CVAR(Bool, vr_two_handed_weapons, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
7072

7173
CVAR(Float, vr_pickup_haptic_level, 0.2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
7274
CVAR(Float, vr_quake_haptic_level, 0.8, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/p_teleport.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
//-----------------------------------------------------------------------------
2828

2929

30+
#include <QzDoom/VrCommon.h>
3031
#include "templates.h"
3132
#include "doomtype.h"
3233
#include "doomdef.h"
@@ -198,6 +199,8 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
198199
// [BC] && bHaltVelocity.
199200
if (telezoom && thing->player->mo == thing && !(flags & TELF_KEEPVELOCITY))
200201
thing->player->FOV = MIN (175.f, thing->player->DesiredFOV + 45.f);
202+
203+
resetDoomYaw = true;
201204
}
202205
}
203206
// [BC] && bHaltVelocity.

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const char *GetVersionString();
4141

4242
/** Lots of different version numbers **/
4343

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

4646
// The version as seen in the Windows resource
4747
#define RC_FILEVERSION 3,83,1

Projects/Android/jni/gzdoom-g3.3mgw_mobile/wadsrc/static/menudef.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,9 @@ OptionMenu VRHUDOptions protected
22802280
StaticText ""
22812281
StaticText "HUD"
22822282
Slider "VR HUD Scale", "vr_hud_scale", 0.05, 1.0, 0.05, 2
2283+
ScaleSlider "VR HUD Item Scale", "hud_scale", -1.0, 8.0, 1.0, "$SCALEMNU_USEUI", "$SCALEMNU_USEFS"
2284+
ScaleSlider "VR Alt-HUD Item Scale","hud_althudscale", 0.0, 8.0, 1.0, "$SCALEMNU_USEUI"
2285+
StaticText ""
22832286
Slider "VR HUD Stereo Effect", "vr_hud_stereo", 0.0, 5.0, 0.1, 2
22842287
Slider "VR HUD Pitch Rotate", "vr_hud_rotate", 0.0, 50.0, 1.0, 2
22852288
Option "VR HUD Fix Pitch", "vr_hud_fixed_pitch", "OnOff"
@@ -2301,19 +2304,24 @@ OptionMenu VROptionsMenu protected
23012304
Title "VR OPTIONS"
23022305

23032306
StaticText "Misc"
2304-
Slider "Height Adjust", "vr_height_adjust", 0.0, 1.0, 0.01, 2
2307+
Slider "Height Adjust", "vr_height_adjust", -0.5, 1.0, 0.01, 2
23052308

23062309
StaticText ""
23072310
StaticText "VR Controls"
23082311
Option "Control Scheme", "vr_control_scheme", "ControlScheme"
23092312
Option "Switch Thumsticks", "vr_switch_sticks", "OnOff"
2313+
Option "Use Secondary Button Mappings", "vr_secondary_button_mappings", "OnOff"
2314+
Option "Two Handed Weapons", "vr_two_handed_weapons", "OnOff"
23102315
Option "Off-hand Move Direction", "vr_move_use_offhand", "OffOn"
2316+
StaticText ""
2317+
StaticText "Set Snap-Turn to < 10 for Smooth Turn"
23112318
Slider "Snap-turn Angle", "vr_snapTurn", 0.0, 90.0, 1.0, 2
23122319

2320+
StaticText ""
23132321
StaticText "Locomotion"
23142322
Option "Use Teleport", "vr_teleport", "OnOff"
23152323
Slider "Walking Speed", "vr_move_speed", 5, 50, 1, 2
2316-
Slider "Run Multiplier", "vr_run_multiplier", 0.0, 4.0, 0.1, 2
2324+
Slider "Run Multiplier", "vr_run_multiplier", 0.0, 5.0, 0.1, 2
23172325

23182326
StaticText ""
23192327
StaticText "Haptics"

assets/res/lzdoom.pk3

-4.08 KB
Binary file not shown.

0 commit comments

Comments
 (0)