- Keep all damage factors in the table, even those that are 1.0.

- 256 is a valid pain chance, so clamp to that, not 255.

SVN r2237 (trunk)
This commit is contained in:
Randy Heit 2010-03-22 21:18:54 +00:00
parent d1f9b94743
commit 0ca693771b
3 changed files with 6 additions and 11 deletions

View file

@ -273,17 +273,12 @@ FActorInfo *FActorInfo::GetReplacee (bool lookskill)
void FActorInfo::SetDamageFactor(FName type, fixed_t factor)
{
if (factor != FRACUNIT)
if (DamageFactors == NULL)
{
if (DamageFactors == NULL) DamageFactors=new DmgFactors;
DamageFactors = new DmgFactors;
}
DamageFactors->Insert(type, factor);
}
else
{
if (DamageFactors != NULL)
DamageFactors->Remove(type);
}
}
//==========================================================================
//
@ -295,7 +290,7 @@ void FActorInfo::SetPainChance(FName type, int chance)
if (chance >= 0)
{
if (PainChances == NULL) PainChances=new PainChanceList;
PainChances->Insert(type, MIN(chance, 255));
PainChances->Insert(type, MIN(chance, 256));
}
else
{

View file

@ -158,7 +158,7 @@ struct FPlayerColorSet
};
typedef TMap<FName, fixed_t> DmgFactors;
typedef TMap<FName, BYTE> PainChanceList;
typedef TMap<FName, int> PainChanceList;
typedef TMap<int, FPlayerColorSet> FPlayerColorSetMap;
struct FActorInfo

View file

@ -1285,7 +1285,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
painchance = target->PainChance;
if (pc != NULL)
{
BYTE * ppc = pc->CheckKey(mod);
int *ppc = pc->CheckKey(mod);
if (ppc != NULL)
{
painchance = *ppc;