mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-23 12:22:20 +00:00
Ensure HUD doesn't fly around with snap turns
This commit is contained in:
parent
92f775e50e
commit
073d29d746
3 changed files with 22 additions and 5 deletions
|
@ -1063,6 +1063,11 @@ void idGameLocal::EvaluateVRMoveMode(idVec3 &viewangles, usercmd_t &cmd, int but
|
||||||
//GB - Include Dr. Beefs SnapTurn
|
//GB - Include Dr. Beefs SnapTurn
|
||||||
if ( snapTurn != 0.0 && (commonVr->Sys_Milliseconds() - commonVr->lastComfortTime >= vr_comfortRepeat.GetInteger() || vr_turnmode.GetInteger() == 1) )
|
if ( snapTurn != 0.0 && (commonVr->Sys_Milliseconds() - commonVr->lastComfortTime >= vr_comfortRepeat.GetInteger() || vr_turnmode.GetInteger() == 1) )
|
||||||
{
|
{
|
||||||
|
idPlayer *player = GetLocalPlayer();
|
||||||
|
if (player != nullptr) {
|
||||||
|
player->resetHUDYaw = true;
|
||||||
|
}
|
||||||
|
|
||||||
viewangles[YAW] += snapTurn;
|
viewangles[YAW] += snapTurn;
|
||||||
commonVr->lastComfortTime = commonVr->Sys_Milliseconds();
|
commonVr->lastComfortTime = commonVr->Sys_Milliseconds();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3909,13 +3909,20 @@ void idPlayer::UpdateVrHud()
|
||||||
hudPitch = vr_hudType.GetInteger() == VR_HUD_LOOK_DOWN ? vr_hudPosAngle.GetFloat() : 10.0f;
|
hudPitch = vr_hudType.GetInteger() == VR_HUD_LOOK_DOWN ? vr_hudPosAngle.GetFloat() : 10.0f;
|
||||||
|
|
||||||
//Fixed HUD, but make it take a short time to catch up with the player's yaw
|
//Fixed HUD, but make it take a short time to catch up with the player's yaw
|
||||||
static float yaw_x = 0.0f;
|
if (resetHUDYaw)
|
||||||
static float yaw_y = 1.0f;
|
{
|
||||||
yaw_x = 0.97f * yaw_x + 0.03f * cosf(DEG2RAD(viewAngles.yaw));
|
hud_yaw_x = cosf(DEG2RAD(viewAngles.yaw));
|
||||||
yaw_y = 0.97f * yaw_y + 0.03f * sinf(DEG2RAD(viewAngles.yaw));
|
hud_yaw_y = sinf(DEG2RAD(viewAngles.yaw));
|
||||||
|
resetHUDYaw = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hud_yaw_x = 0.97f * hud_yaw_x + 0.03f * cosf(DEG2RAD(viewAngles.yaw));
|
||||||
|
hud_yaw_y = 0.97f * hud_yaw_y + 0.03f * sinf(DEG2RAD(viewAngles.yaw));
|
||||||
|
}
|
||||||
|
|
||||||
GetViewPos( hudOrigin, hudAxis );
|
GetViewPos( hudOrigin, hudAxis );
|
||||||
hudAxis = idAngles( 10.0f, RAD2DEG(atan2(yaw_y, yaw_x)), 0.0f ).ToMat3();
|
hudAxis = idAngles( 10.0f, RAD2DEG(atan2(hud_yaw_y, hud_yaw_x)), 0.0f ).ToMat3();
|
||||||
hudOrigin += hudAxis[0] * 24.0f;
|
hudOrigin += hudAxis[0] * 24.0f;
|
||||||
hudOrigin.z += 4.0f;
|
hudOrigin.z += 4.0f;
|
||||||
hudOrigin += hudAxis[1] * -8.5f;
|
hudOrigin += hudAxis[1] * -8.5f;
|
||||||
|
|
|
@ -467,6 +467,11 @@ public:
|
||||||
qhandle_t hudHandle;
|
qhandle_t hudHandle;
|
||||||
bool hudActive;
|
bool hudActive;
|
||||||
|
|
||||||
|
bool resetHUDYaw;
|
||||||
|
float hud_yaw_x = 0.0f;
|
||||||
|
float hud_yaw_y = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
const idDeclSkin* skinCrosshairDot;
|
const idDeclSkin* skinCrosshairDot;
|
||||||
const idDeclSkin* skinCrosshairCircleDot;
|
const idDeclSkin* skinCrosshairCircleDot;
|
||||||
const idDeclSkin* skinCrosshairCross;
|
const idDeclSkin* skinCrosshairCross;
|
||||||
|
|
Loading…
Reference in a new issue