mirror of
https://github.com/DrBeef/QuestZDoom.git
synced 2024-11-10 15:01:48 +00:00
Teleport Changes
This commit is contained in:
parent
10bb69ac56
commit
f29d7530c8
10 changed files with 70 additions and 16 deletions
|
@ -63,6 +63,7 @@ vec3_t offhandangles;
|
|||
vec3_t offhandoffset;
|
||||
bool player_moving;
|
||||
bool shutdown;
|
||||
bool ready_teleport;
|
||||
bool trigger_teleport;
|
||||
|
||||
|
||||
|
@ -1309,6 +1310,7 @@ void VR_Init()
|
|||
vr_weapon_pitchadjust = -30.0;
|
||||
|
||||
shutdown = false;
|
||||
ready_teleport = false;
|
||||
trigger_teleport = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ extern vec3_t offhandoffset;
|
|||
|
||||
extern bool player_moving;
|
||||
|
||||
extern bool ready_teleport;
|
||||
extern bool trigger_teleport;
|
||||
|
||||
extern bool shutdown;
|
||||
|
|
|
@ -162,7 +162,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
pOffTracking->HeadPose.Pose.Position.z);
|
||||
|
||||
//Teleport - only does anything if vr_teleport cvar is true
|
||||
static bool ready_teleport = false;
|
||||
if (pOffTrackedRemoteOld->Joystick.y > 0.7f && !ready_teleport)
|
||||
{
|
||||
ready_teleport = true;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "gl/utility/gl_clock.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/renderer/gl_quaddrawer.h"
|
||||
#include "gl/stereo3d/gl_stereo3d.h"
|
||||
|
||||
CVAR(Bool, gl_usecolorblending, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, gl_sprite_blend, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
|
@ -753,12 +754,27 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
if (thruportal == 1) thingpos += Displacements.getOffset(thing->Sector->PortalGroup, sector->PortalGroup);
|
||||
|
||||
// Some added checks if the camera actor is not supposed to be seen. It can happen that some portal setup has this actor in view in which case it may not be skipped here
|
||||
if (thing == camera && !r_viewpoint.showviewer)
|
||||
{
|
||||
DVector3 thingorigin = thing->Pos();
|
||||
if (thruportal == 1) thingorigin += Displacements.getOffset(thing->Sector->PortalGroup, sector->PortalGroup);
|
||||
if (fabs(thingorigin.X - r_viewpoint.ActorPos.X) < 2 && fabs(thingorigin.Y - r_viewpoint.ActorPos.Y) < 2) return;
|
||||
float transparencyOverride = -1;
|
||||
if (thing == camera) {
|
||||
if (!r_viewpoint.showviewer) {
|
||||
DVector3 thingorigin = thing->Pos();
|
||||
if (thruportal == 1)
|
||||
thingorigin += Displacements.getOffset(thing->Sector->PortalGroup,
|
||||
sector->PortalGroup);
|
||||
|
||||
if (fabs(thingorigin.X - r_viewpoint.ActorPos.X) < 2 &&
|
||||
fabs(thingorigin.Y - r_viewpoint.ActorPos.Y) < 2)
|
||||
return;
|
||||
}
|
||||
|
||||
//If we get here, then we want to override the location of the camera actor
|
||||
if (s3d::Stereo3DMode::getCurrentMode().GetTeleportLocation(thingpos))
|
||||
{
|
||||
thing->SetXYZ(thingpos);
|
||||
transparencyOverride = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
// Thing is invisible if close to the camera.
|
||||
if (thing->renderflags & RF_MAYBEINVISIBLE)
|
||||
{
|
||||
|
@ -1027,7 +1043,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
translation = thing->Translation;
|
||||
|
||||
OverrideShader = -1;
|
||||
trans = thing->Alpha;
|
||||
trans = (transparencyOverride == -1.f) ? (float)thing->Alpha : transparencyOverride;
|
||||
hw_styleflags = STYLEHW_Normal;
|
||||
|
||||
if (RenderStyle.BlendOp >= STYLEOP_Fuzz && RenderStyle.BlendOp <= STYLEOP_FuzzOrRevSub)
|
||||
|
|
|
@ -382,6 +382,27 @@ namespace s3d
|
|||
return dir;
|
||||
}
|
||||
|
||||
bool OculusQuestMode::GetTeleportLocation(DVector3 &out) const
|
||||
{
|
||||
// Teleport?
|
||||
DAngle yaw((doomYaw - hmdorientation[YAW]) + offhandangles[YAW]);
|
||||
DAngle pitch(offhandangles[PITCH]);
|
||||
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
|
||||
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
|
||||
|
||||
FLineTraceData trace;
|
||||
if (ready_teleport &&
|
||||
P_LineTrace(player->mo, yaw, 8192, pitch, TRF_ABSOFFSET,
|
||||
((hmdPosition[1] + offhandoffset[1] + vr_height_adjust) * vr_vunits_per_meter) / pixelstretch,
|
||||
-(offhandoffset[2] * vr_vunits_per_meter),
|
||||
-(offhandoffset[0] * vr_vunits_per_meter), &trace) &&
|
||||
(trace.HitType == TRACE_HitFloor)) {
|
||||
out = trace.HitLocation;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
void OculusQuestMode::SetUp() const
|
||||
|
@ -463,9 +484,9 @@ namespace s3d
|
|||
FLineTraceData trace;
|
||||
if (trigger_teleport &&
|
||||
P_LineTrace(player->mo, yaw, 8192, pitch, TRF_ABSOFFSET,
|
||||
((hmdPosition[1] + weaponoffset[1] + vr_height_adjust) * vr_vunits_per_meter) / pixelstretch,
|
||||
-(weaponoffset[2] * vr_vunits_per_meter),
|
||||
-(weaponoffset[0] * vr_vunits_per_meter), &trace) &&
|
||||
((hmdPosition[1] + offhandoffset[1] + vr_height_adjust) * vr_vunits_per_meter) / pixelstretch,
|
||||
-(offhandoffset[2] * vr_vunits_per_meter),
|
||||
-(offhandoffset[0] * vr_vunits_per_meter), &trace) &&
|
||||
trace.HitType == TRACE_HitFloor) {
|
||||
auto vel = player->mo->Vel;
|
||||
player->mo->Vel = DVector3(trace.HitLocation.X - player->mo->X(),
|
||||
|
|
|
@ -81,6 +81,7 @@ public:
|
|||
virtual bool GetWeaponTransform(VSMatrix* out) const override;
|
||||
virtual bool RenderPlayerSpritesCrossed() const { return true; }
|
||||
virtual bool RenderPlayerSpritesInScene() const { return true; }
|
||||
virtual bool GetTeleportLocation(DVector3 &out) const override;
|
||||
|
||||
void getTracking(ovrTracking2 *tracking) const;
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ public:
|
|||
virtual bool GetWeaponTransform(VSMatrix* out) const { return false; }
|
||||
virtual bool RenderPlayerSpritesCrossed() const { return false; }
|
||||
virtual bool RenderPlayerSpritesInScene() const { return false; }
|
||||
|
||||
virtual bool GetTeleportLocation(DVector3 &out) const { return false; }
|
||||
|
||||
protected:
|
||||
TArray<const EyePose *> eye_ptrs;
|
||||
|
||||
|
|
|
@ -102,6 +102,8 @@ static FRandom pr_teleport("A_Teleport");
|
|||
static FRandom pr_bfgselfdamage("BFGSelfDamage");
|
||||
FRandom pr_cajump("CustomJump");
|
||||
|
||||
CVAR(Bool, vr_recoil, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ACustomInventory :: CallStateChain
|
||||
|
@ -1294,7 +1296,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Recoil)
|
|||
|
||||
//We don't want to adjust the player's camera - that could make them sick
|
||||
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
|
||||
if (player != nullptr && self != nullptr && player->mo == self)
|
||||
if (!vr_recoil && player != nullptr && self != nullptr && player->mo == self)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2829,7 +2831,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetAngle)
|
|||
|
||||
//We don't want to adjust the player's camera - that could make them sick
|
||||
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
|
||||
if (player != nullptr && ref != nullptr && player->mo == ref)
|
||||
if (!vr_recoil && player != nullptr && ref != nullptr && player->mo == ref)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2860,7 +2862,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetPitch)
|
|||
|
||||
//We don't want to adjust the player's camera - that could make them sick
|
||||
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
|
||||
if (player != nullptr && ref != nullptr && player->mo == ref)
|
||||
if (!vr_recoil && player != nullptr && ref != nullptr && player->mo == ref)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -2890,7 +2892,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetRoll)
|
|||
|
||||
//We don't want to adjust the player's camera - that could make them sick
|
||||
player_t* player = r_viewpoint.camera ? r_viewpoint.camera->player : nullptr;
|
||||
if (player != nullptr && ref != nullptr && player->mo == ref)
|
||||
if (!vr_recoil && player != nullptr && ref != nullptr && player->mo == ref)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2270,6 +2270,14 @@ OptionValue ControlScheme
|
|||
10, "Left-Handed"
|
||||
}
|
||||
|
||||
OptionValue "Sprites3DMode"
|
||||
{
|
||||
0, "Crossed"
|
||||
1, "Back Only"
|
||||
2, "Item Only"
|
||||
3, "Fat Item"
|
||||
}
|
||||
|
||||
OptionMenu VROptionsMenu protected
|
||||
{
|
||||
Title "VR OPTIONS"
|
||||
|
@ -2280,7 +2288,7 @@ OptionMenu VROptionsMenu protected
|
|||
Option "Control Scheme", "vr_control_scheme", "ControlScheme"
|
||||
Option "Off-hand Move Direction", "vr_move_use_offhand", "OffOn"
|
||||
Option "Use Teleport", "vr_teleport", "OnOff"
|
||||
Slider "Snap-turn Angle", "vr_snapTurn", 0.0, 90.0, 1.0, 2
|
||||
Slider "Snap-turn Angle", "vr_snapTurn", 0.0, 90.0, 1.0, 2c
|
||||
|
||||
StaticText " "
|
||||
Slider "Walking Speed", "vr_move_speed", 5, 50, 1, 2
|
||||
|
@ -2289,6 +2297,9 @@ OptionMenu VROptionsMenu protected
|
|||
StaticText " "
|
||||
Slider "Weapon Pitch Adjust", "vr_weaponRotate", -45, 45, 5, 2
|
||||
Slider "Weapon Scale", "vr_weaponScale", 0.1, 1.0, 0.01, 2
|
||||
Option "Weapon Sprite 3D", "r_PlayerSprites3DMode", "Sprites3DMode"
|
||||
Slider "Weapon Fat Item Width", "gl_fatItemWidth", 0, 1, 0.05, 0
|
||||
Option "Weapon Recoil", "vr_recoil", "OnOff"
|
||||
|
||||
StaticText " "
|
||||
Option "Show VR HUD FPS", "vid_fps", "OnOff"
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue