mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
Added menu option for toggling true color output on and off
This commit is contained in:
parent
8aabc26cd9
commit
7080180d47
6 changed files with 216 additions and 194 deletions
|
@ -178,7 +178,7 @@ FDynamicColormap ShadeFakeColormap[16];
|
|||
BYTE identitymap[256];
|
||||
|
||||
EXTERN_CVAR (Int, r_columnmethod)
|
||||
|
||||
EXTERN_CVAR (Bool, r_swtruecolor)
|
||||
|
||||
void R_InitShadeMaps()
|
||||
{
|
||||
|
@ -4135,8 +4135,8 @@ const BYTE *R_GetColumn (FTexture *tex, int col)
|
|||
// [RH] Initialize the column drawer pointers
|
||||
void R_InitColumnDrawers ()
|
||||
{
|
||||
#ifndef PALETTEOUTPUT
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
R_DrawColumnHoriz = R_DrawColumnHorizP_RGBA_C;
|
||||
R_DrawColumn = R_DrawColumnP_RGBA_C;
|
||||
R_DrawFuzzColumn = R_DrawFuzzColumnP_RGBA_C;
|
||||
|
@ -4211,9 +4211,9 @@ void R_InitColumnDrawers ()
|
|||
dovline4 = vlinec4_RGBA;
|
||||
domvline1 = mvlinec1_RGBA;
|
||||
domvline4 = mvlinec4_RGBA;
|
||||
|
||||
#else
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef X86_ASM
|
||||
R_DrawColumn = R_DrawColumnP_ASM;
|
||||
R_DrawColumnHoriz = R_DrawColumnHorizP_ASM;
|
||||
|
@ -4308,8 +4308,7 @@ void R_InitColumnDrawers ()
|
|||
rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_c;
|
||||
rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_c;
|
||||
rt_initcols = rt_initcols_pal;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// [RH] Choose column drawers in a single place
|
||||
|
|
|
@ -103,6 +103,7 @@ bool r_dontmaplines;
|
|||
|
||||
CVAR (String, r_viewsize, "", CVAR_NOSET)
|
||||
CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE)
|
||||
CVAR (Bool, r_swtruecolor, false, CVAR_ARCHIVE)
|
||||
|
||||
double r_BaseVisibility;
|
||||
double r_WallVisibility;
|
||||
|
|
|
@ -187,6 +187,7 @@ EXTERN_CVAR (Float, Gamma)
|
|||
EXTERN_CVAR (Bool, vid_vsync)
|
||||
EXTERN_CVAR (Float, transsouls)
|
||||
EXTERN_CVAR (Int, vid_refreshrate)
|
||||
EXTERN_CVAR (Bool, r_swtruecolor)
|
||||
|
||||
extern IDirect3D9 *D3D;
|
||||
|
||||
|
@ -765,11 +766,7 @@ void D3DFB::KillNativeTexs()
|
|||
|
||||
bool D3DFB::CreateFBTexture ()
|
||||
{
|
||||
#ifndef PALETTEOUTPUT
|
||||
D3DFORMAT FBFormat = D3DFMT_A8R8G8B8;
|
||||
#else
|
||||
D3DFORMAT FBFormat = D3DFMT_L8;
|
||||
#endif
|
||||
FBFormat = r_swtruecolor ? D3DFMT_A8R8G8B8 : D3DFMT_L8;
|
||||
|
||||
if (FAILED(D3DDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, FBFormat, D3DPOOL_DEFAULT, &FBTexture, NULL)))
|
||||
{
|
||||
|
@ -1310,21 +1307,46 @@ void D3DFB::Draw3DPart(bool copy3d)
|
|||
SUCCEEDED(FBTexture->LockRect (0, &lockrect, NULL, D3DLOCK_DISCARD))) ||
|
||||
SUCCEEDED(FBTexture->LockRect (0, &lockrect, &texrect, 0)))
|
||||
{
|
||||
if (lockrect.Pitch == Pitch * sizeof(canvas_pixel_t) && Pitch == Width)
|
||||
if (r_swtruecolor && FBFormat == D3DFMT_A8R8G8B8)
|
||||
{
|
||||
memcpy (lockrect.pBits, MemBuffer, Width * Height * sizeof(canvas_pixel_t));
|
||||
if (lockrect.Pitch == Pitch * sizeof(uint32_t) && Pitch == Width)
|
||||
{
|
||||
memcpy(lockrect.pBits, MemBuffer, Width * Height * sizeof(uint32_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas_pixel_t *dest = (canvas_pixel_t *)lockrect.pBits;
|
||||
canvas_pixel_t *src = MemBuffer;
|
||||
uint32_t *dest = (uint32_t *)lockrect.pBits;
|
||||
uint32_t *src = MemBuffer;
|
||||
for (int y = 0; y < Height; y++)
|
||||
{
|
||||
memcpy (dest, src, Width * sizeof(canvas_pixel_t));
|
||||
dest = reinterpret_cast<canvas_pixel_t*>(reinterpret_cast<uint8_t*>(dest) + lockrect.Pitch);
|
||||
memcpy(dest, src, Width * sizeof(uint32_t));
|
||||
dest = reinterpret_cast<uint32_t*>(reinterpret_cast<uint8_t*>(dest) + lockrect.Pitch);
|
||||
src += Pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!r_swtruecolor && FBFormat == D3DFMT_L8)
|
||||
{
|
||||
if (lockrect.Pitch == Pitch && Pitch == Width)
|
||||
{
|
||||
memcpy(lockrect.pBits, MemBuffer, Width * Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE *dest = (BYTE *)lockrect.pBits;
|
||||
BYTE *src = (BYTE *)MemBuffer;
|
||||
for (int y = 0; y < Height; y++)
|
||||
{
|
||||
memcpy(dest, src, Width);
|
||||
dest = reinterpret_cast<BYTE*>(reinterpret_cast<uint8_t*>(dest) + lockrect.Pitch);
|
||||
src += Pitch;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(lockrect.pBits, 0, lockrect.Pitch * Height);
|
||||
}
|
||||
FBTexture->UnlockRect (0);
|
||||
}
|
||||
}
|
||||
|
@ -1355,11 +1377,10 @@ void D3DFB::Draw3DPart(bool copy3d)
|
|||
memset(Constant, 0, sizeof(Constant));
|
||||
SetAlphaBlend(D3DBLENDOP(0));
|
||||
EnableAlphaTest(FALSE);
|
||||
#ifndef PALETTEOUTPUT
|
||||
if (r_swtruecolor)
|
||||
SetPixelShader(Shaders[SHADER_NormalColor]);
|
||||
#else
|
||||
else
|
||||
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
||||
#endif
|
||||
if (copy3d)
|
||||
{
|
||||
FBVERTEX verts[4];
|
||||
|
@ -1377,11 +1398,10 @@ void D3DFB::Draw3DPart(bool copy3d)
|
|||
realfixedcolormap->ColorizeStart[1]/2, realfixedcolormap->ColorizeStart[2]/2, 0);
|
||||
color1 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeEnd[0]/2,
|
||||
realfixedcolormap->ColorizeEnd[1]/2, realfixedcolormap->ColorizeEnd[2]/2, 1);
|
||||
#ifndef PALETTEOUTPUT
|
||||
if (r_swtruecolor)
|
||||
SetPixelShader(Shaders[SHADER_SpecialColormap]);
|
||||
#else
|
||||
else
|
||||
SetPixelShader(Shaders[SHADER_SpecialColormapPal]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1392,11 +1412,10 @@ void D3DFB::Draw3DPart(bool copy3d)
|
|||
CalcFullscreenCoords(verts, Accel2D, false, color0, color1);
|
||||
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
||||
}
|
||||
#ifndef PALETTEOUTPUT
|
||||
if (r_swtruecolor)
|
||||
SetPixelShader(Shaders[SHADER_NormalColor]);
|
||||
#else
|
||||
else
|
||||
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
||||
#endif
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -424,6 +424,7 @@ private:
|
|||
bool NeedPalUpdate;
|
||||
bool NeedGammaUpdate;
|
||||
int FBWidth, FBHeight;
|
||||
D3DFORMAT FBFormat;
|
||||
bool VSync;
|
||||
RECT BlendingRect;
|
||||
int In2D;
|
||||
|
|
|
@ -1780,6 +1780,7 @@ DSPLYMNU_BRIGHTNESS = "Brightness";
|
|||
DSPLYMNU_VSYNC = "Vertical Sync";
|
||||
DSPLYMNU_CAPFPS = "Rendering Interpolation";
|
||||
DSPLYMNU_COLUMNMETHOD = "Column render mode";
|
||||
DSPLYMNU_TRUECOLOR = "True color output";
|
||||
DSPLYMNU_WIPETYPE = "Screen wipe style";
|
||||
DSPLYMNU_SHOWENDOOM = "Show ENDOOM screen";
|
||||
DSPLYMNU_PALLETEHACK = "DirectDraw palette hack"; // Not used
|
||||
|
|
|
@ -661,6 +661,7 @@ OptionMenu "VideoOptions"
|
|||
Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
|
||||
Option "$DSPLYMNU_CAPFPS", "cl_capfps", "OffOn"
|
||||
Option "$DSPLYMNU_COLUMNMETHOD", "r_columnmethod", "ColumnMethods"
|
||||
Option "$DSPLYMNU_TRUECOLOR", "r_swtruecolor", "OnOff"
|
||||
|
||||
StaticText " "
|
||||
Option "$DSPLYMNU_WIPETYPE", "wipetype", "Wipes"
|
||||
|
|
Loading…
Reference in a new issue