- fixed: averageColor swapped red and blue.

- renamed some stuff
This commit is contained in:
Christoph Oelckers 2016-10-20 09:08:07 +02:00
parent 2fe545a4fd
commit 19d070c9bd
3 changed files with 12 additions and 12 deletions

View file

@ -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_dest = (ylookup[y1] + start_x) + dc_destorg;
dc_count = y2 - y1; dc_count = y2 - y1;
uint32_t solid_top = frontskytex->GetSWSkyCapColor(false); uint32_t solid_top = frontskytex->GetSkyCapColor(false);
uint32_t solid_bottom = frontskytex->GetSWSkyCapColor(true); uint32_t solid_bottom = frontskytex->GetSkyCapColor(true);
if (columns == 4) if (columns == 4)
if (!backskytex) if (!backskytex)

View file

@ -591,9 +591,9 @@ namespace
} }
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
{ {
r += BPART(data[i]); b += BPART(data[i]);
g += GPART(data[i]); g += GPART(data[i]);
b += RPART(data[i]); r += RPART(data[i]);
} }
r = r / size; r = r / size;
@ -612,7 +612,7 @@ namespace
} }
} }
PalEntry FTexture::GetSWSkyCapColor(bool bottom) PalEntry FTexture::GetSkyCapColor(bool bottom)
{ {
PalEntry col; PalEntry col;
int w; int w;
@ -631,15 +631,15 @@ PalEntry FTexture::GetSWSkyCapColor(bool bottom)
const uint32_t *buffer = (const uint32_t *)bitmap.GetPixels(); const uint32_t *buffer = (const uint32_t *)bitmap.GetPixels();
if (buffer) if (buffer)
{ {
SWCeilingSkyColor = averageColor((DWORD *)buffer, w * MIN(30, h), 0); CeilingSkyColor = averageColor((DWORD *)buffer, w * MIN(30, h), 0);
if (h>30) 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;
} }

View file

@ -239,7 +239,7 @@ public:
} }
void SetScaledSize(int fitwidth, int fitheight); 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. virtual void HackHack (int newheight); // called by FMultipatchTexture to discover corrupt patches.
@ -262,8 +262,8 @@ protected:
private: private:
bool bSWSkyColorDone = false; bool bSWSkyColorDone = false;
PalEntry SWFloorSkyColor; PalEntry FloorSkyColor;
PalEntry SWCeilingSkyColor; PalEntry CeilingSkyColor;
public: public:
static void FlipSquareBlock (BYTE *block, int x, int y); static void FlipSquareBlock (BYTE *block, int x, int y);