Implement height scaling when shrunk in Duke

also affects stereo separation
This commit is contained in:
Simon 2023-06-27 23:36:57 +01:00
parent 17271b2a5d
commit d26411d195
7 changed files with 22 additions and 10 deletions

View file

@ -75,14 +75,14 @@ CVAR(Float, vr_height_adjust, 0.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
CVAR(Int, vr_control_scheme, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
CVAR(Bool, vr_move_use_offhand, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_weaponPitchAdjust, 20.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_weaponYawAdjust, 5.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Float, vr_weaponYawAdjust, 6.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_allowPitchOverride, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
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(Bool, vr_two_handed_weapons, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_positional_tracking, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_crouch_use_button, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_6dof_weapons, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -98,7 +98,8 @@ CVAR(Float, vr_hud_rotate, 0.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_hud_fixed_pitch, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, vr_hud_fixed_roll, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
int playerHeight = 0;
float playerHeight = 0;
float heightScaler = 1.0f;
extern int g_gameType;
@ -168,7 +169,7 @@ float getHmdAdjustedHeightInMapUnit()
if (playerHeight != 0)
{
return ((hmdPosition[1] + vr_height_adjust) * vr_hunits_per_meter()) -
playerHeight;
(playerHeight * (heightScaler != 1.0f ? (1.0f - heightScaler) : 1.0f));
}
//Just use offset from origin
@ -404,7 +405,7 @@ bool VR_GetVRProjection(int eye, float zNear, float zFar, float* projection);
VSMatrix VREyeInfo::GetStereoProjection(float fov, float aspectRatio, float fovRatio) const
{
VSMatrix projection = GetCenterProjection(fov, aspectRatio, fovRatio);
projection.translate(getStereoSeparation(1.0f), 0, 0);
projection.translate(getStereoSeparation(1.0f) * heightScaler, 0, 0);
return projection;
}

View file

@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "tilesetbuilder.h"
#include "nnexts.h"
extern int playerHeight; //Used to define player height for VR
extern float playerHeight; //Used to define player height for VR
BEGIN_BLD_NS

View file

@ -30,7 +30,7 @@ Prepared for public release, 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "global.h"
#include "names_r.h"
extern int playerHeight;
extern float playerHeight;
BEGIN_DUKE_NS

View file

@ -50,7 +50,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
extern TArray<TPointer<MapRecord>> mapList;
extern int playerHeight;
extern float playerHeight;
BEGIN_DUKE_NS

View file

@ -41,6 +41,8 @@ source as it is released.
void get_weapon_pos_and_angle(float &x, float &y, float &z, float &pitch, float &yaw);
float vr_hunits_per_meter();
extern float playerHeight;
extern float heightScaler;
EXTERN_CVAR(Bool, vr_6dof_weapons);
EXTERN_CVAR(Bool, vr_6dof_crosshair);
@ -2732,6 +2734,15 @@ void processinput_d(int snum)
shrunk = (pact->spr.scale.Y < 0.5);
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
if (pact && pact->isPlayer() && shrunk)
{
heightScaler = (pact->spr.scale.Y / 0.5625) / 1.5f; // some arbitrary numbers yuck!
}
else
{
heightScaler = 1.0f;
}
setPlayerActorViewZOffset(pact);
p->truefz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());

View file

@ -53,7 +53,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "tilesetbuilder.h"
#include "psky.h"
extern int playerHeight; //Used to define player height for VR
extern float playerHeight; //Used to define player height for VR
BEGIN_PS_NS

View file

@ -86,7 +86,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "interpolate.h"
//#include "crc32.h"
extern int playerHeight; //Used to define player height for VR
extern float playerHeight; //Used to define player height for VR
CVAR(Bool, sw_ninjahack, false, CVAR_ARCHIVE /*| CVAR_SERVERINFO*/);
CVAR(Bool, sw_darts, false, CVAR_ARCHIVE);