Added APROP_DamageMultiply

- Used with Set/GetActorProperty, adds a generic multiplier for damage a
source deals.
This commit is contained in:
Edward Richardson 2014-11-20 18:57:40 +13:00
parent 601852d224
commit 99b2cfa147
5 changed files with 27 additions and 5 deletions

View file

@ -971,6 +971,7 @@ public:
FNameNoInit DamageType; FNameNoInit DamageType;
FNameNoInit DamageTypeReceived; FNameNoInit DamageTypeReceived;
fixed_t DamageFactor; fixed_t DamageFactor;
fixed_t DamageMultiply;
FNameNoInit PainType; FNameNoInit PainType;
FNameNoInit DeathType; FNameNoInit DeathType;

View file

@ -3673,6 +3673,7 @@ enum
APROP_AttackZOffset = 40, APROP_AttackZOffset = 40,
APROP_StencilColor = 41, APROP_StencilColor = 41,
APROP_Friction = 42, APROP_Friction = 42,
APROP_DamageMultiplier=43,
}; };
// These are needed for ACS's APROP_RenderStyle // These are needed for ACS's APROP_RenderStyle
@ -3862,6 +3863,10 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
actor->DamageFactor = value; actor->DamageFactor = value;
break; break;
case APROP_DamageMultiplier:
actor->DamageMultiply = value;
break;
case APROP_MasterTID: case APROP_MasterTID:
AActor *other; AActor *other;
other = SingleActorFromTID (value, NULL); other = SingleActorFromTID (value, NULL);
@ -3933,6 +3938,7 @@ int DLevelScript::GetActorProperty (int tid, int property, const SDWORD *stack,
case APROP_Speed: return actor->Speed; case APROP_Speed: return actor->Speed;
case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead? case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead?
case APROP_DamageFactor:return actor->DamageFactor; case APROP_DamageFactor:return actor->DamageFactor;
case APROP_DamageMultiplier: return actor->DamageMultiply;
case APROP_Alpha: return actor->alpha; case APROP_Alpha: return actor->alpha;
case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style) case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style)
{ // Check for a legacy render style that matches. { // Check for a legacy render style that matches.

View file

@ -1065,10 +1065,16 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
} }
} }
// Handle active damage modifiers (e.g. PowerDamage) // Handle active damage modifiers (e.g. PowerDamage)
if (source != NULL && source->Inventory != NULL) if (source != NULL)
{ {
int olddam = damage; int olddam = damage;
source->Inventory->ModifyDamage(olddam, mod, damage, false);
damage = FixedMul(damage, source->DamageMultiply);
if (source->Inventory != NULL)
{
source->Inventory->ModifyDamage(olddam, mod, damage, false);
}
if (olddam != damage && damage <= 0) if (olddam != damage && damage <= 0)
{ // Still allow FORCEPAIN { // Still allow FORCEPAIN
if (MustForcePain(target, inflictor)) if (MustForcePain(target, inflictor))

View file

@ -313,8 +313,16 @@ void AActor::Serialize (FArchive &arc)
} }
arc << lastpush << lastbump arc << lastpush << lastbump
<< PainThreshold << PainThreshold
<< DamageFactor << DamageFactor;
<< WeaveIndexXY << WeaveIndexZ if (SaveVersion >= 4516)
{
arc << DamageMultiply;
}
else
{
DamageMultiply = FRACUNIT;
}
arc << WeaveIndexXY << WeaveIndexZ
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner << PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
<< PoisonDamage << PoisonDuration << PoisonPeriod; << PoisonDamage << PoisonDuration << PoisonPeriod;
if (SaveVersion >= 3235) if (SaveVersion >= 3235)
@ -3868,6 +3876,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t
actor->touching_sectorlist = NULL; // NULL head of sector list // phares 3/13/98 actor->touching_sectorlist = NULL; // NULL head of sector list // phares 3/13/98
if (G_SkillProperty(SKILLP_FastMonsters)) if (G_SkillProperty(SKILLP_FastMonsters))
actor->Speed = actor->GetClass()->Meta.GetMetaFixed(AMETA_FastSpeed, actor->Speed); actor->Speed = actor->GetClass()->Meta.GetMetaFixed(AMETA_FastSpeed, actor->Speed);
actor->DamageMultiply = FRACUNIT;
// set subsector and/or block links // set subsector and/or block links

View file

@ -76,7 +76,7 @@ const char *GetVersionString();
// Use 4500 as the base git save version, since it's higher than the // Use 4500 as the base git save version, since it's higher than the
// SVN revision ever got. // SVN revision ever got.
#define SAVEVER 4515 #define SAVEVER 4516
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)