mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- added FDARI*s damagetype fix
SVN r3533 (trunk)
This commit is contained in:
parent
4637ed53fa
commit
26dbec2aae
5 changed files with 12 additions and 5 deletions
|
@ -562,7 +562,6 @@ DamageTypeDefinition *DamageTypeDefinition::Get(FName const type)
|
|||
|
||||
bool DamageTypeDefinition::IgnoreArmor(FName const type)
|
||||
{
|
||||
if (type == NAME_Drowning) return true;
|
||||
DamageTypeDefinition *dtd = Get(type);
|
||||
if (dtd) return dtd->NoArmor;
|
||||
return false;
|
||||
|
@ -609,12 +608,11 @@ int DamageTypeDefinition::ApplyMobjDamageFactor(int damage, FName const type, Dm
|
|||
|
||||
{
|
||||
fixed_t const *pdf = factors->CheckKey(NAME_None);
|
||||
DamageTypeDefinition *dtd = Get(type);
|
||||
// Here we are looking for modifications to untyped damage
|
||||
// If the calling actor defines untyped damage factor, that is contained in "pdf".
|
||||
if (pdf) // normal damage available
|
||||
{
|
||||
DamageTypeDefinition *dtd = Get(type);
|
||||
|
||||
if (dtd)
|
||||
{
|
||||
if (dtd->ReplaceFactor) return FixedMul(damage, dtd->DefaultFactor); // use default instead of untyped factor
|
||||
|
@ -622,6 +620,10 @@ int DamageTypeDefinition::ApplyMobjDamageFactor(int damage, FName const type, Dm
|
|||
}
|
||||
return FixedMul(damage, *pdf); // there was no default, so actor default is used
|
||||
}
|
||||
else if (dtd)
|
||||
{
|
||||
return FixedMul(damage, dtd->DefaultFactor); // implicit untyped factor 1.0 does not need to be applied/replaced explicitly
|
||||
}
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
void Apply(FName const type);
|
||||
void Clear()
|
||||
{
|
||||
DefaultFactor = (fixed_t)1;
|
||||
DefaultFactor = FRACUNIT;
|
||||
ReplaceFactor = false;
|
||||
NoArmor = false;
|
||||
}
|
||||
|
|
|
@ -1202,7 +1202,7 @@ static void ParseDamageDefinition(FScanner &sc)
|
|||
if (sc.Compare("FACTOR"))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
dtd.DefaultFactor = (fixed_t)sc.Float;
|
||||
dtd.DefaultFactor = FLOAT2FIXED(sc.Float);
|
||||
if (!dtd.DefaultFactor) dtd.ReplaceFactor = true; // Multiply by 0 yields 0: FixedMul(damage, FixedMul(factor, 0)) is more wasteful than FixedMul(factor, 0)
|
||||
}
|
||||
else if (sc.Compare("REPLACEFACTOR"))
|
||||
|
|
4
wadsrc/static/actors/shared/damagetypes.txt
Normal file
4
wadsrc/static/actors/shared/damagetypes.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
damagetype Drowning
|
||||
{
|
||||
NoArmor
|
||||
}
|
|
@ -29,6 +29,7 @@
|
|||
#include "actors/shared/sectoraction.txt"
|
||||
#include "actors/shared/action.txt"
|
||||
#include "actors/shared/dog.txt"
|
||||
#include "actors/shared/damagetypes.txt"
|
||||
|
||||
#include "actors/doom/doomplayer.txt"
|
||||
#include "actors/doom/possessed.txt"
|
||||
|
|
Loading…
Reference in a new issue