From 19d070c9bd3b92c335e8378b098cfdd91207ee1a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Oct 2016 09:08:07 +0200 Subject: [PATCH] - fixed: averageColor swapped red and blue. - renamed some stuff --- src/r_plane.cpp | 4 ++-- src/textures/texture.cpp | 14 +++++++------- src/textures/textures.h | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 5ddf36f59..07efb84b4 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -935,8 +935,8 @@ static void R_DrawSkyColumnStripe(int start_x, int y1, int y2, int columns, doub dc_dest = (ylookup[y1] + start_x) + dc_destorg; dc_count = y2 - y1; - uint32_t solid_top = frontskytex->GetSWSkyCapColor(false); - uint32_t solid_bottom = frontskytex->GetSWSkyCapColor(true); + uint32_t solid_top = frontskytex->GetSkyCapColor(false); + uint32_t solid_bottom = frontskytex->GetSkyCapColor(true); if (columns == 4) if (!backskytex) diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index f3c9e19a1..bc0eaffa3 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -591,9 +591,9 @@ namespace } for (i = 0; i < size; i++) { - r += BPART(data[i]); + b += BPART(data[i]); g += GPART(data[i]); - b += RPART(data[i]); + r += RPART(data[i]); } r = r / size; @@ -612,7 +612,7 @@ namespace } } -PalEntry FTexture::GetSWSkyCapColor(bool bottom) +PalEntry FTexture::GetSkyCapColor(bool bottom) { PalEntry col; int w; @@ -631,15 +631,15 @@ PalEntry FTexture::GetSWSkyCapColor(bool bottom) const uint32_t *buffer = (const uint32_t *)bitmap.GetPixels(); if (buffer) { - SWCeilingSkyColor = averageColor((DWORD *)buffer, w * MIN(30, h), 0); + CeilingSkyColor = averageColor((DWORD *)buffer, w * MIN(30, h), 0); if (h>30) { - SWFloorSkyColor = averageColor(((DWORD *)buffer) + (h - 30)*w, w * 30, 0); + FloorSkyColor = averageColor(((DWORD *)buffer) + (h - 30)*w, w * 30, 0); } - else SWFloorSkyColor = SWCeilingSkyColor; + else FloorSkyColor = CeilingSkyColor; } } - return bottom ? SWFloorSkyColor : SWCeilingSkyColor; + return bottom ? FloorSkyColor : CeilingSkyColor; } diff --git a/src/textures/textures.h b/src/textures/textures.h index 9402417f7..ad1d9ba8c 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -239,7 +239,7 @@ public: } void SetScaledSize(int fitwidth, int fitheight); - PalEntry GetSWSkyCapColor(bool bottom); + PalEntry GetSkyCapColor(bool bottom); virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches. @@ -262,8 +262,8 @@ protected: private: bool bSWSkyColorDone = false; - PalEntry SWFloorSkyColor; - PalEntry SWCeilingSkyColor; + PalEntry FloorSkyColor; + PalEntry CeilingSkyColor; public: static void FlipSquareBlock (BYTE *block, int x, int y);