- refactored a few more native meta properties.

This commit is contained in:
Christoph Oelckers 2017-02-28 12:47:44 +01:00
parent 1311f08f47
commit 2a4a5e7a70
9 changed files with 44 additions and 46 deletions

View file

@ -1025,6 +1025,10 @@ public:
double projectilepassheight; // height for clipping projectile movement against this actor
double CameraHeight; // Height of camera when used as such
double RadiusDamageFactor; // Radius damage factor
double SelfDamageFactor;
double StealthAlpha; // Minmum alpha for MF_STEALTH.
SDWORD tics; // state tic counter
FState *state;
//VMFunction *Damage; // For missiles and monster railgun

View file

@ -255,10 +255,6 @@ PClassActor::PClassActor()
BurnHeight = -1;
GibHealth = INT_MIN;
WoundHealth = 6;
FastSpeed = -1.;
RDFactor = 1.;
SelfDamageFactor = 1.;
StealthAlpha = 0.;
DropItems = NULL;
// Record this in the master list.
@ -311,10 +307,6 @@ void PClassActor::DeriveData(PClass *newclass)
newa->BloodColor = BloodColor;
newa->GibHealth = GibHealth;
newa->WoundHealth = WoundHealth;
newa->FastSpeed = FastSpeed;
newa->RDFactor = RDFactor;
newa->SelfDamageFactor = SelfDamageFactor;
newa->StealthAlpha = StealthAlpha;
newa->HowlSound = HowlSound;
newa->distancecheck = distancecheck;

View file

@ -297,10 +297,6 @@ public:
PalEntry BloodColor; // Colorized blood
int GibHealth; // Negative health below which this monster dies an extreme death
int WoundHealth; // Health needed to enter wound state
double FastSpeed; // speed in fast mode
double RDFactor; // Radius damage factor
double SelfDamageFactor;
double StealthAlpha; // Minmum alpha for MF_STEALTH.
FSoundID HowlSound; // Sound being played when electrocuted or poisoned
FDropItem *DropItems;

View file

@ -392,6 +392,7 @@ xx(Radius)
xx(ReactionTime)
xx(MeleeRange)
xx(Speed)
xx(FastSpeed)
xx(Clamp)
xx(VisibleStartAngle)
xx(VisibleStartPitch)

View file

@ -1022,7 +1022,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
}
if (target == source && damage < TELEFRAG_DAMAGE)
{
damage = int(damage * target->GetClass()->SelfDamageFactor);
damage = int(damage * target->SelfDamageFactor);
}
// [MC] Changed it to check rawdamage here for consistency, even though that doesn't actually do anything

View file

@ -5680,7 +5680,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom
{
points = points * splashfactor;
}
points *= thing->GetClass()->RDFactor;
points *= thing->RadiusDamageFactor;
double check = int(points) * bombdamage;
// points and bombdamage should be the same sign (the double cast of 'points' is needed to prevent overflows and incorrect values slipping through.)
@ -5759,7 +5759,7 @@ int P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bom
dist = clamp<double>(dist - fulldamagedistance, 0, dist);
int damage = Scale(bombdamage, bombdistance - int(dist), bombdistance);
double factor = splashfactor * thing->GetClass()->RDFactor;
double factor = splashfactor * thing->RadiusDamageFactor;
damage = int(damage * factor);
if (damage > 0 || (bombspot->flags7 & MF7_FORCEZERORADIUSDMG))
{

View file

@ -312,6 +312,9 @@ DEFINE_FIELD(AActor, Conversation)
DEFINE_FIELD(AActor, DecalGenerator)
DEFINE_FIELD(AActor, fountaincolor)
DEFINE_FIELD(AActor, CameraHeight)
DEFINE_FIELD(AActor, RadiusDamageFactor)
DEFINE_FIELD(AActor, SelfDamageFactor)
DEFINE_FIELD(AActor, StealthAlpha)
DEFINE_FIELD(PClassActor, Obituary)
DEFINE_FIELD(PClassActor, HitObituary)
@ -320,10 +323,6 @@ DEFINE_FIELD(PClassActor, BurnHeight)
DEFINE_FIELD(PClassActor, BloodColor)
DEFINE_FIELD(PClassActor, GibHealth)
DEFINE_FIELD(PClassActor, WoundHealth)
DEFINE_FIELD(PClassActor, FastSpeed)
DEFINE_FIELD(PClassActor, RDFactor)
DEFINE_FIELD(PClassActor, SelfDamageFactor)
DEFINE_FIELD(PClassActor, StealthAlpha)
DEFINE_FIELD(PClassActor, HowlSound)
//==========================================================================
@ -490,7 +489,11 @@ void AActor::Serialize(FSerializer &arc)
A("visiblestartangle",VisibleStartAngle)
A("visibleendangle",VisibleEndAngle)
A("visiblestartpitch",VisibleStartPitch)
A("visibleendpitch",VisibleEndPitch);
A("visibleendpitch",VisibleEndPitch)
A("rdfactor", RadiusDamageFactor)
A("selfdamagefactor", SelfDamageFactor)
A("stealthalpha", StealthAlpha);
}
#undef A
@ -4105,9 +4108,9 @@ void AActor::Tick ()
else if (visdir < 0)
{
Alpha -= 1.5/TICRATE;
if (Alpha < GetClass()->StealthAlpha)
if (Alpha < StealthAlpha)
{
Alpha = GetClass()->StealthAlpha;
Alpha = StealthAlpha;
visdir = 0;
}
}
@ -4828,8 +4831,11 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a
actor->renderflags = (actor->renderflags & ~RF_FULLBRIGHT) | ActorRenderFlags::FromInt (st->GetFullbright());
actor->touching_sectorlist = nullptr; // NULL head of sector list // phares 3/13/98
actor->touching_rendersectors = nullptr;
if (G_SkillProperty(SKILLP_FastMonsters) && actor->GetClass()->FastSpeed >= 0)
actor->Speed = actor->GetClass()->FastSpeed;
if (G_SkillProperty(SKILLP_FastMonsters))
{
double f = actor->FloatVar(NAME_FastSpeed);
if (f >= 0) actor->Speed = f;
}
// set subsector and/or block links
actor->LinkToWorld (nullptr, SpawningMapThing);
@ -6701,10 +6707,14 @@ static double GetDefaultSpeed(PClassActor *type)
{
if (type == NULL)
return 0;
else if (G_SkillProperty(SKILLP_FastMonsters) && type->FastSpeed >= 0)
return type->FastSpeed;
else
return GetDefaultByType(type)->Speed;
auto def = GetDefaultByType(type);
if (G_SkillProperty(SKILLP_FastMonsters))
{
double f = def->FloatVar(NAME_FastSpeed);
if (f >= 0) return f;
}
return def->Speed;
}
DEFINE_ACTION_FUNCTION(AActor, GetDefaultSpeed)

View file

@ -1310,24 +1310,13 @@ DEFINE_PROPERTY(poisondamagetype, S, Actor)
defaults->PoisonDamageType = poisondamagetype;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(fastspeed, F, Actor)
{
PROP_DOUBLE_PARM(i, 0);
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
static_cast<PClassActor *>(info)->FastSpeed = i;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(radiusdamagefactor, F, Actor)
{
PROP_DOUBLE_PARM(i, 0);
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
static_cast<PClassActor *>(info)->RDFactor = i;
defaults->RadiusDamageFactor = i;
}
//==========================================================================
@ -1336,8 +1325,7 @@ DEFINE_PROPERTY(radiusdamagefactor, F, Actor)
DEFINE_PROPERTY(selfdamagefactor, F, Actor)
{
PROP_DOUBLE_PARM(i, 0);
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
static_cast<PClassActor *>(info)->SelfDamageFactor = i;
defaults->SelfDamageFactor = i;
}
//==========================================================================
@ -1346,8 +1334,7 @@ DEFINE_PROPERTY(selfdamagefactor, F, Actor)
DEFINE_PROPERTY(stealthalpha, F, Actor)
{
PROP_DOUBLE_PARM(i, 0);
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
static_cast<PClassActor *>(info)->StealthAlpha = i;
defaults->StealthAlpha = i;
}
//==========================================================================

View file

@ -190,6 +190,9 @@ class Actor : Thinker native
native voidptr /*DecalBase*/ DecalGenerator;
native uint8 fountaincolor;
native double CameraHeight; // Height of camera when used as such
native double RadiusDamageFactor; // Radius damage factor
native double SelfDamageFactor;
native double StealthAlpha;
native meta String Obituary; // Player was killed by this actor
native meta String HitObituary; // Player was killed by this actor in melee
@ -198,8 +201,6 @@ class Actor : Thinker native
native meta color BloodColor; // Colorized blood
native meta int GibHealth; // Negative health below which this monster dies an extreme death
native meta int WoundHealth; // Health needed to enter wound state
native meta double FastSpeed; // speed in fast mode
native meta double RDFactor; // Radius damage factor
native meta Sound HowlSound; // Sound being played when electrocuted or poisoned
meta Name BloodType; // Blood replacement type
@ -212,6 +213,7 @@ class Actor : Thinker native
meta Sound MeleeSound;
meta double MissileHeight;
meta Name MissileName;
meta double FastSpeed; // speed in fast mode
Property prefix: none;
Property MeleeDamage: MeleeDamage;
@ -222,6 +224,7 @@ class Actor : Thinker native
Property ExplosionRadius: ExplosionRadius;
Property ExplosionDamage: ExplosionDamage;
Property BloodType: BloodType, BloodType2, BloodType3;
Property FastSpeed: FastSpeed;
// need some definition work first
//FRenderStyle RenderStyle;
@ -290,6 +293,11 @@ class Actor : Thinker native
VisiblePitch 0, 0;
DefaultStateUsage SUF_ACTOR|SUF_OVERLAY;
CameraHeight int.min;
FastSpeed -1;
RadiusDamageFactor 1;
SelfDamageFactor 1;
StealthAlpha 0;
}
// Functions