Added CheckReplacee.
- Allows defining of what actor is replacing another for information. - If multiple arachnotrons, a modder can attribute them as being a replacer of Arachnotron itself, allowing A_BossDeath and GetReplacee to work with it.
This commit is contained in:
parent
b9e71d6db3
commit
b1c508fa6c
4 changed files with 56 additions and 1 deletions
|
|
@ -535,6 +535,14 @@ bool E_CheckReplacement( PClassActor *replacee, PClassActor **replacement )
|
|||
return final;
|
||||
}
|
||||
|
||||
bool E_CheckReplacee(PClassActor **replacee, PClassActor *replacement)
|
||||
{
|
||||
bool final = false;
|
||||
for (DStaticEventHandler *handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||
handler->CheckReplacee(replacee, replacement, &final);
|
||||
return final;
|
||||
}
|
||||
|
||||
void E_NewGame(EventHandlerType handlerType)
|
||||
{
|
||||
bool isStatic = handlerType == EventHandlerType::Global;
|
||||
|
|
@ -626,6 +634,10 @@ DEFINE_FIELD_X(ReplaceEvent, FReplaceEvent, Replacee)
|
|||
DEFINE_FIELD_X(ReplaceEvent, FReplaceEvent, Replacement)
|
||||
DEFINE_FIELD_X(ReplaceEvent, FReplaceEvent, IsFinal)
|
||||
|
||||
DEFINE_FIELD_X(ReplacedEvent, FReplacedEvent, Replacee)
|
||||
DEFINE_FIELD_X(ReplacedEvent, FReplacedEvent, Replacement)
|
||||
DEFINE_FIELD_X(ReplacedEvent, FReplacedEvent, IsFinal)
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStaticEventHandler, SetOrder)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DStaticEventHandler);
|
||||
|
|
@ -1192,6 +1204,21 @@ void DStaticEventHandler::CheckReplacement( PClassActor *replacee, PClassActor *
|
|||
}
|
||||
}
|
||||
|
||||
void DStaticEventHandler::CheckReplacee(PClassActor **replacee, PClassActor *replacement, bool *final)
|
||||
{
|
||||
IFVIRTUAL(DStaticEventHandler, CheckReplacee)
|
||||
{
|
||||
// don't create excessive DObjects if not going to be processed anyway
|
||||
if (isEmpty(func)) return;
|
||||
FReplacedEvent e = { *replacee, replacement, *final };
|
||||
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||
VMCall(func, params, 2, nullptr, 0);
|
||||
if (e.Replacee != replacement) // prevent infinite recursion
|
||||
*replacee = e.Replacee;
|
||||
*final = e.IsFinal;
|
||||
}
|
||||
}
|
||||
|
||||
void DStaticEventHandler::NewGame()
|
||||
{
|
||||
IFVIRTUAL(DStaticEventHandler, NewGame)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue