diff --git a/src/info.cpp b/src/info.cpp index 580abbf1a..7cac3569d 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -258,6 +258,7 @@ PClassActor::PClassActor() FastSpeed = -1.; RDFactor = 1.; SelfDamageFactor = 1.; + StealthAlpha = 0.; CameraHeight = INT_MIN; DropItems = NULL; @@ -319,6 +320,7 @@ void PClassActor::DeriveData(PClass *newclass) newa->FastSpeed = FastSpeed; newa->RDFactor = RDFactor; newa->SelfDamageFactor = SelfDamageFactor; + newa->StealthAlpha = StealthAlpha; newa->CameraHeight = CameraHeight; newa->HowlSound = HowlSound; newa->BloodType = BloodType; diff --git a/src/info.h b/src/info.h index a9f79182f..6d6329f88 100644 --- a/src/info.h +++ b/src/info.h @@ -301,6 +301,7 @@ public: double RDFactor; // Radius damage factor double SelfDamageFactor; double CameraHeight; // Height of camera when used as such + double StealthAlpha; // Minmum alpha for MF_STEALTH. FSoundID HowlSound; // Sound being played when electrocuted or poisoned FName BloodType; // Blood replacement type FName BloodType2; // Bloopsplatter replacement type diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f85f2c9eb..d218d24de 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -322,6 +322,7 @@ DEFINE_FIELD(PClassActor, WoundHealth) DEFINE_FIELD(PClassActor, FastSpeed) DEFINE_FIELD(PClassActor, RDFactor) DEFINE_FIELD(PClassActor, SelfDamageFactor) +DEFINE_FIELD(PClassActor, StealthAlpha) DEFINE_FIELD(PClassActor, CameraHeight) DEFINE_FIELD(PClassActor, HowlSound) DEFINE_FIELD(PClassActor, BloodType) @@ -4100,9 +4101,9 @@ void AActor::Tick () else if (visdir < 0) { Alpha -= 1.5/TICRATE; - if (Alpha < 0) + if (Alpha < GetClass()->StealthAlpha) { - Alpha = 0; + Alpha = GetClass()->StealthAlpha; visdir = 0; } } diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 6537e2482..cf70b19ae 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -1440,6 +1440,16 @@ DEFINE_PROPERTY(selfdamagefactor, F, Actor) static_cast(info)->SelfDamageFactor = i; } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(stealthalpha, F, Actor) +{ + PROP_DOUBLE_PARM(i, 0); + assert(info->IsKindOf(RUNTIME_CLASS(PClassActor))); + static_cast(info)->StealthAlpha = i; +} + //========================================================================== // //==========================================================================