- fixed uninitialized screen flash color for savegame images in the software renderer.

This commit is contained in:
Christoph Oelckers 2019-03-09 12:52:07 +01:00
commit 0e4a860c5e
3 changed files with 24 additions and 7 deletions

View file

@ -1351,12 +1351,13 @@ void DFrameBuffer::DrawBorder (FTextureID picnum, int x1, int y1, int x2, int y2
}
}
///==========================================================================
//==========================================================================
//
// Draws a blend over the entire view
//
//==========================================================================
void DFrameBuffer::DrawBlend(sector_t * viewsector)
FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector)
{
float blend[4] = { 0,0,0,0 };
PalEntry blendv = 0;
@ -1376,7 +1377,7 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
// don't draw sector based blends when any fullbright screen effect is active.
if (!fullbright)
{
const auto &vpp = r_viewpoint.Pos;
const auto &vpp = r_viewpoint.Pos;
if (!viewsector->e->XFloor.ffloors.Size())
{
if (viewsector->GetHeightSec())
@ -1452,7 +1453,7 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
if (in->IsKindOf(torchtype))
{
// The software renderer already bakes the torch flickering into its output, so this must be omitted here.
float r = vid_rendermode < 4? 1.f : (0.8f + (7 - player->fixedlightlevel) / 70.0f);
float r = vid_rendermode < 4 ? 1.f : (0.8f + (7 - player->fixedlightlevel) / 70.0f);
if (r > 1.0f) r = 1.0f;
int rr = (int)(r * 255);
int b = rr;
@ -1488,8 +1489,20 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
const float br = clamp(blend[0] * 255.f, 0.f, 255.f);
const float bg = clamp(blend[1] * 255.f, 0.f, 255.f);
const float bb = clamp(blend[2] * 255.f, 0.f, 255.f);
const PalEntry bcolor(255, uint8_t(br), uint8_t(bg), uint8_t(bb));
screen->Dim(bcolor, blend[3], 0, 0, screen->GetWidth(), screen->GetHeight());
return { br, bg, bb, blend[3] };
}
//==========================================================================
//
// Draws a blend over the entire view
//
//==========================================================================
void DFrameBuffer::DrawBlend(sector_t * viewsector)
{
auto blend = CalcBlend(viewsector);
const PalEntry bcolor(255, uint8_t(blend.X), uint8_t(blend.Y), uint8_t(blend.Z));
screen->Dim(bcolor, blend.W, 0, 0, screen->GetWidth(), screen->GetHeight());
}