Multiple Fixes..

- Improved scaling using correct scaling value
- Better placed PDA for use
- Slightly bigger enemy / human heads
- Two Handed Weapons!!
- Don't auto switch weapon on pickup
This commit is contained in:
Simon 2021-04-06 23:24:09 +01:00
parent 344e03164b
commit 2054a7c390
11 changed files with 81 additions and 61 deletions

View File

@ -16,6 +16,7 @@ typedef struct {
bool screen;
float fov;
bool weapon_stabilised;
bool oneHandOnly;
bool right_handed;
bool player_moving;
bool visible_hud;
@ -62,8 +63,6 @@ typedef struct {
vec3_t throw_trajectory;
float throw_power;
bool pistol; // True if the weapon is a pistol
bool velocitytriggered; // Weapon attack triggered by velocity (knife)
bool velocitytriggeredoffhand; // Weapon attack triggered by velocity (puncher)
bool velocitytriggeredoffhandstate; // Weapon attack triggered by velocity (puncher)

View File

@ -226,7 +226,7 @@ void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGame
//Turn on weapon stabilisation?
bool stabilised = false;
if (!pVRClientInfo->pistol && // Don't stabilise pistols
if (!pVRClientInfo->oneHandOnly && // Don't stabilise pistols
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) && (distance < STABILISATION_DISTANCE))
{
stabilised = true;
@ -482,6 +482,7 @@ void HandleInput_Default( int controlscheme, int switchsticks, ovrInputStateGame
(offhandButtonsNew & ovrButton_Joystick)) {
#ifdef DEBUG
//Android_SetCommand("give all");
if(give_weapon_count == 1){
Android_SetCommand("give weapon_pistol");
give_weapon_count = give_weapon_count + 1;

View File

@ -464,10 +464,10 @@ void idAFAttachment::Think( void ) {
idAfAttachment::GetPhysicsToVisualTransform
================
*/
idCVar vr_chibi("vr_chibi", "1.0", CVAR_FLOAT | CVAR_ARCHIVE, "changes the size of human heads.");
idCVar vr_headScale("vr_headScale", "1.085", CVAR_FLOAT | CVAR_ARCHIVE, "changes the size of human heads.");
bool idAFAttachment::GetPhysicsToVisualTransform( idVec3& origin, idMat3& axis )
{
const float scale = vr_chibi.GetFloat();
const float scale = vr_headScale.GetFloat();
if( scale > 0.f && scale != 1.0f )
{
static const idVec3 offset( -1.8f, 0, -8.f);

View File

@ -3871,7 +3871,7 @@ void idPlayer::UpdateVrHud()
idAngles a(0, viewAngles.yaw - pVRClientInfo->hmdorientation[YAW], 0);
offpos *= a.ToMat3();
offpos *= vr_worldscale.GetFloat();
offpos *= ((100.0f / 2.54f) * vr_scale.GetFloat());
{
hudOrigin = viewOrigin + offpos;
@ -11534,7 +11534,7 @@ void idPlayer::UpdateFlashlightHolster()
idAngles a(0, viewAngles.yaw - pVRClientInfo->hmdorientation[YAW], 0);
holsterOffset *= a.ToMat3();
holsterOffset *= vr_worldscale.GetFloat();
holsterOffset *= ((100.0f / 2.54f) * vr_scale.GetFloat());
flashlightRenderEntity.origin = firstPersonViewOrigin + holsterOffset;
flashlightRenderEntity.entityNum = ENTITYNUM_NONE;
@ -11599,14 +11599,16 @@ void idPlayer::Think( void ) {
else {
pVRClientInfo->weaponid = -1;
}
cvarSystem->SetCVarBool("vr_weapon_stabilised", pVRClientInfo->weapon_stabilised);
int _currentWeapon = GetCurrentWeaponId();
if(_currentWeapon == WEAPON_FLASHLIGHT || _currentWeapon == WEAPON_FISTS)
pVRClientInfo->velocitytriggered = true;
else
pVRClientInfo->velocitytriggered = false;
pVRClientInfo->velocitytriggeredoffhand = true;
pVRClientInfo->pistol = GetCurrentWeaponId() == WEAPON_PISTOL;
pVRClientInfo->oneHandOnly = (_currentWeapon == WEAPON_FISTS) ||
(_currentWeapon == weapon_handgrenade);
}
// clear the ik before we do anything else so the skeleton doesn't get updated twice
@ -13165,7 +13167,7 @@ void idPlayer::CalculateViewWeaponPos( int hand, idVec3& origin, idMat3& axis )
idAngles a(0, viewAngles.yaw - pVRClientInfo->hmdorientation[YAW], 0);
gunpos *= a.ToMat3();
gunpos *= cvarSystem->GetCVarFloat( "vr_worldscale" );
gunpos *= ((100.0f / 2.54f) * vr_scale.GetFloat());
if (GetCurrentWeaponId( == WEAPON_FLASHLIGHT) // Flashlight adjustment
{
@ -13386,8 +13388,11 @@ void idPlayer::CalculateViewWeaponPosVR( int hand, idVec3 &origin, idMat3 &axis
commonVr->MotionControlGetHand( hand, hands[ hand ].motionPosition, hands[ hand ].motionRotation );
if (!pVRClientInfo->weapon_stabilised)
{
weaponPitch = idAngles( vr_motionWeaponPitchAdj.GetFloat(), 0.0f, 0.0f ).ToQuat();
hands[hand].motionRotation = weaponPitch * hands[hand].motionRotation;
}
GetViewPos( weapOrigin, weapAxis );
@ -13659,6 +13664,10 @@ void idPlayer::CalculateViewFlashlightPos( idVec3 &origin, idMat3 &axis, idVec3
axis = idAngles( 0.0, viewAngles.yaw - commonVr->bodyYawOffset, 0.0f ).ToMat3();
int flashlightMode = commonVr->GetCurrentFlashlightMode();
if (pVRClientInfo->weapon_stabilised && flashlightMode == FLASHLIGHT_HAND )
{
flashlightMode = FLASHLIGHT_GUN;
}
setLeftHand = false;
//move the flashlight to alternate location for items with no mount
@ -13942,7 +13951,7 @@ idVec3 idPlayer::GetEyePosition( void ) const {
if (pVRClientInfo)
{
float eyeHeight = 0;
float vrEyeHeight = (-(pVRClientInfo->hmdposition[1] + vr_heightoffset.GetFloat()) * vr_worldscale.GetFloat());
float vrEyeHeight = (-(pVRClientInfo->hmdposition[1] + vr_heightoffset.GetFloat()) * ((100.0f / 2.54f) * vr_scale.GetFloat()));
//Add special handling for physical crouching at some point
if (physicsObj.IsCrouching() && PHYSICAL_CROUCH) {

View File

@ -135,19 +135,15 @@ idCVar vr_jumpBounce( "vr_jumpBounce", "0", CVAR_FLOAT | CVAR_ARCHIVE | CVAR_GAM
idCVar vr_stepSmooth( "vr_stepSmooth", "1", CVAR_FLOAT | CVAR_ARCHIVE | CVAR_GAME, "Enable smoothing when climbing stairs. 0 = Disabled, 1 = Full", 0.0f, 1.0f ); // Carl
//Added to menu - needs testing
idCVar vr_walkSpeedAdjust( "vr_walkSpeedAdjust", "-20", CVAR_FLOAT | CVAR_ARCHIVE, "Player walk speed adjustment in VR. (slow down default movement)" );
idCVar vr_walkSpeedAdjust( "vr_walkSpeedAdjust", "0", CVAR_FLOAT | CVAR_ARCHIVE, "Player walk speed adjustment in VR. (slow down default movement)" );
//What is this??
idCVar vr_headbbox( "vr_headbbox", "10.0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
//idCVar vr_pdaPosX( "vr_pdaPosX", "20", CVAR_FLOAT | CVAR_ARCHIVE, "" );
//idCVar vr_pdaPosY( "vr_pdaPosY", "0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
//idCVar vr_pdaPosZ( "vr_pdaPosZ", "-11", CVAR_FLOAT | CVAR_ARCHIVE, "" );
//GB I've re-used this for both fixed position and hand. Check fixed and if worth keeping separate the two
idCVar vr_pdaPosX( "vr_pdaPosX", "-0.5", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_pdaPosY( "vr_pdaPosY", "0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_pdaPosZ( "vr_pdaPosZ", "3.0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_pdaPosX( "vr_pdaPosX", "6.0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_pdaPosY( "vr_pdaPosY", "4.0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_pdaPosZ( "vr_pdaPosZ", "5.0", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_pdaPitch( "vr_pdaPitch", "30", CVAR_FLOAT | CVAR_ARCHIVE, "" );
idCVar vr_comfortRepeat( "vr_comfortRepeat", "100", CVAR_ARCHIVE | CVAR_INTEGER, "Delay in MS between repeating comfort snap turns." );
@ -621,10 +617,20 @@ void iVr::HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idV
}
//GB Get all hand poses
idVec3 _lhandPosition = idVec3(pVRClientInfo->lhandposition[0],pVRClientInfo->lhandposition[1],pVRClientInfo->lhandposition[2]);
idQuat _lhandOrientation = idQuat(pVRClientInfo->lhand_orientation_quat[0],pVRClientInfo->lhand_orientation_quat[1],pVRClientInfo->lhand_orientation_quat[2],pVRClientInfo->lhand_orientation_quat[3]);
idVec3 _rhandPosition = idVec3(pVRClientInfo->rhandposition[0],pVRClientInfo->rhandposition[1],pVRClientInfo->rhandposition[2]);
idQuat _rhandOrientation = idQuat(pVRClientInfo->rhand_orientation_quat[0],pVRClientInfo->rhand_orientation_quat[1],pVRClientInfo->rhand_orientation_quat[2],pVRClientInfo->rhand_orientation_quat[3]);
idVec3 _lhandPosition = idVec3(pVRClientInfo->lhandposition[0],
pVRClientInfo->lhandposition[1],
pVRClientInfo->lhandposition[2]);
idQuat _lhandOrientation = idQuat(pVRClientInfo->lhand_orientation_quat[0],
pVRClientInfo->lhand_orientation_quat[1],
pVRClientInfo->lhand_orientation_quat[2],
pVRClientInfo->lhand_orientation_quat[3]);
idVec3 _rhandPosition = idVec3(pVRClientInfo->rhandposition[0],
pVRClientInfo->rhandposition[1],
pVRClientInfo->rhandposition[2]);
idQuat _rhandOrientation = idQuat(pVRClientInfo->rhand_orientation_quat[0],
pVRClientInfo->rhand_orientation_quat[1],
pVRClientInfo->rhand_orientation_quat[2],
pVRClientInfo->rhand_orientation_quat[3]);
commonVr->handPose[1].Orientation = _lhandOrientation;
@ -895,13 +901,24 @@ void iVr::MotionControlGetTouchController( int hand, idVec3 &motionPosition, idQ
motionPosition.x = -handPose[hand].Position.z * (100.0f / 2.54f) / vr_scale.GetFloat();// Koz convert position (in meters) to inch (1 id unit = 1 inch).
motionPosition.y = -handPose[hand].Position.x * (100.0f / 2.54f) / vr_scale.GetFloat();
motionPosition.z = handPose[hand].Position.y * (100.0f / 2.54f) / vr_scale.GetFloat();
//motionPosition.x = -handPose[hand].Position.z;
//motionPosition.y = -handPose[hand].Position.x;
//motionPosition.z = handPose[hand].Position.y;
motionPosition -= trackingOriginOffset;
motionPosition *= idAngles( 0.0f, (-trackingOriginYawOffset), 0.0f ).ToMat3();
motionPosition -= commonVr->hmdBodyTranslation;
if (pVRClientInfo->weapon_stabilised &&
hand == vr_weaponHand.GetInteger()) {
idVec3 offHandPosition;
offHandPosition.x = -handPose[1 - hand].Position.z * (100.0f / 2.54f) / vr_scale.GetFloat();// Koz convert position (in meters) to inch (1 id unit = 1 inch).
offHandPosition.y = -handPose[1 - hand].Position.x * (100.0f / 2.54f) / vr_scale.GetFloat();
offHandPosition.z = handPose[1 - hand].Position.y * (100.0f / 2.54f) / vr_scale.GetFloat();
offHandPosition -= trackingOriginOffset;
offHandPosition *= idAngles(0.0f, (-trackingOriginYawOffset), 0.0f ).ToMat3();
offHandPosition -= commonVr->hmdBodyTranslation;
poseAngles = (offHandPosition - motionPosition).ToAngles();
angTemp.Set(poseAngles.pitch, poseAngles.yaw, poseAngles.roll);
} else {
poseRot.x = handPose[hand].Orientation.z; // x;
poseRot.y = handPose[hand].Orientation.x; // y;
@ -910,15 +927,11 @@ void iVr::MotionControlGetTouchController( int hand, idVec3 &motionPosition, idQ
poseAngles = poseRot.ToAngles();
angTemp.yaw = poseAngles.yaw;
angTemp.roll = poseAngles.roll;
angTemp.pitch = poseAngles.pitch;
motionPosition -= commonVr->hmdBodyTranslation;
angTemp.Set(poseAngles.pitch, poseAngles.yaw, poseAngles.roll);
angTemp.yaw -= trackingOriginYawOffset;// + bodyYawOffset;
angTemp.Normalize360();
}
angTemp.Normalize360();
motionRotation = angTemp.ToQuat();
}

View File

@ -2079,6 +2079,7 @@ void idWeapon::BeginAttack( void ) {
}
}
WEAPON_ATTACK = true;
}
/*
@ -4064,7 +4065,7 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
pVRClientInfo->throw_origin[1]);
idAngles a(0, owner->viewAngles.yaw - pVRClientInfo->hmdorientation[YAW], 0);
releaseOffset *= a.ToMat3();
releaseOffset *= cvarSystem->GetCVarFloat( "vr_worldscale" );
releaseOffset *= ((100.0f / 2.54f) * vr_scale.GetFloat());
muzzle_pos = owner->firstPersonViewOrigin + releaseOffset;
idVec3 throw_direction( -pVRClientInfo->throw_trajectory[2],
@ -4168,6 +4169,7 @@ void idWeapon::Event_Melee( void ) {
gameLocal.Error( "No meleeDef on '%s'", weaponDef->dict.GetString( "classname" ) );
}
if ( !gameLocal.isClient ) {
idVec3 start = viewWeaponOrigin;
//idVec3 end = start + playerViewAxis[0] * ( meleeDistance * owner->PowerUpModifier( MELEE_DISTANCE ) );

View File

@ -83,7 +83,7 @@ idCVar si_serverURL( "si_serverURL", "", CVAR_GAME | CVAR_SERVERINFO |
idCVar ui_name( "ui_name", "Player", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player name" );
idCVar ui_skin( "ui_skin", ui_skinArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player skin", ui_skinArgs, idCmdSystem::ArgCompletion_String<ui_skinArgs> );
idCVar ui_team( "ui_team", ui_teamArgs[ 0 ], CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE, "player team", ui_teamArgs, idCmdSystem::ArgCompletion_String<ui_teamArgs> );
idCVar ui_autoSwitch( "ui_autoSwitch", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto switch weapon" );
idCVar ui_autoSwitch( "ui_autoSwitch", "0", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto switch weapon" );
idCVar ui_autoReload( "ui_autoReload", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "auto reload weapon" );
idCVar ui_showGun( "ui_showGun", "1", CVAR_GAME | CVAR_USERINFO | CVAR_ARCHIVE | CVAR_BOOL, "show gun" );
idCVar ui_ready( "ui_ready", si_readyArgs[ 0 ], CVAR_GAME | CVAR_USERINFO, "player is ready to start playing", idCmdSystem::ArgCompletion_String<si_readyArgs> );
@ -348,7 +348,6 @@ idCVar net_serverDlTable( "net_serverDlTable", "", CVAR_GAME | CVAR_ARCHIV
idCVar vr_weaponHand( "vr_weaponHand", "0", CVAR_INTEGER | CVAR_ARCHIVE | CVAR_GAME, "Which hand holds weapon.\n 0 = Right hand\n 1 = Left Hand\n", 0, 1 );
idCVar vr_switchSticks( "vr_switchSticks", "0", CVAR_INTEGER | CVAR_ARCHIVE | CVAR_GAME, "Switch joysticks.\n 0 = No\n 1 = Yes\n", 0, 1 );
idCVar vr_ipd( "vr_ipd", "0.065", CVAR_GAME | CVAR_FLOAT | CVAR_ARCHIVE, "VR IPD" );
idCVar vr_worldscale( "vr_worldscale", "43.0", CVAR_GAME | CVAR_FLOAT | CVAR_ARCHIVE, "VR World Scale" );
idCVar vr_heightoffset( "vr_heightoffset", "0.0", CVAR_GAME | CVAR_FLOAT | CVAR_ARCHIVE, "VR Height Offset" );
idCVar vr_controlscheme( "vr_controlscheme", "0", CVAR_GAME | CVAR_INTEGER, "VR Control Scheme: 0 = right handed, 10 = left handed" );
idCVar vr_shakeamplitude( "vr_shakeamplitude", "0.8", CVAR_FLOAT | CVAR_ARCHIVE, "Screen shake amplitude 0.0 = disabled to 1.0 = full\n", 0.0f, 1.0f );

View File

@ -267,7 +267,6 @@ extern idCVar g_xp_bind_run_once;
//VR CVARS
extern idCVar vr_weaponHand;
extern idCVar vr_ipd;
extern idCVar vr_worldscale;
extern idCVar vr_heightoffset;
extern idCVar vr_controlscheme;
extern idCVar vr_shakeamplitude;

View File

@ -886,7 +886,7 @@ void R_SetViewMatrix( viewDef_t *viewDef ) {
{
origin += (eye == 0 ? 1.0f : -1.0f) * viewDef->renderView.viewaxis[1] *
(cvarSystem->GetCVarFloat("vr_ipd") / 2.0f) *
cvarSystem->GetCVarFloat("vr_worldscale");
((100.0f / 2.54f) * cvarSystem->GetCVarFloat("vr_scale"));
}
viewerMatrix[0] = viewDef->renderView.viewaxis[0][0];

View File

@ -149,7 +149,6 @@ seta vr_weaponsight "1"
seta vr_knockback "0"
seta vr_shakeamplitude "1.0"
seta vr_heightoffset "0.0"
seta vr_worldscale "43.0"
seta vr_ipd "0.065"
seta net_serverDlTable ""
seta net_serverDlBaseURL ""
@ -177,7 +176,7 @@ seta g_bloodEffects "1"
seta r_aspectRatio "-1"
seta ui_showGun "1"
seta ui_autoReload "1"
seta ui_autoSwitch "1"
seta ui_autoSwitch "0"
seta ui_team "Red"
seta ui_skin "skins/characters/player/marine_mp"
seta ui_name "Player"
@ -236,11 +235,11 @@ seta vr_moveClick "0"
seta vr_movePoint "1"
seta vr_comfortRepeat "100"
seta vr_pdaPitch "30"
seta vr_pdaPosZ "3.0"
seta vr_pdaPosY "0"
seta vr_pdaPosX "-0.5"
seta vr_pdaPosZ "5.0"
seta vr_pdaPosY "4.0"
seta vr_pdaPosX "6.0"
seta vr_headbbox "10.0"
seta vr_walkSpeedAdjust "-9.657583"
seta vr_walkSpeedAdjust "0.0"
seta vr_stepSmooth "1"
seta vr_jumpBounce "0"
seta vr_3dgui "1"
@ -305,5 +304,5 @@ seta vr_laserSightUseOffset "1"
seta vr_guiFocusPitchAdj "7"
seta vr_wipScale "1.0"
seta vr_grabberBeamWidth "4"
seta vr_chibi "1.0"
seta vr_headScale "1.085"
seta vr_switchSticks "0"

View File

@ -149,7 +149,6 @@ seta vr_weaponsight "1"
seta vr_knockback "0"
seta vr_shakeamplitude "1.0"
seta vr_heightoffset "0.0"
seta vr_worldscale "43.0"
seta vr_ipd "0.065"
seta net_serverDlTable ""
seta net_serverDlBaseURL ""
@ -177,7 +176,7 @@ seta g_bloodEffects "1"
seta r_aspectRatio "-1"
seta ui_showGun "1"
seta ui_autoReload "1"
seta ui_autoSwitch "1"
seta ui_autoSwitch "0"
seta ui_team "Red"
seta ui_skin "skins/characters/player/marine_mp"
seta ui_name "Player"
@ -236,11 +235,11 @@ seta vr_moveClick "0"
seta vr_movePoint "1"
seta vr_comfortRepeat "100"
seta vr_pdaPitch "30"
seta vr_pdaPosZ "3.0"
seta vr_pdaPosY "0"
seta vr_pdaPosX "-0.5"
seta vr_pdaPosZ "5.0"
seta vr_pdaPosY "4.0"
seta vr_pdaPosX "6.0"
seta vr_headbbox "10.0"
seta vr_walkSpeedAdjust "-9.657583"
seta vr_walkSpeedAdjust "0.0"
seta vr_stepSmooth "1"
seta vr_jumpBounce "0"
seta vr_3dgui "1"
@ -305,5 +304,5 @@ seta vr_laserSightUseOffset "1"
seta vr_guiFocusPitchAdj "7"
seta vr_wipScale "1.0"
seta vr_grabberBeamWidth "4"
seta vr_chibi "1.0"
seta vr_headScale "1.085"
seta vr_switchSticks "0"