Fixed VM abort with null activator for SecretTrigger object

https://forum.zdoom.org/viewtopic.php?t=57612
This commit is contained in:
alexey.lysiuk 2017-08-18 11:25:33 +03:00
parent ec42e30614
commit 69e7bb57d4
3 changed files with 12 additions and 1 deletions

View file

@ -602,6 +602,16 @@ DEFINE_ACTION_FUNCTION(AActor, GiveSecret)
return 0;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret)
{
PARAM_PROLOGUE;
PARAM_OBJECT(activator, AActor);
PARAM_BOOL_DEF(printmessage);
PARAM_BOOL_DEF(playsound);
P_GiveSecret(activator, printmessage, playsound, -1);
return 0;
}
//============================================================================
//
// P_PlayerOnSpecialFlat

View file

@ -530,6 +530,7 @@ struct LevelLocals native
native int GetUDMFInt(int type, int index, Name key);
native double GetUDMFFloat(int type, int index, Name key);
native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
native static void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
native static void StartSlideshow(Name whichone = 'none');
native static void WorldDone();
native static void RemoveAllBots(bool fromlist);

View file

@ -17,7 +17,7 @@ class SecretTrigger : Actor
override void Activate (Actor activator)
{
activator.GiveSecret(args[0] <= 1, (args[0] == 0 || args[0] == 2));
Level.GiveSecret(activator, args[0] <= 1, (args[0] == 0 || args[0] == 2));
Destroy ();
}