mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2025-01-19 12:50:49 +00:00
Fixed GUI pointer angles
Made sure that left/right handed selection in menu works correctly
This commit is contained in:
parent
7df7a5410d
commit
66c7052713
6 changed files with 29 additions and 22 deletions
|
@ -1604,19 +1604,20 @@ void Doom3Quest_getTrackedRemotesOrientation(int controlscheme) {
|
|||
acquireTrackedRemotesData(gAppState.Ovr, gAppState.DisplayTime[gAppState.MainThreadFrameIndex % MAX_TRACKING_SAMPLES]);
|
||||
|
||||
//Call additional control schemes here
|
||||
switch (controlscheme)
|
||||
{
|
||||
case RIGHT_HANDED_DEFAULT:
|
||||
HandleInput_Default(controlscheme, &rightTrackedRemoteState_new, &rightTrackedRemoteState_old, &rightRemoteTracking_new,
|
||||
&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, &leftRemoteTracking_new,
|
||||
ovrButton_A, ovrButton_B, ovrButton_X, ovrButton_Y);
|
||||
break;
|
||||
case LEFT_HANDED_DEFAULT:
|
||||
HandleInput_Default(controlscheme, &leftTrackedRemoteState_new, &leftTrackedRemoteState_old, &leftRemoteTracking_new,
|
||||
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, &rightRemoteTracking_new,
|
||||
ovrButton_X, ovrButton_Y, ovrButton_A, ovrButton_B);
|
||||
break;
|
||||
}
|
||||
if (controlscheme == RIGHT_HANDED_DEFAULT) {
|
||||
HandleInput_Default(controlscheme, &rightTrackedRemoteState_new,
|
||||
&rightTrackedRemoteState_old, &rightRemoteTracking_new,
|
||||
&leftTrackedRemoteState_new, &leftTrackedRemoteState_old,
|
||||
&leftRemoteTracking_new,
|
||||
ovrButton_A, ovrButton_B, ovrButton_X, ovrButton_Y);
|
||||
} else {
|
||||
//Left handed
|
||||
HandleInput_Default(controlscheme, &leftTrackedRemoteState_new, &leftTrackedRemoteState_old,
|
||||
&leftRemoteTracking_new,
|
||||
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old,
|
||||
&rightRemoteTracking_new,
|
||||
ovrButton_X, ovrButton_Y, ovrButton_A, ovrButton_B);
|
||||
}
|
||||
}
|
||||
|
||||
void Doom3Quest_submitFrame()
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct {
|
|||
vec3_t hmdorientation_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdorientation_delta;
|
||||
|
||||
vec3_t weaponangles_unadjusted;
|
||||
vec3_t weaponangles;
|
||||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
|
|
|
@ -60,6 +60,7 @@ extern bool inGameGuiActive;
|
|||
extern bool objectiveSystemActive;
|
||||
extern bool inCinematic;
|
||||
|
||||
|
||||
void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
|
||||
int domButton1, int domButton2, int offButton1, int offButton2 )
|
||||
|
@ -127,6 +128,9 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
{
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = 30;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles_unadjusted);
|
||||
|
||||
rotation[PITCH] = vr_weapon_pitchadjust;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles);
|
||||
|
||||
|
|
|
@ -4449,7 +4449,7 @@ void idPlayer::UpdateFocus( void ) {
|
|||
//Use unadjusted weapon angles to control GUIs
|
||||
idMat3 weaponViewAxis;
|
||||
idAngles weaponViewAngles;
|
||||
CalculateViewWeaponPos(start, weaponViewAxis, weaponViewAngles);
|
||||
CalculateViewWeaponPos(true, start, weaponViewAxis, weaponViewAngles);
|
||||
end = start + (weaponViewAngles.ToForward() * 80.0f);
|
||||
|
||||
// player identification -> names to the hud
|
||||
|
@ -7276,7 +7276,7 @@ void idPlayer::UpdateLaserSight( )
|
|||
idVec3 muzzleOrigin;
|
||||
idMat3 muzzleAxis;
|
||||
idAngles muzzleAngles;
|
||||
CalculateViewWeaponPos( muzzleOrigin, muzzleAxis, muzzleAngles );
|
||||
CalculateViewWeaponPos( false, muzzleOrigin, muzzleAxis, muzzleAngles );
|
||||
|
||||
idVec3 end, start;
|
||||
trace_t traceResults;
|
||||
|
@ -7361,7 +7361,7 @@ Calculate the bobbing position of the view weapon
|
|||
==============
|
||||
*/
|
||||
|
||||
void idPlayer::CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis, idAngles &angles ) {
|
||||
void idPlayer::CalculateViewWeaponPos( bool pointer, idVec3 &origin, idMat3 &axis, idAngles &angles ) {
|
||||
float scale;
|
||||
float fracsin;
|
||||
int delta;
|
||||
|
@ -7373,12 +7373,13 @@ void idPlayer::CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis, idAngles &a
|
|||
if (pVRClientInfo &&
|
||||
currentWeapon != weapon_pda)
|
||||
{
|
||||
angles.pitch = pVRClientInfo->weaponangles[PITCH];
|
||||
float *pAngles = pointer ? pVRClientInfo->weaponangles_unadjusted : pVRClientInfo->weaponangles;
|
||||
angles.pitch = pAngles[PITCH];
|
||||
angles.yaw = viewAngles.yaw +
|
||||
(pVRClientInfo->weaponangles[YAW] - pVRClientInfo->hmdorientation[YAW]);
|
||||
angles.roll = pVRClientInfo->weaponangles[ROLL];
|
||||
(pAngles[YAW] - pVRClientInfo->hmdorientation[YAW]);
|
||||
angles.roll = pAngles[ROLL];
|
||||
|
||||
axis = angles.ToMat3();
|
||||
axis = angles.ToMat3();
|
||||
|
||||
idVec3 gunpos( -pVRClientInfo->current_weaponoffset[2],
|
||||
-pVRClientInfo->current_weaponoffset[0],
|
||||
|
|
|
@ -432,7 +432,7 @@ public:
|
|||
|
||||
float DefaultFov( void ) const;
|
||||
float CalcFov( bool honorZoom );
|
||||
void CalculateViewWeaponPos( idVec3 &origin, idMat3 &axis, idAngles &angles );
|
||||
void CalculateViewWeaponPos( bool pointer, idVec3 &origin, idMat3 &axis, idAngles &angles );
|
||||
idVec3 GetEyePosition( void ) const;
|
||||
void GetViewPos( idVec3 &origin, idMat3 &axis ) const;
|
||||
void OffsetThirdPersonView( float angle, float range, float height, bool clip );
|
||||
|
|
|
@ -1884,7 +1884,7 @@ void idWeapon::PresentWeapon( bool showViewModel ) {
|
|||
int currentWeaponId = owner->GetCurrentWeapon();
|
||||
|
||||
// calculate weapon position based on player movement bobbing
|
||||
owner->CalculateViewWeaponPos( viewWeaponOrigin, viewWeaponAxis, viewWeaponAngles );
|
||||
owner->CalculateViewWeaponPos( false, viewWeaponOrigin, viewWeaponAxis, viewWeaponAngles );
|
||||
|
||||
//This isn't really the right place to do this, but works for now
|
||||
if (currentWeaponId == WEAPON_CHAINGUN) {
|
||||
|
|
Loading…
Reference in a new issue