mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 21:11:52 +00:00
Add WorldRailgunFired
This commit is contained in:
parent
063239d7b9
commit
0f037cfd64
4 changed files with 34 additions and 1 deletions
|
@ -752,6 +752,18 @@ void EventManager::WorldHitscanFired(AActor* actor, const DVector3& AttackPos, c
|
|||
handler->WorldHitscanFired(actor, AttackPos, DamagePosition, Inflictor, flags);
|
||||
}
|
||||
|
||||
void EventManager::WorldRailgunFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags)
|
||||
{
|
||||
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
|
||||
if (actor->ObjectFlags & OF_EuthanizeMe)
|
||||
return;
|
||||
|
||||
if (ShouldCallStatic(true)) staticEventManager.WorldRailgunFired(actor, AttackPos, DamagePosition, Inflictor, flags);
|
||||
|
||||
for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next)
|
||||
handler->WorldRailgunFired(actor, AttackPos, DamagePosition, Inflictor, flags);
|
||||
}
|
||||
|
||||
void EventManager::WorldThingGround(AActor* actor, FState* st)
|
||||
{
|
||||
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
|
||||
|
@ -1865,6 +1877,23 @@ void DStaticEventHandler::WorldHitscanFired(AActor* actor, const DVector3& Attac
|
|||
}
|
||||
}
|
||||
|
||||
void DStaticEventHandler::WorldRailgunFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags)
|
||||
{
|
||||
IFVIRTUAL(DStaticEventHandler, WorldRailgunFired)
|
||||
{
|
||||
// don't create excessive DObjects if not going to be processed anyway
|
||||
if (isEmpty(func)) return;
|
||||
FWorldEvent e = owner->SetupWorldEvent();
|
||||
e.Thing = actor;
|
||||
e.AttackPos = AttackPos;
|
||||
e.DamagePosition = DamagePosition;
|
||||
e.Inflictor = Inflictor;
|
||||
e.AttackLineFlags = flags;
|
||||
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||
VMCall(func, params, 2, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void DStaticEventHandler::WorldThingGround(AActor* actor, FState* st)
|
||||
{
|
||||
IFVIRTUAL(DStaticEventHandler, WorldThingGround)
|
||||
|
|
|
@ -315,6 +315,7 @@ public:
|
|||
bool WorldHitscanPreFired(AActor* actor, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, double sz, double offsetforward, double offsetside);
|
||||
bool WorldRailgunPreFired(FName damageType, PClassActor* pufftype, FRailParams* param);
|
||||
void WorldHitscanFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags);
|
||||
void WorldRailgunFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags);
|
||||
void WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate);
|
||||
void WorldLineActivated(line_t* line, AActor* actor, int activationType);
|
||||
int WorldSectorDamaged(sector_t* sector, AActor* source, int damage, FName damagetype, int part, DVector3 position, bool isradius);
|
||||
|
@ -485,6 +486,8 @@ struct EventManager
|
|||
bool WorldHitscanPreFired(AActor* actor, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, double sz, double offsetforward, double offsetside);
|
||||
// called when a hitscan attack has been fired
|
||||
void WorldHitscanFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags);
|
||||
// called when a railgun attack has been fired
|
||||
void WorldRailgunFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags);
|
||||
// called when a railgun attack has been fired (can be overridden to block it)
|
||||
bool WorldRailgunPreFired(FName damageType, PClassActor* pufftype, FRailParams* param);
|
||||
// called inside AActor::Grind just before the corpse is destroyed
|
||||
|
|
|
@ -5577,7 +5577,7 @@ void P_RailAttack(FRailParams *p)
|
|||
}
|
||||
}
|
||||
|
||||
source->Level->localEventManager->WorldHitscanFired(source, start, trace.HitPos, thepuff, flags);
|
||||
source->Level->localEventManager->WorldRailgunFired(source, start, trace.HitPos, thepuff, flags);
|
||||
|
||||
if (thepuff != NULL)
|
||||
{
|
||||
|
|
|
@ -167,6 +167,7 @@ class StaticEventHandler : Object native play version("2.4")
|
|||
virtual void WorldThingDestroyed(WorldEvent e) {}
|
||||
virtual bool WorldHitscanPreFired(WorldEvent e) { return false; }
|
||||
virtual bool WorldRailgunPreFired(WorldEvent e) { return false; }
|
||||
virtual void WorldRailgunFired(WorldEvent e) {}
|
||||
virtual void WorldHitscanFired(WorldEvent e) {}
|
||||
virtual void WorldLinePreActivated(WorldEvent e) {}
|
||||
virtual void WorldLineActivated(WorldEvent e) {}
|
||||
|
|
Loading…
Reference in a new issue