mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-17 09:51:26 +00:00
- fixed: CreateDamageFunction needs to return NULL for a damage value of 0 to preserve the collision detection handling of non-damaging actors.
SVN r3920 (scripting)
This commit is contained in:
parent
6e88529324
commit
b630410372
2 changed files with 17 additions and 8 deletions
|
@ -3410,7 +3410,8 @@ void AActor::Tick ()
|
||||||
// won't hurt anything. Don't do this if damage is 0! That way, you can
|
// 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
|
// still have missiles that go straight up and down through actors without
|
||||||
// damaging anything.
|
// 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;
|
velx = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,11 +446,19 @@ void LoadActors ()
|
||||||
|
|
||||||
VMScriptFunction *CreateDamageFunction(int dmg)
|
VMScriptFunction *CreateDamageFunction(int dmg)
|
||||||
{
|
{
|
||||||
VMFunctionBuilder build;
|
if (dmg == 0)
|
||||||
build.Registers[REGT_POINTER].Get(1); // The self pointer
|
{
|
||||||
build.EmitRetInt(0, false, dmg);
|
// For zero damage, do not create a function so that the special collision detection case still works as before.
|
||||||
build.EmitRetInt(1, true, 0);
|
return NULL;
|
||||||
VMScriptFunction *sfunc = build.MakeFunction();
|
}
|
||||||
sfunc->NumArgs = 1;
|
else
|
||||||
return sfunc;
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue