From 12a50c140c7656ad944df027bd9f5c332f48f698 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 17 Jun 2016 10:47:30 +0200 Subject: [PATCH] Fix animated textures not updating in swtruecolor mode --- src/g_strife/strife_sbar.cpp | 11 +++++++++++ src/menu/playerdisplay.cpp | 11 +++++++++++ src/textures/textures.h | 1 + src/textures/warptexture.cpp | 12 ++++++++++++ 4 files changed, 35 insertions(+) diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index eb3fa26087..e1fcb3cda1 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -34,6 +34,7 @@ public: const BYTE *GetColumn (unsigned int column, const Span **spans_out); const BYTE *GetPixels (); + const uint32_t *GetPixelsBgra() override; bool CheckModified (); void SetVial (int level); @@ -115,6 +116,16 @@ const BYTE *FHealthBar::GetPixels () return Pixels; } +const uint32_t *FHealthBar::GetPixelsBgra() +{ + if (NeedRefresh) + { + MakeTexture(); + PixelsBgra.clear(); + } + return FTexture::GetPixelsBgra(); +} + void FHealthBar::SetVial (int level) { if (level < 0) diff --git a/src/menu/playerdisplay.cpp b/src/menu/playerdisplay.cpp index 16671975a0..7b7e9ca5d4 100644 --- a/src/menu/playerdisplay.cpp +++ b/src/menu/playerdisplay.cpp @@ -78,6 +78,7 @@ public: const BYTE *GetColumn(unsigned int column, const Span **spans_out); const BYTE *GetPixels(); + const uint32_t *GetPixelsBgra() override; bool CheckModified(); protected: @@ -246,6 +247,16 @@ const BYTE *FBackdropTexture::GetPixels() return Pixels; } +const uint32_t *FBackdropTexture::GetPixelsBgra() +{ + if (LastRenderTic != gametic) + { + Render(); + PixelsBgra.clear(); + } + return FTexture::GetPixelsBgra(); +} + //============================================================================= // // This is one plasma and two rotozoomers. I think it turned out quite awesome. diff --git a/src/textures/textures.h b/src/textures/textures.h index 38d1ef487b..3b4b0b8b35 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -484,6 +484,7 @@ public: virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL); const BYTE *GetColumn (unsigned int column, const Span **spans_out); const BYTE *GetPixels (); + const uint32_t *GetPixelsBgra() override; void Unload (); bool CheckModified (); diff --git a/src/textures/warptexture.cpp b/src/textures/warptexture.cpp index b6977dd77e..0d18ab58f4 100644 --- a/src/textures/warptexture.cpp +++ b/src/textures/warptexture.cpp @@ -93,6 +93,18 @@ const BYTE *FWarpTexture::GetPixels () return Pixels; } +const uint32_t *FWarpTexture::GetPixelsBgra() +{ + DWORD time = r_FrameTime; + + if (Pixels == NULL || time != GenTime) + { + MakeTexture(time); + PixelsBgra.clear(); + } + return FTexture::GetPixelsBgra(); +} + const BYTE *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out) { DWORD time = r_FrameTime;