diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 5b32b410a..e8dbe8d2f 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -589,7 +589,15 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu { actor->player->secretcount++; } - if (cl_showsecretmessage && actor->CheckLocalView(consoleplayer)) + int retval = 1; + IFVIRTUALPTR(actor, AActor, OnGiveSecret) + { + VMValue params[] = { actor, printmessage, playsound }; + VMReturn ret; + ret.IntAt(&retval); + VMCall(func, params, countof(params), &ret, 1); + } + if (retval && cl_showsecretmessage && actor->CheckLocalView(consoleplayer)) { if (printmessage) { @@ -616,6 +624,7 @@ DEFINE_ACTION_FUNCTION(AActor, GiveSecret) return 0; } + DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret) { PARAM_PROLOGUE; diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 61afdef0d..5eb3a16ad 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -539,6 +539,9 @@ class Actor : Thinker native { return damage; } + + // called on getting a secret, return false to disable default "secret found" message/sound + virtual bool OnGiveSecret(bool printmsg, bool playsound); native virtual bool OkayToSwitchTarget(Actor other); native static class GetReplacement(class cls);