diff --git a/src/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 7be30a73b..d8950fde5 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -1031,7 +1031,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_AttachLightDef, AttachLightDef) // //========================================================================== -int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radius1, int radius2, int flags, double ofs_x, double ofs_y, double ofs_z, double param, double spoti, double spoto, double spotp, double intensity) +int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radius1, int radius2, int flags, double ofs_x, double ofs_y, double ofs_z, double param, double spoti, double spoto, double spotp, double intensity, double softshadowradius, double linearity) { FName lightid = FName(ENamedName(_lightid)); auto userlight = self->UserLights[FindUserLight(self, lightid, true)]; @@ -1056,6 +1056,8 @@ int AttachLightDirect(AActor *self, int _lightid, int type, int color, int radiu { userlight->UnsetSpotPitch(); } + userlight->SetSoftShadowRadius(softshadowradius); + userlight->SetLinearity(linearity); self->flags8 |= MF8_RECREATELIGHTS; self->Level->flags3 |= LEVEL3_LIGHTCREATED; return 1; @@ -1078,7 +1080,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(AActor, A_AttachLight, AttachLightDirect) PARAM_FLOAT(spoto); PARAM_FLOAT(spotp); PARAM_FLOAT(intensity); - ACTION_RETURN_BOOL(AttachLightDirect(self, lightid.GetIndex(), type, color, radius1, radius2, flags, ofs_x, ofs_y, ofs_z, parami, spoti, spoto, spotp, intensity)); + PARAM_FLOAT(softshadowradius); + PARAM_FLOAT(linearity); + ACTION_RETURN_BOOL(AttachLightDirect(self, lightid.GetIndex(), type, color, radius1, radius2, flags, ofs_x, ofs_y, ofs_z, parami, spoti, spoto, spotp, intensity, softshadowradius, linearity)); } //========================================================================== diff --git a/src/playsim/a_dynlight.h b/src/playsim/a_dynlight.h index 03aeea8b4..ffb77a678 100644 --- a/src/playsim/a_dynlight.h +++ b/src/playsim/a_dynlight.h @@ -121,6 +121,8 @@ public: m_swapped = true; } } + void SetSoftShadowRadius(double r) { SoftShadowRadius = r; } + void SetLinearity(double i) { Linearity = i; } protected: FName m_Name = NAME_None; diff --git a/src/r_data/a_dynlightdata.cpp b/src/r_data/a_dynlightdata.cpp index 24d299314..abe3e875e 100644 --- a/src/r_data/a_dynlightdata.cpp +++ b/src/r_data/a_dynlightdata.cpp @@ -82,6 +82,8 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FLightDefaults &value, ("spotouter", value.m_spotOuterAngle) ("pitch", value.m_pitch) ("lightdefintensity", value.m_LightDefIntensity) + ("softshadowradius", value.SoftShadowRadius) + ("linearity", value.Linearity) .EndObject(); } return arc; diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index b5d8a1091..fea4ded27 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -553,6 +553,8 @@ static const char *LightTags[]= "trace", "shadowminquality", "intensity", + "softshadowradius", + "linearity", nullptr }; @@ -582,6 +584,8 @@ enum { LIGHTTAG_TRACE, LIGHTTAG_SHADOW_MINQUALITY, LIGHTTAG_INTENSITY, + LIGHTTAG_SOFTSHADOWRADIUS, + LIGHTTAG_LINEARITY, }; //========================================================================== @@ -908,6 +912,12 @@ class GLDefsParser case LIGHTTAG_INTENSITY: defaults->SetLightDefIntensity(ParseFloat(sc)); break; + case LIGHTTAG_SOFTSHADOWRADIUS: + defaults->SetSoftShadowRadius(ParseFloat(sc)); + break; + case LIGHTTAG_LINEARITY: + defaults->SetLinearity(ParseFloat(sc)); + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -1019,6 +1029,12 @@ class GLDefsParser case LIGHTTAG_INTENSITY: defaults->SetLightDefIntensity(ParseFloat(sc)); break; + case LIGHTTAG_SOFTSHADOWRADIUS: + defaults->SetSoftShadowRadius(ParseFloat(sc)); + break; + case LIGHTTAG_LINEARITY: + defaults->SetLinearity(ParseFloat(sc)); + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -1133,6 +1149,12 @@ class GLDefsParser case LIGHTTAG_INTENSITY: defaults->SetLightDefIntensity(ParseFloat(sc)); break; + case LIGHTTAG_SOFTSHADOWRADIUS: + defaults->SetSoftShadowRadius(ParseFloat(sc)); + break; + case LIGHTTAG_LINEARITY: + defaults->SetLinearity(ParseFloat(sc)); + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -1246,6 +1268,12 @@ class GLDefsParser case LIGHTTAG_INTENSITY: defaults->SetLightDefIntensity(ParseFloat(sc)); break; + case LIGHTTAG_SOFTSHADOWRADIUS: + defaults->SetSoftShadowRadius(ParseFloat(sc)); + break; + case LIGHTTAG_LINEARITY: + defaults->SetLinearity(ParseFloat(sc)); + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } @@ -1356,6 +1384,12 @@ class GLDefsParser case LIGHTTAG_INTENSITY: defaults->SetLightDefIntensity(ParseFloat(sc)); break; + case LIGHTTAG_SOFTSHADOWRADIUS: + defaults->SetSoftShadowRadius(ParseFloat(sc)); + break; + case LIGHTTAG_LINEARITY: + defaults->SetLinearity(ParseFloat(sc)); + break; default: sc.ScriptError("Unknown tag: %s\n", sc.String); } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index 50f8a8118..d8da5d1ae 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -1322,7 +1322,7 @@ class Actor : Thinker native action native void A_OverlayTranslation(int layer, name trname); native bool A_AttachLightDef(Name lightid, Name lightdef); - native bool A_AttachLight(Name lightid, int type, Color lightcolor, int radius1, int radius2, int flags = 0, Vector3 ofs = (0,0,0), double param = 0, double spoti = 10, double spoto = 25, double spotp = 0, double intensity = 1.0); + native bool A_AttachLight(Name lightid, int type, Color lightcolor, int radius1, int radius2, int flags = 0, Vector3 ofs = (0,0,0), double param = 0, double spoti = 10, double spoto = 25, double spotp = 0, double intensity = 1.0, double softshadowradius = 5.0, double linearity = 0.0); native bool A_RemoveLight(Name lightid); //================================================