diff --git a/source/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp b/source/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp index a7a675eeb..f49431d3e 100644 --- a/source/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp +++ b/source/common/rendering/hwrenderer/data/hw_viewpointbuffer.cpp @@ -98,7 +98,7 @@ void HWViewpointBuffer::Set2D(F2DDrawer *drawer, FRenderState &di, int width, in matrices.mClipLine.X = -10000000.0f; matrices.mShadowmapFilter = gl_shadowmap_filter; - if (isDrawingFullscreen && isIn2D) //fullscreen 2D + if (isDrawingFullscreen) //fullscreen 2D { matrices.mProjectionMatrix[0].ortho(0, (float) width, (float) height, 0, -1.0f, 1.0f); matrices.mProjectionMatrix[1].ortho(0, (float) width, (float) height, 0, -1.0f, 1.0f); diff --git a/source/common/rendering/hwrenderer/data/hw_vrmodes.cpp b/source/common/rendering/hwrenderer/data/hw_vrmodes.cpp index dfa87fee8..b1c5a0ed0 100644 --- a/source/common/rendering/hwrenderer/data/hw_vrmodes.cpp +++ b/source/common/rendering/hwrenderer/data/hw_vrmodes.cpp @@ -342,6 +342,7 @@ VSMatrix VREyeInfo::GetPlayerSpriteProjection(int width, int height) const new_projection.rotate(weaponangles[YAW] - hmdorientation[YAW], 0, 1, 0); new_projection.rotate(weaponangles[PITCH], 1, 0, 0); + new_projection.rotate(weaponangles[ROLL], 0, 0, 1); float weapon_scale = 0.6f; diff --git a/source/core/gamehud.cpp b/source/core/gamehud.cpp index f1c2b92a4..62f0041be 100644 --- a/source/core/gamehud.cpp +++ b/source/core/gamehud.cpp @@ -133,7 +133,7 @@ void DrawRateStuff() int textScale = active_con_scale(twod_blend); int rate_x = (screen->GetWidth() / 2) / textScale - (NewConsoleFont->StringWidth(&fpsbuff[0]) / 2); - twod->AddColorOnlyQuad(rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, MAKEARGB(255, 0, 0, 0)); + //twod->AddColorOnlyQuad(rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, MAKEARGB(255, 0, 0, 0)); DrawText(twod_blend, NewConsoleFont, CR_WHITE, rate_x, screen->GetHeight() / 2, (char*)&fpsbuff[0], DTA_VirtualWidth, screen->GetWidth() / textScale, DTA_VirtualHeight, screen->GetHeight() / textScale, diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index be9929e64..f7e753268 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1547,6 +1547,7 @@ void ProcessInput(PLAYER* pPlayer) DVector2 posXY; sectortype* sect; + bool crosshairActive = false; if (vr_6dof_weapons) { get_weapon_pos_and_angle(px, py, pz1, pz2, pitch, yaw); @@ -1577,6 +1578,8 @@ void ProcessInput(PLAYER* pPlayer) if (hit.hitSector != nullptr) { + crosshairActive = true; + double length = (hit.hitpos.XY() - actor->spr.pos.XY()).Length(); //Update the existing aiming sprites if there is one @@ -1603,6 +1606,16 @@ void ProcessInput(PLAYER* pPlayer) } } + if (!crosshairActive) + { + BloodStatIterator it(kStatCrosshair); + DBloodActor *crosshair = it.Next(); + if (crosshair) + { + crosshair->spr.scale = DVector2(0, 0); + } + } + WeaponProcess(pPlayer); if (vr_6dof_weapons) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 61fbef940..fa332daa2 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2560,11 +2560,12 @@ static void processweapon(int snum, ESyncBits actions) int shrunk = (pact->spr.scale.Y < 0.5); //Aiming decal?! - if (pact) + if (pact && pact->isPlayer()) { + bool crosshairActive = false; if (p->curr_weapon != KNEE_WEAPON) { - if (pact->isPlayer() && vr_6dof_weapons && vr_6dof_crosshair) + if (vr_6dof_weapons && vr_6dof_crosshair) { float x, y, z1, z2, pitch, yaw; get_weapon_pos_and_angle(x, y, z1, z2, pitch, yaw); @@ -2591,6 +2592,7 @@ static void processweapon(int snum, ESyncBits actions) if (hit.hitSector != nullptr) { + crosshairActive = true; double length = (hit.hitpos.XY() - pact->spr.pos.XY()).Length(); //Update the existing aiming sprites if there is one @@ -2609,6 +2611,17 @@ static void processweapon(int snum, ESyncBits actions) } } } + + if (!crosshairActive) + { + //Update the existing aiming sprites if there is one + DukeStatIterator it(STAT_AIM_SPRITE); + DDukeActor* crosshair = it.Next(); + if (crosshair) + { + crosshair->spr.scale = DVector2(0, 0); + } + } } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 932e1b11d..aa9af80b5 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3174,11 +3174,12 @@ static void processweapon(int snum, ESyncBits actions, sectortype* psectp) int shrunk = (pact->spr.scale.Y < 0.125); //Aiming decal?! - if (pact) + if (pact && pact->isPlayer()) { + bool crosshairActive = false; if (p->curr_weapon != KNEE_WEAPON) { - if (pact->isPlayer() && vr_6dof_weapons && vr_6dof_crosshair) + if (vr_6dof_weapons && vr_6dof_crosshair) { float x, y, z1, z2, pitch, yaw; get_weapon_pos_and_angle(x, y, z1, z2, pitch, yaw); @@ -3204,6 +3205,7 @@ static void processweapon(int snum, ESyncBits actions, sectortype* psectp) if (hit.hitSector != nullptr) { + crosshairActive = true; double length = (hit.hitpos.XY() - pact->spr.pos.XY()).Length(); //Update the existing aiming sprites if there is one @@ -3222,6 +3224,17 @@ static void processweapon(int snum, ESyncBits actions, sectortype* psectp) } } } + + if (!crosshairActive) + { + //Update the existing aiming sprites if there is one + DukeStatIterator it(STAT_AIM_SPRITE); + DDukeActor* crosshair = it.Next(); + if (crosshair) + { + crosshair->spr.scale = DVector2(0, 0); + } + } } if (p->detonate_count > 0) diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 02ba2472c..04d53e2a4 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -2664,6 +2664,7 @@ sectdone: DVector2 posXY; sectortype* sect; + bool crosshairActive = false; if (vr_6dof_weapons && nPlayer == 0) { get_weapon_pos_and_angle(px, py, pz1, pz2, pitch, yaw); @@ -2694,6 +2695,7 @@ sectdone: if (hit.hitSector != nullptr) { + crosshairActive = true; double length = (hit.hitpos.XY() - pPlayerActor->spr.pos.XY()).Length(); //Update the existing aiming sprites if there is one @@ -2721,7 +2723,16 @@ sectdone: } pPlayerActor->spr.pos.Z += -pPlayerActor->viewzoffset; + } + if (!crosshairActive) + { + ExhumedStatIterator it(kStatCrosshair); + DExhumedActor *crosshair = it.Next(); + if (crosshair) + { + crosshair->spr.scale = DVector2(0, 0); + } } MoveWeapons(nPlayer); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 26f792bac..c6499194b 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -7036,6 +7036,7 @@ void domovethings(void) DVector2 posXY; sectortype* sect; + bool crosshairActive = false; if (vr_6dof_weapons) { get_weapon_pos_and_angle(px, py, pz1, pz2, pitch, yaw); @@ -7065,6 +7066,7 @@ void domovethings(void) if (hit.hitSector != nullptr) { + crosshairActive = true; double length = (hit.hitpos.XY() - pp->actor->spr.pos.XY()).Length(); //Update the existing aiming sprites if there is one @@ -7093,6 +7095,16 @@ void domovethings(void) } } + if (!crosshairActive) + { + SWStatIterator it(STAT_CROSSHAIR); + DSWActor* crosshair = it.Next(); + if (crosshair) + { + crosshair->spr.scale = DVector2(0, 0); + } + } + pSpriteControl(pp); if (vr_6dof_weapons) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 0f130e166..2b223ff17 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -555,7 +555,7 @@ OptionMenu "VROptionsMenu" protected StaticText "" Option "Positional Tracking", "vr_positional_tracking", "YesNo" Option "6DoF Weapons", "vr_6dof_weapons", "YesNo" - Option "VR Aim-Assist", "vr_6dof_crosshair", "YesNo" + Option "VR Crosshair", "vr_6dof_crosshair", "YesNo" StaticText "" StaticText "HUD"