From b9050b1a3511306d3e42a3b3fb863737dbca84b4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 2 Mar 2021 03:31:10 +0100 Subject: [PATCH] - Blood: properly clip the gauge for throwing dynamite force instead of stretching it. --- source/common/statusbar/base_sbar.cpp | 8 ++++++-- source/common/statusbar/base_sbar.h | 4 ++-- source/games/blood/src/sbar.cpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/common/statusbar/base_sbar.cpp b/source/common/statusbar/base_sbar.cpp index e26371281..b0e917872 100644 --- a/source/common/statusbar/base_sbar.cpp +++ b/source/common/statusbar/base_sbar.cpp @@ -452,7 +452,7 @@ void DStatusBarCore::StatusbarToRealCoords(double& x, double& y, double& w, doub // //============================================================================ -void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style) +void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style, double clipwidth) { if (!texture.isValid()) return; @@ -461,7 +461,7 @@ void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int fla DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, color, translation, style); } -void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style) +void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, ERenderStyle style, double clipwidth) { double texwidth = tex->GetDisplayWidth() * scaleX; double texheight = tex->GetDisplayHeight() * scaleY; @@ -582,6 +582,10 @@ void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flag DTA_LeftOffset, 0, DTA_DestWidthF, boxwidth, DTA_DestHeightF, boxheight, + DTA_ClipLeft, 0, + DTA_ClipTop, 0, + DTA_ClipBottom, twod->GetHeight(), + DTA_ClipRight, clipwidth < 0? twod->GetWidth() : int(x + boxwidth * clipwidth), DTA_Color, color, DTA_TranslationIndex, translation? translation : (flags & DI_TRANSLATABLE) ? GetTranslation() : 0, DTA_ColorOverlay, (flags & DI_DIM) ? MAKEARGB(170, 0, 0, 0) : 0, diff --git a/source/common/statusbar/base_sbar.h b/source/common/statusbar/base_sbar.h index 1038c1964..02c66ba26 100644 --- a/source/common/statusbar/base_sbar.h +++ b/source/common/statusbar/base_sbar.h @@ -184,8 +184,8 @@ public: virtual void SetScale(); void ValidateResolution(int& hres, int& vres) const; void StatusbarToRealCoords(double& x, double& y, double& w, double& h) const; - void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent); - void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent); + void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent, double clipwidth = -1.0); + void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent, double clipwidth = -1.0); void DrawRotated(FTextureID texture, double x, double y, double angle, int flags, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent); void DrawRotated(FGameTexture* tex, double x, double y, int flags, double angle, double Alpha, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, ERenderStyle style = STYLE_Translucent); void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt); diff --git a/source/games/blood/src/sbar.cpp b/source/games/blood/src/sbar.cpp index 1abe6593c..2d8104c30 100644 --- a/source/games/blood/src/sbar.cpp +++ b/source/games/blood/src/sbar.cpp @@ -198,7 +198,7 @@ private: int bx = scale(MulScale(w, nScale, 16), nMult, nDiv) + x; double scale = double(bx - x) / w; double sc = nScale / 65536.; - DrawGraphic(tileGetTexture(nTile, true), x, y, DI_ITEM_LEFT_TOP, 1., -1, -1, scale*sc, sc, 0xffffffff, 0); + DrawGraphic(tileGetTexture(nTile, true), x, y, DI_ITEM_LEFT_TOP, 1., -1, -1, sc, sc, 0xffffffff, 0, STYLE_Translucent, scale); }