diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 458ed36f0d..c1be116eea 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3410,7 +3410,8 @@ void AActor::Tick () // won't hurt anything. Don't do this if damage is 0! That way, you can // still have missiles that go straight up and down through actors without // damaging anything. - if ((flags & MF_MISSILE) && (velx|vely) == 0 && Damage != 0) + // (for backwards compatibility this must check for lack of damage function, not for zero damage!) + if ((flags & MF_MISSILE) && (velx|vely) == 0 && Damage != NULL) { velx = 1; } diff --git a/src/thingdef/thingdef.cpp b/src/thingdef/thingdef.cpp index d162a9f107..8a3589a997 100644 --- a/src/thingdef/thingdef.cpp +++ b/src/thingdef/thingdef.cpp @@ -446,11 +446,19 @@ void LoadActors () VMScriptFunction *CreateDamageFunction(int dmg) { - VMFunctionBuilder build; - build.Registers[REGT_POINTER].Get(1); // The self pointer - build.EmitRetInt(0, false, dmg); - build.EmitRetInt(1, true, 0); - VMScriptFunction *sfunc = build.MakeFunction(); - sfunc->NumArgs = 1; - return sfunc; + if (dmg == 0) + { + // For zero damage, do not create a function so that the special collision detection case still works as before. + return NULL; + } + else + { + VMFunctionBuilder build; + build.Registers[REGT_POINTER].Get(1); // The self pointer + build.EmitRetInt(0, false, dmg); + build.EmitRetInt(1, true, 0); + VMScriptFunction *sfunc = build.MakeFunction(); + sfunc->NumArgs = 1; + return sfunc; + } }