mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 15:22:08 +00:00
Adds "OnGiveSecret" virtual function on Actor for customizing behavior of secret finding.
This commit is contained in:
parent
674b6ee85c
commit
477cf23fd2
2 changed files with 13 additions and 1 deletions
|
@ -589,7 +589,15 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu
|
||||||
{
|
{
|
||||||
actor->player->secretcount++;
|
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)
|
if (printmessage)
|
||||||
{
|
{
|
||||||
|
@ -616,6 +624,7 @@ DEFINE_ACTION_FUNCTION(AActor, GiveSecret)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret)
|
DEFINE_ACTION_FUNCTION(FLevelLocals, GiveSecret)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
|
|
|
@ -540,6 +540,9 @@ class Actor : Thinker native
|
||||||
return damage;
|
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 virtual bool OkayToSwitchTarget(Actor other);
|
||||||
native static class<Actor> GetReplacement(class<Actor> cls);
|
native static class<Actor> GetReplacement(class<Actor> cls);
|
||||||
native static class<Actor> GetReplacee(class<Actor> cls);
|
native static class<Actor> GetReplacee(class<Actor> cls);
|
||||||
|
|
Loading…
Reference in a new issue