mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-22 12:01:13 +00:00
Added interpolation to crosshair size
This commit is contained in:
parent
6f927d60c8
commit
af8838d45a
3 changed files with 10 additions and 7 deletions
|
@ -1040,7 +1040,7 @@ void D_Display ()
|
||||||
if (DrawFSHUD || automapactive) StatusBar->DrawAltHUD();
|
if (DrawFSHUD || automapactive) StatusBar->DrawAltHUD();
|
||||||
if (players[consoleplayer].camera && players[consoleplayer].camera->player && !automapactive)
|
if (players[consoleplayer].camera && players[consoleplayer].camera->player && !automapactive)
|
||||||
{
|
{
|
||||||
StatusBar->DrawCrosshair();
|
StatusBar->DrawCrosshair(vp.TicFrac);
|
||||||
}
|
}
|
||||||
StatusBar->CallDraw (HUD_AltHud, vp.TicFrac);
|
StatusBar->CallDraw (HUD_AltHud, vp.TicFrac);
|
||||||
StatusBar->DrawTopStuff (HUD_AltHud);
|
StatusBar->DrawTopStuff (HUD_AltHud);
|
||||||
|
|
|
@ -427,14 +427,14 @@ private:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AActor *ValidateInvFirst (int numVisible) const;
|
AActor *ValidateInvFirst (int numVisible) const;
|
||||||
void DrawCrosshair ();
|
void DrawCrosshair (double ticFrac);
|
||||||
|
|
||||||
// Sizing info for ths status bar.
|
// Sizing info for ths status bar.
|
||||||
bool Scaled; // This needs to go away.
|
bool Scaled; // This needs to go away.
|
||||||
|
|
||||||
bool Centering;
|
bool Centering;
|
||||||
bool FixedOrigin;
|
bool FixedOrigin;
|
||||||
double CrosshairSize;
|
double PrevCrosshairSize, CrosshairSize;
|
||||||
double Displacement;
|
double Displacement;
|
||||||
bool ShowLog;
|
bool ShowLog;
|
||||||
int artiflashTick = 0;
|
int artiflashTick = 0;
|
||||||
|
|
|
@ -388,7 +388,7 @@ DBaseStatusBar::DBaseStatusBar ()
|
||||||
CompleteBorder = false;
|
CompleteBorder = false;
|
||||||
Centering = false;
|
Centering = false;
|
||||||
FixedOrigin = false;
|
FixedOrigin = false;
|
||||||
CrosshairSize = 1.;
|
CrosshairSize = PrevCrosshairSize = 1.;
|
||||||
memset(Messages, 0, sizeof(Messages));
|
memset(Messages, 0, sizeof(Messages));
|
||||||
Displacement = 0;
|
Displacement = 0;
|
||||||
CPlayer = NULL;
|
CPlayer = NULL;
|
||||||
|
@ -679,6 +679,8 @@ int DBaseStatusBar::GetPlayer ()
|
||||||
|
|
||||||
void DBaseStatusBar::Tick ()
|
void DBaseStatusBar::Tick ()
|
||||||
{
|
{
|
||||||
|
PrevCrosshairSize = CrosshairSize;
|
||||||
|
|
||||||
for (size_t i = 0; i < countof(Messages); ++i)
|
for (size_t i = 0; i < countof(Messages); ++i)
|
||||||
{
|
{
|
||||||
DHUDMessageBase *msg = Messages[i];
|
DHUDMessageBase *msg = Messages[i];
|
||||||
|
@ -988,7 +990,7 @@ void DBaseStatusBar::RefreshBackground () const
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseStatusBar::DrawCrosshair ()
|
void DBaseStatusBar::DrawCrosshair (double ticFrac)
|
||||||
{
|
{
|
||||||
if (!crosshairon)
|
if (!crosshairon)
|
||||||
{
|
{
|
||||||
|
@ -1010,7 +1012,8 @@ void DBaseStatusBar::DrawCrosshair ()
|
||||||
}
|
}
|
||||||
int health = Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health);
|
int health = Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health);
|
||||||
|
|
||||||
ST_DrawCrosshair(health, viewwidth / 2 + viewwindowx, viewheight / 2 + viewwindowy, CrosshairSize);
|
const double size = PrevCrosshairSize * (1.0 - ticFrac) + CrosshairSize * ticFrac;
|
||||||
|
ST_DrawCrosshair(health, viewwidth / 2 + viewwindowx, viewheight / 2 + viewwindowy, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1082,7 +1085,7 @@ void DBaseStatusBar::Draw (EHudState state, double ticFrac)
|
||||||
{
|
{
|
||||||
if (CPlayer && CPlayer->camera && CPlayer->camera->player)
|
if (CPlayer && CPlayer->camera && CPlayer->camera->player)
|
||||||
{
|
{
|
||||||
DrawCrosshair ();
|
DrawCrosshair (ticFrac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (automapactive)
|
else if (automapactive)
|
||||||
|
|
Loading…
Reference in a new issue