- fixed: Application of inflictor's death damage type was done too late and missed a few spots where it needed.

- fixed: DamageTypeReceived was not serialized.
- fixed: The check for unhandled damage type was rendered ineffective by the old code handling the DeathType.
This commit is contained in:
Christoph Oelckers 2013-06-24 15:40:17 +02:00
parent baa82c396c
commit 9f253ccae3
3 changed files with 14 additions and 7 deletions

View file

@ -657,14 +657,13 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
FState *diestate = NULL; FState *diestate = NULL;
FName damagetype = (inflictor && inflictor->DeathType != NAME_None) ? inflictor->DeathType : DamageType;
if (damagetype != NAME_None) if (DamageType != NAME_None)
{ {
diestate = FindState (NAME_Death, damagetype, true); diestate = FindState (NAME_Death, DamageType, true);
if (diestate == NULL) if (diestate == NULL)
{ {
if (damagetype == NAME_Ice) if (DamageType == NAME_Ice)
{ // If an actor doesn't have an ice death, we can still give them a generic one. { // If an actor doesn't have an ice death, we can still give them a generic one.
if (!deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH) && (player || (flags3 & MF3_ISMONSTER))) if (!deh.NoAutofreeze && !(flags4 & MF4_NOICEDEATH) && (player || (flags3 & MF3_ISMONSTER)))
@ -683,9 +682,9 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
// Don't pass on a damage type this actor cannot handle. // Don't pass on a damage type this actor cannot handle.
// (most importantly, prevent barrels from passing on ice damage.) // (most importantly, prevent barrels from passing on ice damage.)
// Massacre must be preserved though. // Massacre must be preserved though.
if (damagetype != NAME_Massacre) if (DamageType != NAME_Massacre)
{ {
damagetype = NAME_None; DamageType = NAME_None;
} }
if ((health < gibhealth || flags4 & MF4_EXTREMEDEATH) && !(flags4 & MF4_NOEXTREMEDEATH)) if ((health < gibhealth || flags4 & MF4_EXTREMEDEATH) && !(flags4 & MF4_NOEXTREMEDEATH))
@ -1278,6 +1277,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (target->health <= 0) if (target->health <= 0)
{ // Death { // Death
target->special1 = damage; target->special1 = damage;
// use inflictor's death type if it got one.
if (inflictor && inflictor->DeathType != NAME_None) mod = inflictor->DeathType;
// check for special fire damage or ice damage deaths // check for special fire damage or ice damage deaths
if (mod == NAME_Fire) if (mod == NAME_Fire)
{ {

View file

@ -270,6 +270,10 @@ void AActor::Serialize (FArchive &arc)
<< meleethreshold << meleethreshold
<< meleerange << meleerange
<< DamageType; << DamageType;
if (SaveVersion >= 4501)
{
arc << DamageTypeReceived;
}
if (SaveVersion >= 3237) if (SaveVersion >= 3237)
{ {
arc arc

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 4500 #define SAVEVER 4501
#define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY2(x) #x
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)