In info.cpp:
Code: Select all
void FActorInfo::SetDamageReduction(FName type, fixed_t factor)
{
if (DamageReductions == NULL)
{
DamageReductions = new DmgReductions;
}
DamageReductions->Insert(type, factor);
}
Code: Select all
struct DmgReductions : public TMap<FName, int>
{
int *CheckFactor(FName type);
};
Code: Select all
void SetDamageReduction(FName type, fixed_t factor);
DmgReductions *DamageReductions;
Code: Select all
const int* reduction = NULL;
DmgReductions *dr = PClass::FindClass(ArmorType)->ActorInfo->DamageReductions;
if (dr != NULL && dr->CountUsed() != 0)
{
reduction = dr->CheckFactor(damageType);
if (reduction != NULL)
{
damage = newdamage = damage-reduction;
if (damage < 0)
{
damage = newdamage = 0;
}
}
}
Thanks. I understand similar effects could be achieved (and indeed have been) with more cumbersome ACS or decorate workarounds, but it seemed so easy to implement at the source level I thought I'd ask here.
Thanks! I've put more hours into enjoying doom than any other game ever!