Number of small changed

- Hide crosshair if it isn't needed
- Don't draw black bar when drawing FPS counter
- added roll in to the weapon sprite
- If drawing full screen mode always use orthographic projection
This commit is contained in:
Simon 2023-02-13 22:22:29 +00:00
parent f1a165add7
commit deb2c35988
9 changed files with 70 additions and 7 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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,

View file

@ -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)

View file

@ -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);
}
}
}

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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"