- added StealthAlpha actor property for defining a minimum visibility value of a stealth monster.

This commit is contained in:
Christoph Oelckers 2017-02-27 19:46:27 +01:00
parent f82ab889b2
commit 321c846d01
4 changed files with 16 additions and 2 deletions

View file

@ -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;

View file

@ -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

View file

@ -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;
}
}

View file

@ -1440,6 +1440,16 @@ DEFINE_PROPERTY(selfdamagefactor, F, Actor)
static_cast<PClassActor *>(info)->SelfDamageFactor = i;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(stealthalpha, F, Actor)
{
PROP_DOUBLE_PARM(i, 0);
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
static_cast<PClassActor *>(info)->StealthAlpha = i;
}
//==========================================================================
//
//==========================================================================