From 38780d2d2aa014b47d794fa8dc32a8fbae6b0589 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 11 Sep 2009 01:00:01 +0000 Subject: [PATCH] - Fixed: If a damaged actor has negative mass, it needs to have its damage thrust set to maximum instead of 0. See Action Doom's broken glass "CommanderKeens". SVN r1816 (trunk) --- docs/rh-log.txt | 3 +++ src/p_interaction.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e2330b2642..835cc4d3d5 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ September 10, 2009 +- Fixed: If a damaged actor has negative mass, it needs to have its damage + thrust set to maximum instead of 0. See Action Doom's broken glass + "CommanderKeens". - Changed the SCROLLTYPE define so that any extra bits set cause it to default to 7. This effects action.wad, MAP02, lines 12054 and 12059, which had them at 128, so they no longer scrolled in r832+. diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index c3d38d1909..a0d53c1f5d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1047,7 +1047,13 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage // Calculate this as float to avoid overflows so that the // clamping that had to be done here can be removed. - double fltthrust = clamp((damage * 0.125 * kickback) / target->Mass, 0.,mod == NAME_MDK? 10. : 32.); + double fltthrust; + + fltthrust = mod == NAME_MDK ? 10 : 32; + if (target->Mass > 0) + { + fltthrust = clamp((damage * 0.125 * kickback) / target->Mass, 0., fltthrust); + } thrust = FLOAT2FIXED(fltthrust);