mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 05:40:44 +00:00
- added a new render style 'Shadow'. Essentially it's just a black translucent stencil with an alpha of 0.3. The purpose of this style is to be used as a software renderer approximation of GZDoom's spectre effect.
- allow setting 'Shadow' as default fuzz effect - changed CVAR conversion that strings 'false' and 'true' get evaluated as integers 0 and 1 respectively so that changing boolean CVARs to int does not destroy their values. SVN r3076 (trunk)
This commit is contained in:
parent
e46183d836
commit
231e7a1c6d
9 changed files with 81 additions and 16 deletions
|
@ -221,7 +221,16 @@ int FBaseCVar::ToInt (UCVarValue value, ECVarType type)
|
||||||
#else
|
#else
|
||||||
case CVAR_Float: res = (int)value.Float; break;
|
case CVAR_Float: res = (int)value.Float; break;
|
||||||
#endif
|
#endif
|
||||||
case CVAR_String: res = strtol (value.String, NULL, 0); break;
|
case CVAR_String:
|
||||||
|
{
|
||||||
|
if (stricmp (value.String, "true") == 0)
|
||||||
|
res = 1;
|
||||||
|
else if (stricmp (value.String, "false") == 0)
|
||||||
|
res = 0;
|
||||||
|
else
|
||||||
|
res = strtol (value.String, NULL, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CVAR_GUID: res = 0; break;
|
case CVAR_GUID: res = 0; break;
|
||||||
default: res = 0; break;
|
default: res = 0; break;
|
||||||
}
|
}
|
||||||
|
@ -444,6 +453,11 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CVAR_Int:
|
case CVAR_Int:
|
||||||
|
if (stricmp (value, "true") == 0)
|
||||||
|
ret.Int = 1;
|
||||||
|
else if (stricmp (value, "false") == 0)
|
||||||
|
ret.Int = 0;
|
||||||
|
else
|
||||||
ret.Int = strtol (value, NULL, 0);
|
ret.Int = strtol (value, NULL, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,6 @@ static FRandom pr_torch ("Torch");
|
||||||
#define TIMEFREEZE_TICS ( 12 * TICRATE )
|
#define TIMEFREEZE_TICS ( 12 * TICRATE )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, r_drawfuzz);
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS (APowerup)
|
IMPLEMENT_CLASS (APowerup)
|
||||||
|
|
||||||
// Powerup-Giver -------------------------------------------------------------
|
// Powerup-Giver -------------------------------------------------------------
|
||||||
|
|
|
@ -81,7 +81,6 @@ static void PlayerLandedOnThing (AActor *mo, AActor *onmobj);
|
||||||
|
|
||||||
extern cycle_t BotSupportCycles;
|
extern cycle_t BotSupportCycles;
|
||||||
extern int BotWTG;
|
extern int BotWTG;
|
||||||
EXTERN_CVAR (Bool, r_drawfuzz);
|
|
||||||
EXTERN_CVAR (Int, cl_rockettrails)
|
EXTERN_CVAR (Int, cl_rockettrails)
|
||||||
|
|
||||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||||
|
|
|
@ -48,6 +48,7 @@ enum ERenderStyle
|
||||||
STYLE_Add, // Draw additive
|
STYLE_Add, // Draw additive
|
||||||
STYLE_Shaded, // Treat patch data as alpha values for alphacolor
|
STYLE_Shaded, // Treat patch data as alpha values for alphacolor
|
||||||
STYLE_TranslucentStencil,
|
STYLE_TranslucentStencil,
|
||||||
|
STYLE_Shadow,
|
||||||
|
|
||||||
STYLE_Count
|
STYLE_Count
|
||||||
};
|
};
|
||||||
|
@ -63,6 +64,9 @@ enum ERenderOp
|
||||||
STYLEOP_FuzzOrAdd, // Draw fuzzy or add, based on user preference
|
STYLEOP_FuzzOrAdd, // Draw fuzzy or add, based on user preference
|
||||||
STYLEOP_FuzzOrSub, // Draw fuzzy or subtract, based on user preference
|
STYLEOP_FuzzOrSub, // Draw fuzzy or subtract, based on user preference
|
||||||
STYLEOP_FuzzOrRevSub, // Draw fuzzy or reverse subtract, based on user preference
|
STYLEOP_FuzzOrRevSub, // Draw fuzzy or reverse subtract, based on user preference
|
||||||
|
|
||||||
|
// special styles
|
||||||
|
STYLEOP_Shadow,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ERenderAlpha
|
enum ERenderAlpha
|
||||||
|
|
|
@ -141,6 +141,7 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] =
|
||||||
/* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }},
|
/* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }},
|
||||||
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
|
/* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }},
|
||||||
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
|
/* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }},
|
||||||
|
/* STYLE_Shadow */{{ STYLEOP_Shadow, 0, 0, 0 }},
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
FRenderStyle LegacyRenderStyles[STYLE_Count];
|
FRenderStyle LegacyRenderStyles[STYLE_Count];
|
||||||
|
@ -157,6 +158,7 @@ static const BYTE Styles[STYLE_Count * 4] =
|
||||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
|
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0,
|
||||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
|
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed,
|
||||||
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
|
STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed,
|
||||||
|
STYLEOP_Shadow, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct LegacyInit
|
static struct LegacyInit
|
||||||
|
@ -2068,7 +2070,7 @@ void R_InitColumnDrawers ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Choose column drawers in a single place
|
// [RH] Choose column drawers in a single place
|
||||||
EXTERN_CVAR (Bool, r_drawfuzz)
|
EXTERN_CVAR (Int, r_drawfuzz)
|
||||||
EXTERN_CVAR (Float, transsouls)
|
EXTERN_CVAR (Float, transsouls)
|
||||||
CVAR (Bool, r_drawtrans, true, 0)
|
CVAR (Bool, r_drawtrans, true, 0)
|
||||||
|
|
||||||
|
@ -2235,6 +2237,13 @@ ESPSResult R_SetPatchStyle (FRenderStyle style, fixed_t alpha, int translation,
|
||||||
|
|
||||||
style.CheckFuzz();
|
style.CheckFuzz();
|
||||||
|
|
||||||
|
if (style.BlendOp == STYLEOP_Shadow)
|
||||||
|
{
|
||||||
|
style = LegacyRenderStyles[STYLE_TranslucentStencil];
|
||||||
|
alpha = FRACUNIT*3/10;
|
||||||
|
color = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (style.Flags & STYLEF_TransSoulsAlpha)
|
if (style.Flags & STYLEF_TransSoulsAlpha)
|
||||||
{
|
{
|
||||||
alpha = fixed_t(transsouls * FRACUNIT);
|
alpha = fixed_t(transsouls * FRACUNIT);
|
||||||
|
@ -2390,16 +2399,42 @@ bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
|
||||||
|
|
||||||
void FRenderStyle::CheckFuzz()
|
void FRenderStyle::CheckFuzz()
|
||||||
{
|
{
|
||||||
if (BlendOp == STYLEOP_FuzzOrAdd)
|
switch (BlendOp)
|
||||||
{
|
{
|
||||||
BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_Add;
|
default:
|
||||||
}
|
return;
|
||||||
else if (BlendOp == STYLEOP_FuzzOrSub)
|
|
||||||
|
case STYLEOP_FuzzOrAdd:
|
||||||
|
if (r_drawtrans && r_drawfuzz == 0)
|
||||||
{
|
{
|
||||||
BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_Sub;
|
BlendOp = STYLEOP_Add;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (BlendOp == STYLEOP_FuzzOrRevSub)
|
break;
|
||||||
|
|
||||||
|
case STYLEOP_FuzzOrSub:
|
||||||
|
if (r_drawtrans && r_drawfuzz == 0)
|
||||||
{
|
{
|
||||||
BlendOp = (r_drawfuzz || !r_drawtrans) ? STYLEOP_Fuzz : STYLEOP_RevSub;
|
BlendOp = STYLEOP_Sub;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STYLEOP_FuzzOrRevSub:
|
||||||
|
if (r_drawtrans && r_drawfuzz == 0)
|
||||||
|
{
|
||||||
|
BlendOp = STYLEOP_RevSub;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_drawfuzz == 2)
|
||||||
|
{
|
||||||
|
BlendOp = STYLEOP_Shadow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BlendOp = STYLEOP_Fuzz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ extern fixed_t globaluclip, globaldclip;
|
||||||
#define BASEYCENTER (100)
|
#define BASEYCENTER (100)
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, st_scale)
|
EXTERN_CVAR (Bool, st_scale)
|
||||||
CVAR (Bool, r_drawfuzz, true, CVAR_ARCHIVE)
|
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -601,11 +601,11 @@ DEFINE_PROPERTY(renderstyle, S, Actor)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(str, 0);
|
PROP_STRING_PARM(str, 0);
|
||||||
static const char * renderstyles[]={
|
static const char * renderstyles[]={
|
||||||
"NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD","SHADED", NULL};
|
"NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD", "SHADED", "SHADOW", NULL};
|
||||||
|
|
||||||
static const int renderstyle_values[]={
|
static const int renderstyle_values[]={
|
||||||
STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
|
STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
|
||||||
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded};
|
STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded, STYLE_Shadow};
|
||||||
|
|
||||||
// make this work for old style decorations, too.
|
// make this work for old style decorations, too.
|
||||||
if (!strnicmp(str, "style_", 6)) str+=6;
|
if (!strnicmp(str, "style_", 6)) str+=6;
|
||||||
|
|
|
@ -3677,6 +3677,14 @@ bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &
|
||||||
alpha = clamp<fixed_t> (parms.alpha, 0, FRACUNIT) / 65536.f;
|
alpha = clamp<fixed_t> (parms.alpha, 0, FRACUNIT) / 65536.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
style.CheckFuzz();
|
||||||
|
if (style.BlendOp == STYLEOP_Shadow)
|
||||||
|
{
|
||||||
|
style = LegacyRenderStyles[STYLE_TranslucentStencil];
|
||||||
|
alpha = 0.3f;
|
||||||
|
parms.fillcolor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Fuzz effect is not written
|
// FIXME: Fuzz effect is not written
|
||||||
if (style.BlendOp == STYLEOP_FuzzOrAdd || style.BlendOp == STYLEOP_Fuzz)
|
if (style.BlendOp == STYLEOP_FuzzOrAdd || style.BlendOp == STYLEOP_Fuzz)
|
||||||
{
|
{
|
||||||
|
|
|
@ -640,6 +640,13 @@ OptionValue Contrast
|
||||||
2.0, "Smooth"
|
2.0, "Smooth"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OptionValue Fuzziness
|
||||||
|
{
|
||||||
|
0.0, "Translucent"
|
||||||
|
1.0, "Fuzz"
|
||||||
|
2.0, "Shadow"
|
||||||
|
}
|
||||||
|
|
||||||
OptionMenu "VideoOptions"
|
OptionMenu "VideoOptions"
|
||||||
{
|
{
|
||||||
Title "DISPLAY OPTIONS"
|
Title "DISPLAY OPTIONS"
|
||||||
|
@ -662,7 +669,7 @@ OptionMenu "VideoOptions"
|
||||||
}
|
}
|
||||||
|
|
||||||
Option "Stretch short skies", "r_stretchsky", "OnOff"
|
Option "Stretch short skies", "r_stretchsky", "OnOff"
|
||||||
Option "Use fuzz effect", "r_drawfuzz", "YesNo"
|
Option "Use fuzz effect", "r_drawfuzz", "Fuzziness"
|
||||||
Slider "Lost Soul translucency", "transsouls", 0.25, 1.0, 0.05, 2
|
Slider "Lost Soul translucency", "transsouls", 0.25, 1.0, 0.05, 2
|
||||||
Option "Use fake contrast", "r_fakecontrast", "Contrast"
|
Option "Use fake contrast", "r_fakecontrast", "Contrast"
|
||||||
Option "Rocket Trails", "cl_rockettrails", "RocketTrailTypes"
|
Option "Rocket Trails", "cl_rockettrails", "RocketTrailTypes"
|
||||||
|
|
Loading…
Reference in a new issue