mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-14 08:30:50 +00:00
- fixed uninitialized screen flash color for savegame images in the software renderer.
This commit is contained in:
parent
2fa5a88701
commit
0e4a860c5e
3 changed files with 24 additions and 7 deletions
|
@ -1351,12 +1351,13 @@ void DFrameBuffer::DrawBorder (FTextureID picnum, int x1, int y1, int x2, int y2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Draws a blend over the entire view
|
// 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 };
|
float blend[4] = { 0,0,0,0 };
|
||||||
PalEntry blendv = 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.
|
// don't draw sector based blends when any fullbright screen effect is active.
|
||||||
if (!fullbright)
|
if (!fullbright)
|
||||||
{
|
{
|
||||||
const auto &vpp = r_viewpoint.Pos;
|
const auto &vpp = r_viewpoint.Pos;
|
||||||
if (!viewsector->e->XFloor.ffloors.Size())
|
if (!viewsector->e->XFloor.ffloors.Size())
|
||||||
{
|
{
|
||||||
if (viewsector->GetHeightSec())
|
if (viewsector->GetHeightSec())
|
||||||
|
@ -1452,7 +1453,7 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
||||||
if (in->IsKindOf(torchtype))
|
if (in->IsKindOf(torchtype))
|
||||||
{
|
{
|
||||||
// The software renderer already bakes the torch flickering into its output, so this must be omitted here.
|
// 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;
|
if (r > 1.0f) r = 1.0f;
|
||||||
int rr = (int)(r * 255);
|
int rr = (int)(r * 255);
|
||||||
int b = rr;
|
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 br = clamp(blend[0] * 255.f, 0.f, 255.f);
|
||||||
const float bg = clamp(blend[1] * 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 float bb = clamp(blend[2] * 255.f, 0.f, 255.f);
|
||||||
const PalEntry bcolor(255, uint8_t(br), uint8_t(bg), uint8_t(bb));
|
return { br, bg, bb, blend[3] };
|
||||||
screen->Dim(bcolor, blend[3], 0, 0, screen->GetWidth(), screen->GetHeight());
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,9 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
||||||
r_viewpoint = mScene.MainThread()->Viewport->viewpoint;
|
r_viewpoint = mScene.MainThread()->Viewport->viewpoint;
|
||||||
r_viewwindow = mScene.MainThread()->Viewport->viewwindow;
|
r_viewwindow = mScene.MainThread()->Viewport->viewwindow;
|
||||||
}
|
}
|
||||||
|
auto blend = screen->CalcBlend(r_viewpoint.sector);
|
||||||
|
const PalEntry bcolor(255, uint8_t(blend.X), uint8_t(blend.Y), uint8_t(blend.Z));
|
||||||
|
screen->SetFlash(bcolor, int(blend.W * 256));
|
||||||
screen->GetFlashedPalette (palette);
|
screen->GetFlashedPalette (palette);
|
||||||
M_CreatePNG (file, pic.GetPixels(), palette, SS_PAL, width, height, pic.GetPitch(), Gamma);
|
M_CreatePNG (file, pic.GetPixels(), palette, SS_PAL, width, height, pic.GetPitch(), Gamma);
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ private:
|
||||||
protected:
|
protected:
|
||||||
int clipleft = 0, cliptop = 0, clipwidth = -1, clipheight = -1;
|
int clipleft = 0, cliptop = 0, clipwidth = -1, clipheight = -1;
|
||||||
|
|
||||||
PalEntry Flash; // Only needed to support some cruft in the interface that only makes sense for the software renderer
|
PalEntry Flash = 0; // Only needed to support some cruft in the interface that only makes sense for the software renderer
|
||||||
PalEntry SourcePalette[256]; // This is where unpaletted textures get their palette from
|
PalEntry SourcePalette[256]; // This is where unpaletted textures get their palette from
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -502,6 +502,7 @@ public:
|
||||||
// Dim part of the canvas
|
// Dim part of the canvas
|
||||||
void Dim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
|
void Dim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
|
||||||
void DoDim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
|
void DoDim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
|
||||||
|
FVector4 CalcBlend(sector_t * viewsector);
|
||||||
void DrawBlend(sector_t * viewsector);
|
void DrawBlend(sector_t * viewsector);
|
||||||
|
|
||||||
// Fill an area with a texture
|
// Fill an area with a texture
|
||||||
|
|
Loading…
Reference in a new issue