From c959b3f250386a239521e63f74b1c4e897fbfa36 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 5 Dec 2013 15:28:09 +0100 Subject: [PATCH] - added 'subtract' render style to DECORATE parser. This is actually 'reverse subtract' --- src/r_data/renderstyle.cpp | 6 ++++-- src/r_data/renderstyle.h | 1 + src/thingdef/thingdef_properties.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/r_data/renderstyle.cpp b/src/r_data/renderstyle.cpp index 4b1d9fed4..4259b3440 100644 --- a/src/r_data/renderstyle.cpp +++ b/src/r_data/renderstyle.cpp @@ -57,7 +57,8 @@ FRenderStyle LegacyRenderStyles[STYLE_Count] = /* STYLE_Add */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0 }}, /* STYLE_Shaded */ {{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed }}, /* STYLE_TranslucentStencil */{{ STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed }}, - /* STYLE_Shadow */{{ STYLEOP_Shadow, 0, 0, 0 }}, + /* STYLE_Shadow */ {{ STYLEOP_Shadow, 0, 0, 0 }}, + /* STYLE_Subtract*/ {{ STYLEOP_RevSub, STYLEALPHA_One, STYLEALPHA_One, 0 }}, }; #else FRenderStyle LegacyRenderStyles[STYLE_Count]; @@ -74,7 +75,8 @@ static const BYTE Styles[STYLE_Count * 4] = STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_One, 0, STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_RedIsAlpha | STYLEF_ColorIsFixed, STYLEOP_Add, STYLEALPHA_Src, STYLEALPHA_InvSrc, STYLEF_ColorIsFixed, - STYLEOP_Shadow, 0, 0, 0 + STYLEOP_Shadow, 0, 0, 0, + STYLEOP_RevSub, STYLEALPHA_One, STYLEALPHA_One, 0, }; static struct LegacyInit diff --git a/src/r_data/renderstyle.h b/src/r_data/renderstyle.h index 8133557d5..bd589e8c7 100644 --- a/src/r_data/renderstyle.h +++ b/src/r_data/renderstyle.h @@ -49,6 +49,7 @@ enum ERenderStyle STYLE_Shaded, // Treat patch data as alpha values for alphacolor STYLE_TranslucentStencil, STYLE_Shadow, + STYLE_Subtract, // Actually this is 'reverse subtract' but this is what normal people would expect by 'subtract'. STYLE_Count }; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index d6731aafa..61ab5b968 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -796,11 +796,11 @@ DEFINE_PROPERTY(renderstyle, S, Actor) { PROP_STRING_PARM(str, 0); static const char * renderstyles[]={ - "NONE","NORMAL","FUZZY","SOULTRANS","OPTFUZZY","STENCIL","TRANSLUCENT", "ADD","SHADED", NULL}; + "NONE", "NORMAL", "FUZZY", "SOULTRANS", "OPTFUZZY", "STENCIL", "TRANSLUCENT", "ADD", "SHADED", "SUBTRACT", NULL }; static const int renderstyle_values[]={ 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_Subtract}; // make this work for old style decorations, too. if (!strnicmp(str, "style_", 6)) str+=6;