Merge branch 'APROP_DamageMultiply' of https://github.com/Edward850/zdoom

This commit is contained in:
Christoph Oelckers 2014-11-25 16:28:36 +01:00
commit 64d88166cc
4 changed files with 26 additions and 4 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);
if (source->Inventory != NULL)
{
source->Inventory->ModifyDamage(olddam, mod, damage, false);
}
damage = FixedMul(damage, source->DamageMultiply);
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

@ -312,8 +312,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)
@ -3867,6 +3875,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