From 8787905fedd7b70bab683164e4bc16e32fa69ab9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Jun 2018 09:00:50 +0200 Subject: [PATCH] Fixed: DBaseStatusBar::Draw did not use its ticFrac parameter when being called from scripts Instead it directly went to the global viewpoint again which would be inconsistent. --- src/d_main.cpp | 6 +++--- src/g_statusbar/sbar.h | 8 ++++---- src/g_statusbar/shared_sbar.cpp | 11 ++++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 6542b950a..c507ecc57 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -817,7 +817,7 @@ void D_Display () { StatusBar->DrawCrosshair(); } - StatusBar->CallDraw (HUD_AltHud); + StatusBar->CallDraw (HUD_AltHud, r_viewpoint.TicFrac); StatusBar->DrawTopStuff (HUD_AltHud); } else @@ -825,13 +825,13 @@ void D_Display () { EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None; StatusBar->DrawBottomStuff (state); - StatusBar->CallDraw (state); + StatusBar->CallDraw (state, r_viewpoint.TicFrac); StatusBar->DrawTopStuff (state); } else { StatusBar->DrawBottomStuff (HUD_StatusBar); - StatusBar->CallDraw (HUD_StatusBar); + StatusBar->CallDraw (HUD_StatusBar, r_viewpoint.TicFrac); StatusBar->DrawTopStuff (HUD_StatusBar); } //stb.Unclock(); diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index a0f8edbda..a98111a29 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -397,10 +397,10 @@ public: void SetScale(); virtual void Tick (); void CallTick(); - virtual void Draw (EHudState state); - void CallDraw(EHudState state); - void DrawBottomStuff (EHudState state); - void DrawTopStuff (EHudState state); + virtual void Draw (EHudState state, double ticFrac); + void CallDraw(EHudState state, double ticFrac); + void DrawBottomStuff (EHudState state); + void DrawTopStuff (EHudState state); void FlashItem (const PClass *itemtype); void AttachToPlayer(player_t *player); DVector2 GetHUDScale() const; diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 4d6d6e737..e0e2cc9d5 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -1006,7 +1006,7 @@ void DBaseStatusBar::DrawMessages (int layer, int bottom) // //--------------------------------------------------------------------------- -void DBaseStatusBar::Draw (EHudState state) +void DBaseStatusBar::Draw (EHudState state, double ticFrac) { // HUD_AltHud state is for popups only if (state == HUD_AltHud) @@ -1048,18 +1048,19 @@ DEFINE_ACTION_FUNCTION(DBaseStatusBar, Draw) { PARAM_SELF_PROLOGUE(DBaseStatusBar); PARAM_INT(state); - self->Draw((EHudState)state); + PARAM_FLOAT(ticFrac); + self->Draw((EHudState)state, ticFrac); return 0; } -void DBaseStatusBar::CallDraw(EHudState state) +void DBaseStatusBar::CallDraw(EHudState state, double ticFrac) { IFVIRTUAL(DBaseStatusBar, Draw) { - VMValue params[] = { (DObject*)this, state, r_viewpoint.TicFrac }; + VMValue params[] = { (DObject*)this, state, ticFrac }; VMCall(func, params, countof(params), nullptr, 0); } - else Draw(state); + else Draw(state, ticFrac); screen->ClearClipRect(); // make sure the scripts don't leave a valid clipping rect behind. BeginStatusBar(BaseSBarHorizontalResolution, BaseSBarVerticalResolution, BaseRelTop, false); }