From 9f253ccae368db8448a31a544d126c613ce0c120 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 24 Jun 2013 15:40:17 +0200 Subject: [PATCH] - 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. --- src/p_interaction.cpp | 15 +++++++++------ src/p_mobj.cpp | 4 ++++ src/version.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 96b52e0b7..4ac5fceb9 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -657,14 +657,13 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags) 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 (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 (!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. // (most importantly, prevent barrels from passing on ice damage.) // 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)) @@ -1278,6 +1277,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, if (target->health <= 0) { // Death 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 if (mod == NAME_Fire) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index aff990907..41b41aec6 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -270,6 +270,10 @@ void AActor::Serialize (FArchive &arc) << meleethreshold << meleerange << DamageType; + if (SaveVersion >= 4501) + { + arc << DamageTypeReceived; + } if (SaveVersion >= 3237) { arc diff --git a/src/version.h b/src/version.h index 0e290c775..4b6dc14a7 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4500 +#define SAVEVER 4501 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)