Allow retrieval of the custom Crush state in WorldThingGround

This commit is contained in:
nashmuhandes 2020-09-30 09:56:36 +08:00 committed by Christoph Oelckers
commit 6e692e5571
4 changed files with 13 additions and 8 deletions

View file

@ -331,16 +331,16 @@ void EventManager::WorldThingDied(AActor* actor, AActor* inflictor)
handler->WorldThingDied(actor, inflictor);
}
void EventManager::WorldThingGround(AActor* actor)
void EventManager::WorldThingGround(AActor* actor, FState* st)
{
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
if (actor->ObjectFlags & OF_EuthanizeMe)
return;
if (ShouldCallStatic(true)) staticEventManager.WorldThingGround(actor);
if (ShouldCallStatic(true)) staticEventManager.WorldThingGround(actor, st);
for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next)
handler->WorldThingGround(actor);
handler->WorldThingGround(actor, st);
}
void EventManager::WorldThingRevived(AActor* actor)
@ -646,6 +646,7 @@ DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageLineSide);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamagePosition);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageIsRadius);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, NewDamage);
DEFINE_FIELD_X(WorldEvent, FWorldEvent, CrushedState);
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, IsReturn);
@ -807,7 +808,7 @@ void DStaticEventHandler::WorldThingDied(AActor* actor, AActor* inflictor)
}
}
void DStaticEventHandler::WorldThingGround(AActor* actor)
void DStaticEventHandler::WorldThingGround(AActor* actor, FState* st)
{
IFVIRTUAL(DStaticEventHandler, WorldThingGround)
{
@ -815,6 +816,7 @@ void DStaticEventHandler::WorldThingGround(AActor* actor)
if (isEmpty(func)) return;
FWorldEvent e = owner->SetupWorldEvent();
e.Thing = actor;
e.CrushedState = st;
VMValue params[2] = { (DStaticEventHandler*)this, &e };
VMCall(func, params, 2, nullptr, 0);
}