Merge commit '878c5f0857' into gzd-master-experimental
This commit is contained in:
commit
e73969d5a5
7 changed files with 244 additions and 44 deletions
|
|
@ -701,6 +701,36 @@ void EventManager::WorldThingDied(AActor* actor, AActor* inflictor)
|
||||||
handler->WorldThingDied(actor, inflictor);
|
handler->WorldThingDied(actor, inflictor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EventManager::WorldHitscanPreFired(AActor* actor, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, double sz, double offsetforward, double offsetside)
|
||||||
|
{
|
||||||
|
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
|
||||||
|
if (actor->ObjectFlags & OF_EuthanizeMe)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
if (ShouldCallStatic(true)) ret = staticEventManager.WorldHitscanPreFired(actor, angle, distance, pitch, damage, damageType, pufftype, flags, sz, offsetforward, offsetside);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
for (DStaticEventHandler* handler = FirstEventHandler; handler && ret == false; handler = handler->next)
|
||||||
|
ret = handler->WorldHitscanPreFired(actor, angle, distance, pitch, damage, damageType, pufftype, flags, sz, offsetforward, offsetside);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventManager::WorldHitscanFired(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.WorldHitscanFired(actor, AttackPos, DamagePosition, Inflictor, flags);
|
||||||
|
|
||||||
|
for (DStaticEventHandler* handler = FirstEventHandler; handler; handler = handler->next)
|
||||||
|
handler->WorldHitscanFired(actor, AttackPos, DamagePosition, Inflictor, flags);
|
||||||
|
}
|
||||||
|
|
||||||
void EventManager::WorldThingGround(AActor* actor, FState* st)
|
void EventManager::WorldThingGround(AActor* actor, FState* st)
|
||||||
{
|
{
|
||||||
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
|
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
|
||||||
|
|
@ -1026,6 +1056,14 @@ DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamagePosition);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageIsRadius);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, DamageIsRadius);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, NewDamage);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, NewDamage);
|
||||||
DEFINE_FIELD_X(WorldEvent, FWorldEvent, CrushedState);
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, CrushedState);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackPos);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackAngle);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackPitch);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackDistance);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackOffsetForward);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackOffsetSide);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackZ);
|
||||||
|
DEFINE_FIELD_X(WorldEvent, FWorldEvent, AttackPuffType);
|
||||||
|
|
||||||
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
|
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, PlayerNumber);
|
||||||
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, IsReturn);
|
DEFINE_FIELD_X(PlayerEvent, FPlayerEvent, IsReturn);
|
||||||
|
|
@ -1729,6 +1767,51 @@ void DStaticEventHandler::WorldThingDied(AActor* actor, AActor* inflictor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DStaticEventHandler::WorldHitscanPreFired(AActor* actor, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, double sz, double offsetforward, double offsetside)
|
||||||
|
{
|
||||||
|
IFVIRTUAL(DStaticEventHandler, WorldHitscanPreFired)
|
||||||
|
{
|
||||||
|
// don't create excessive DObjects if not going to be processed anyway
|
||||||
|
if (isEmpty(func)) return false;
|
||||||
|
FWorldEvent e = owner->SetupWorldEvent();
|
||||||
|
e.Thing = actor;
|
||||||
|
e.AttackAngle = angle;
|
||||||
|
e.AttackPitch = pitch;
|
||||||
|
e.AttackDistance = distance;
|
||||||
|
e.Damage = damage;
|
||||||
|
e.DamageType = damageType;
|
||||||
|
e.AttackPuffType = pufftype;
|
||||||
|
e.AttackOffsetForward = offsetforward;
|
||||||
|
e.AttackOffsetSide = offsetside;
|
||||||
|
e.AttackZ = sz;
|
||||||
|
e.DamageFlags = flags;
|
||||||
|
int processed;
|
||||||
|
VMReturn results[1] = { &processed };
|
||||||
|
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||||
|
VMCall(func, params, 2, results, 1);
|
||||||
|
return !!processed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DStaticEventHandler::WorldHitscanFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags)
|
||||||
|
{
|
||||||
|
IFVIRTUAL(DStaticEventHandler, WorldHitscanFired)
|
||||||
|
{
|
||||||
|
// 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.DamageFlags = flags;
|
||||||
|
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
||||||
|
VMCall(func, params, 2, nullptr, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DStaticEventHandler::WorldThingGround(AActor* actor, FState* st)
|
void DStaticEventHandler::WorldThingGround(AActor* actor, FState* st)
|
||||||
{
|
{
|
||||||
IFVIRTUAL(DStaticEventHandler, WorldThingGround)
|
IFVIRTUAL(DStaticEventHandler, WorldThingGround)
|
||||||
|
|
@ -1743,7 +1826,6 @@ void DStaticEventHandler::WorldThingGround(AActor* actor, FState* st)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DStaticEventHandler::WorldThingRevived(AActor* actor)
|
void DStaticEventHandler::WorldThingRevived(AActor* actor)
|
||||||
{
|
{
|
||||||
IFVIRTUAL(DStaticEventHandler, WorldThingRevived)
|
IFVIRTUAL(DStaticEventHandler, WorldThingRevived)
|
||||||
|
|
|
||||||
14
src/events.h
Executable file → Normal file
14
src/events.h
Executable file → Normal file
|
|
@ -311,6 +311,8 @@ public:
|
||||||
void WorldThingRevived(AActor* actor);
|
void WorldThingRevived(AActor* actor);
|
||||||
void WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle);
|
void WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int damage, FName mod, int flags, DAngle angle);
|
||||||
void WorldThingDestroyed(AActor* actor);
|
void WorldThingDestroyed(AActor* actor);
|
||||||
|
bool WorldHitscanPreFired(AActor* actor, DAngle angle, double distance, DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, double sz, double offsetforward, double offsetside);
|
||||||
|
void WorldHitscanFired(AActor* actor, const DVector3& AttackPos, const DVector3& DamagePosition, AActor* Inflictor, int flags);
|
||||||
void WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate);
|
void WorldLinePreActivated(line_t* line, AActor* actor, int activationType, bool* shouldactivate);
|
||||||
void WorldLineActivated(line_t* line, AActor* actor, int activationType);
|
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);
|
int WorldSectorDamaged(sector_t* sector, AActor* source, int damage, FName damagetype, int part, DVector3 position, bool isradius);
|
||||||
|
|
@ -393,6 +395,14 @@ struct FWorldEvent
|
||||||
bool DamageIsRadius; // radius damage yes/no
|
bool DamageIsRadius; // radius damage yes/no
|
||||||
int NewDamage = 0; // sector/line damaged. allows modifying damage
|
int NewDamage = 0; // sector/line damaged. allows modifying damage
|
||||||
FState* CrushedState = nullptr; // custom crush state set in thingground
|
FState* CrushedState = nullptr; // custom crush state set in thingground
|
||||||
|
DVector3 AttackPos; //hitscan point of origin
|
||||||
|
DAngle AttackAngle;
|
||||||
|
DAngle AttackPitch;
|
||||||
|
double AttackDistance = 0;
|
||||||
|
double AttackOffsetForward = 0;
|
||||||
|
double AttackOffsetSide = 0;
|
||||||
|
double AttackZ = 0;
|
||||||
|
PClassActor* AttackPuffType = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FPlayerEvent
|
struct FPlayerEvent
|
||||||
|
|
@ -467,6 +477,10 @@ struct EventManager
|
||||||
void WorldThingSpawned(AActor* actor);
|
void WorldThingSpawned(AActor* actor);
|
||||||
// called after AActor::Die of each actor.
|
// called after AActor::Die of each actor.
|
||||||
void WorldThingDied(AActor* actor, AActor* inflictor);
|
void WorldThingDied(AActor* actor, AActor* inflictor);
|
||||||
|
// called when a hitscan attack is fired (can be overridden to block it)
|
||||||
|
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 inside AActor::Grind just before the corpse is destroyed
|
// called inside AActor::Grind just before the corpse is destroyed
|
||||||
void WorldThingGround(AActor* actor, FState* st);
|
void WorldThingGround(AActor* actor, FState* st);
|
||||||
// called after AActor::Revive.
|
// called after AActor::Revive.
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,16 @@
|
||||||
|
|
||||||
class DLevelPostProcessor : public DObject
|
class DLevelPostProcessor : public DObject
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(DLevelPostProcessor, DObject)
|
DECLARE_CLASS(DLevelPostProcessor, DObject)
|
||||||
public:
|
public:
|
||||||
MapLoader *loader;
|
MapLoader *loader;
|
||||||
FLevelLocals *Level;
|
FLevelLocals *Level;
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DLevelPostProcessor, true, false);
|
IMPLEMENT_CLASS(DLevelPostProcessor, false, false);
|
||||||
|
|
||||||
void MapLoader::PostProcessLevel(FName checksum)
|
void MapLoader::PostProcessLevel(FName checksum)
|
||||||
{
|
{
|
||||||
auto lc = Create<DLevelPostProcessor>();
|
|
||||||
lc->loader = this;
|
|
||||||
lc->Level = Level;
|
|
||||||
for(auto cls : PClass::AllClasses)
|
for(auto cls : PClass::AllClasses)
|
||||||
{
|
{
|
||||||
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor)))
|
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor)))
|
||||||
|
|
@ -87,8 +84,14 @@ void MapLoader::PostProcessLevel(FName checksum)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto lc = static_cast<DLevelPostProcessor*>(cls->CreateNew());
|
||||||
|
lc->loader = this;
|
||||||
|
lc->Level = Level;
|
||||||
|
|
||||||
VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
|
VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
|
||||||
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
||||||
|
|
||||||
|
lc->Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@
|
||||||
#include "r_utility.h"
|
#include "r_utility.h"
|
||||||
#include "p_blockmap.h"
|
#include "p_blockmap.h"
|
||||||
#include "p_3dmidtex.h"
|
#include "p_3dmidtex.h"
|
||||||
|
#include "events.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "d_main.h"
|
#include "d_main.h"
|
||||||
|
|
||||||
|
|
@ -2107,10 +2108,13 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
while (it.Next(&cres))
|
while (it.Next(&cres))
|
||||||
{
|
{
|
||||||
AActor *thing = cres.thing;
|
AActor *thing = cres.thing;
|
||||||
|
if (!quick && onmobj != NULL && thing->Top() < onmobj->Top())
|
||||||
|
{ // something higher is in the way
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double blockdist = thing->radius + actor->radius;
|
if (thing == actor)
|
||||||
if (fabs(thing->X() - cres.Position.X) >= blockdist || fabs(thing->Y() - cres.Position.Y) >= blockdist)
|
{ // Don't clip against self.
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (thing->flags2 & MF2_THRUACTORS)
|
if (thing->flags2 & MF2_THRUACTORS)
|
||||||
|
|
@ -2121,19 +2125,24 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((actor->flags6 & MF6_THRUSPECIES) && (thing->GetSpecies() == actor->GetSpecies()))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!(thing->flags & MF_SOLID))
|
if (!(thing->flags & MF_SOLID))
|
||||||
{ // Can't hit thing
|
{ // Can't hit thing
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (thing->flags & (MF_SPECIAL | MF_NOCLIP))
|
if ((thing->flags & (MF_SPECIAL | MF_NOCLIP)) || (thing->flags6 & MF6_TOUCHY))
|
||||||
{ // [RH] Specials and noclippers don't block moves
|
{ // [RH] Specials and noclippers don't block moves
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (thing->flags & (MF_CORPSE))
|
const double blockdist = thing->radius + actor->radius;
|
||||||
|
if (fabs(thing->X() - cres.Position.X) >= blockdist || fabs(thing->Y() - cres.Position.Y) >= blockdist)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((actor->flags6 & MF6_THRUSPECIES) && thing->GetSpecies() == actor->GetSpecies())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (thing->flags & MF_CORPSE)
|
||||||
{ // Corpses need a few more checks
|
{ // Corpses need a few more checks
|
||||||
if (!(actor->flags & MF_ICECORPSE))
|
if (!(actor->flags & MF_ICECORPSE))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2142,33 +2151,78 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj)
|
||||||
{ // [RH] Only bridges block pickup items
|
{ // [RH] Only bridges block pickup items
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (thing == actor)
|
if (actor->player != nullptr && P_ShouldPassThroughPlayer(actor, thing))
|
||||||
{ // Don't clip against self
|
{
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((actor->flags & MF_MISSILE) && (thing == actor->target))
|
|
||||||
{ // Don't clip against whoever shot the missile.
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (actor->Z() > thing->Top())
|
if (actor->Z() > thing->Top())
|
||||||
{ // over thing
|
{ // over thing
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (actor->Top() <= thing->Z())
|
if (actor->Top() <= thing->Z())
|
||||||
{ // under thing
|
{ // under thing
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!quick && onmobj != NULL && thing->Top() < onmobj->Top())
|
if (!P_CanCollideWith(actor, thing))
|
||||||
{ // something higher is in the way
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (!P_CanCollideWith(actor, thing))
|
|
||||||
{ // If they cannot collide, they cannot block each other.
|
{ // If they cannot collide, they cannot block each other.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (actor->player && P_ShouldPassThroughPlayer(actor, thing))
|
if ((actor->flags & MF_MISSILE) || ((actor->BounceFlags & BOUNCE_MBF) && !(actor->flags & MF_SOLID)))
|
||||||
{
|
{
|
||||||
continue;
|
if (thing->flags2 & MF2_NONSHOOTABLE)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((thing->flags3 & MF3_GHOST) && (actor->flags2 & MF2_THRUGHOST))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((thing->flags4 & MF4_SPECTRAL) && !(actor->flags4 & MF4_SPECTRAL))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (actor->target != nullptr)
|
||||||
|
{
|
||||||
|
if ((actor->flags6 & MF6_MTHRUSPECIES) && actor->target->GetSpecies() == thing->GetSpecies())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (actor->target == thing)
|
||||||
|
{
|
||||||
|
if (!(actor->flags8 & MF8_HITOWNER))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (actor->target->player != nullptr && P_ShouldPassThroughPlayer(actor->target, thing))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((thing->flags7 & MF7_THRUREFLECT) && (thing->flags2 & MF2_REFLECTIVE) && (actor->flags & MF_MISSILE))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
double clipheight = thing->Height;
|
||||||
|
if (thing->projectilepassheight > 0)
|
||||||
|
{
|
||||||
|
clipheight = thing->projectilepassheight;
|
||||||
|
}
|
||||||
|
else if (thing->projectilepassheight < 0 && (thing->Level->i_compatflags & COMPATF_MISSILECLIP))
|
||||||
|
{
|
||||||
|
clipheight = -thing->projectilepassheight;
|
||||||
|
}
|
||||||
|
if (actor->Z() > thing->Z() + clipheight)
|
||||||
|
{ // Over thing
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ((actor->flags2 & MF2_RIP) && !(thing->flags5 & MF5_DONTRIP)
|
||||||
|
&& (!(actor->flags6 & MF6_NOBOSSRIP) || !(thing->flags2 & MF2_BOSS))
|
||||||
|
&& CheckRipLevel(thing, actor))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onmobj = thing;
|
onmobj = thing;
|
||||||
|
|
@ -4627,6 +4681,12 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, FTranslatedLineTarget*victim, int *actualdamage,
|
DAngle pitch, int damage, FName damageType, PClassActor *pufftype, int flags, FTranslatedLineTarget*victim, int *actualdamage,
|
||||||
double sz, double offsetforward, double offsetside)
|
double sz, double offsetforward, double offsetside)
|
||||||
{
|
{
|
||||||
|
if (t1->Level->localEventManager->WorldHitscanPreFired(t1, angle, distance, pitch, damage, damageType, pufftype, flags, sz, offsetforward, offsetside))
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool nointeract = !!(flags & LAF_NOINTERACT);
|
bool nointeract = !!(flags & LAF_NOINTERACT);
|
||||||
DVector3 direction;
|
DVector3 direction;
|
||||||
double shootz;
|
double shootz;
|
||||||
|
|
@ -4641,6 +4701,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
if (flags & LAF_NORANDOMPUFFZ)
|
if (flags & LAF_NORANDOMPUFFZ)
|
||||||
puffFlags |= PF_NORANDOMZ;
|
puffFlags |= PF_NORANDOMZ;
|
||||||
|
|
||||||
|
|
||||||
if (victim != NULL)
|
if (victim != NULL)
|
||||||
{
|
{
|
||||||
memset(victim, 0, sizeof(*victim));
|
memset(victim, 0, sizeof(*victim));
|
||||||
|
|
@ -4731,6 +4792,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
// LAF_ABSOFFSET: Ignore the angle.
|
// LAF_ABSOFFSET: Ignore the angle.
|
||||||
|
|
||||||
DVector3 tempos;
|
DVector3 tempos;
|
||||||
|
DVector3 puffpos;
|
||||||
|
|
||||||
if (flags & LAF_ABSPOSITION)
|
if (flags & LAF_ABSPOSITION)
|
||||||
{
|
{
|
||||||
|
|
@ -4766,7 +4828,8 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
|
|
||||||
if (nointeract || (puffDefaults && puffDefaults->flags3 & MF3_ALWAYSPUFF))
|
if (nointeract || (puffDefaults && puffDefaults->flags3 & MF3_ALWAYSPUFF))
|
||||||
{ // Spawn the puff anyway
|
{ // Spawn the puff anyway
|
||||||
puff = P_SpawnPuff(t1, pufftype, trace.HitPos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget, 2, puffFlags);
|
puffpos = trace.HitPos;
|
||||||
|
puff = P_SpawnPuff(t1, pufftype, puffpos, trace.SrcAngleFromTarget, trace.SrcAngleFromTarget, 2, puffFlags);
|
||||||
|
|
||||||
if (nointeract)
|
if (nointeract)
|
||||||
{
|
{
|
||||||
|
|
@ -4796,7 +4859,8 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
if (nointeract || trace.HitType != TRACE_HitWall || ((trace.Line->special != Line_Horizon) || spawnSky))
|
if (nointeract || trace.HitType != TRACE_HitWall || ((trace.Line->special != Line_Horizon) || spawnSky))
|
||||||
{
|
{
|
||||||
DVector2 pos = t1->Level->GetPortalOffsetPosition(trace.HitPos.X, trace.HitPos.Y, -trace.HitVector.X * 4, -trace.HitVector.Y * 4);
|
DVector2 pos = t1->Level->GetPortalOffsetPosition(trace.HitPos.X, trace.HitPos.Y, -trace.HitVector.X * 4, -trace.HitVector.Y * 4);
|
||||||
puff = P_SpawnPuff(t1, pufftype, DVector3(pos, trace.HitPos.Z - trace.HitVector.Z * 4), trace.SrcAngleFromTarget,
|
puffpos = DVector3(pos, trace.HitPos.Z - trace.HitVector.Z * 4);
|
||||||
|
puff = P_SpawnPuff(t1, pufftype, puffpos, trace.SrcAngleFromTarget,
|
||||||
trace.SrcAngleFromTarget - DAngle::fromDeg(90), 0, puffFlags);
|
trace.SrcAngleFromTarget - DAngle::fromDeg(90), 0, puffFlags);
|
||||||
puff->radius = 1/65536.;
|
puff->radius = 1/65536.;
|
||||||
|
|
||||||
|
|
@ -4843,6 +4907,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
{
|
{
|
||||||
// Hit a thing, so it could be either a puff or blood
|
// Hit a thing, so it could be either a puff or blood
|
||||||
DVector3 bleedpos = trace.HitPos;
|
DVector3 bleedpos = trace.HitPos;
|
||||||
|
puffpos = bleedpos;
|
||||||
// position a bit closer for puffs/blood if using compatibility mode.
|
// position a bit closer for puffs/blood if using compatibility mode.
|
||||||
if (trace.Actor->Level->i_compatflags & COMPATF_HITSCAN)
|
if (trace.Actor->Level->i_compatflags & COMPATF_HITSCAN)
|
||||||
{
|
{
|
||||||
|
|
@ -4935,6 +5000,9 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
|
||||||
SpawnDeepSplash(t1, trace, puff);
|
SpawnDeepSplash(t1, trace, puff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t1->Level->localEventManager->WorldHitscanFired(t1, tempos, puffpos, puff, flags);
|
||||||
|
|
||||||
if (killPuff && puff != NULL)
|
if (killPuff && puff != NULL)
|
||||||
{
|
{
|
||||||
puff->Destroy();
|
puff->Destroy();
|
||||||
|
|
@ -5385,16 +5453,30 @@ static ETraceStatus ProcessRailHit(FTraceResults &res, void *userdata)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void P_RailAttack(FRailParams *p)
|
void P_RailAttack(FRailParams *p)
|
||||||
{
|
{
|
||||||
DVector3 start;
|
AActor *source = p->source;
|
||||||
FTraceResults trace;
|
|
||||||
|
|
||||||
PClassActor *puffclass = p->puff;
|
PClassActor *puffclass = p->puff;
|
||||||
if (puffclass == NULL)
|
if (puffclass == NULL)
|
||||||
{
|
{
|
||||||
puffclass = PClass::FindActor(NAME_BulletPuff);
|
puffclass = PClass::FindActor(NAME_BulletPuff);
|
||||||
}
|
}
|
||||||
|
assert(puffclass != NULL); // Because we set it to a default above
|
||||||
|
AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement(source->Level)); //Contains all the flags such as FOILINVUL, etc.
|
||||||
|
FName damagetype = (puffDefaults == NULL || puffDefaults->DamageType == NAME_None) ? FName(NAME_Railgun) : puffDefaults->DamageType;
|
||||||
|
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
// disabled because not complete yet.
|
||||||
|
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? TRACE_ReportPortals : TRACE_PCross | TRACE_Impact | TRACE_ReportPortals;
|
||||||
|
|
||||||
|
if (source->Level->localEventManager->WorldHitscanPreFired(source, source->Angles.Yaw + p->angleoffset, p->distance, source->Angles.Pitch + p->pitchoffset, p->damage, damagetype, puffclass, flags, p->offset_z, 0, p->offset_xy))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DVector3 start;
|
||||||
|
FTraceResults trace;
|
||||||
|
|
||||||
AActor *source = p->source;
|
|
||||||
DAngle pitch = source->Angles.Pitch + p->pitchoffset;
|
DAngle pitch = source->Angles.Pitch + p->pitchoffset;
|
||||||
DAngle angle = source->Angles.Yaw + p->angleoffset;
|
DAngle angle = source->Angles.Yaw + p->angleoffset;
|
||||||
|
|
||||||
|
|
@ -5423,13 +5505,6 @@ void P_RailAttack(FRailParams *p)
|
||||||
start.Y = xy.Y;
|
start.Y = xy.Y;
|
||||||
start.Z = shootz;
|
start.Z = shootz;
|
||||||
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
assert(puffclass != NULL); // Because we set it to a default above
|
|
||||||
AActor *puffDefaults = GetDefaultByType(puffclass->GetReplacement(source->Level)); //Contains all the flags such as FOILINVUL, etc.
|
|
||||||
|
|
||||||
// disabled because not complete yet.
|
|
||||||
flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? TRACE_ReportPortals : TRACE_PCross | TRACE_Impact | TRACE_ReportPortals;
|
|
||||||
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true;
|
||||||
rail_data.MThruSpecies = ((puffDefaults->flags6 & MF6_MTHRUSPECIES)) ? true : false;
|
rail_data.MThruSpecies = ((puffDefaults->flags6 & MF6_MTHRUSPECIES)) ? true : false;
|
||||||
|
|
||||||
|
|
@ -5466,8 +5541,7 @@ void P_RailAttack(FRailParams *p)
|
||||||
|
|
||||||
// Hurt anything the trace hit
|
// Hurt anything the trace hit
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
FName damagetype = (puffDefaults == NULL || puffDefaults->DamageType == NAME_None) ? FName(NAME_Railgun) : puffDefaults->DamageType;
|
|
||||||
|
|
||||||
for (i = 0; i < rail_data.RailHits.Size(); i++)
|
for (i = 0; i < rail_data.RailHits.Size(); i++)
|
||||||
{
|
{
|
||||||
bool spawnpuff;
|
bool spawnpuff;
|
||||||
|
|
@ -5555,6 +5629,9 @@ void P_RailAttack(FRailParams *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source->Level->localEventManager->WorldHitscanFired(source, start, trace.HitPos, thepuff, flags);
|
||||||
|
|
||||||
if (thepuff != NULL)
|
if (thepuff != NULL)
|
||||||
{
|
{
|
||||||
if (trace.Crossed3DWater || trace.CrossedWater)
|
if (trace.Crossed3DWater || trace.CrossedWater)
|
||||||
|
|
|
||||||
|
|
@ -7835,6 +7835,19 @@ void AActor::Revive()
|
||||||
target = nullptr;
|
target = nullptr;
|
||||||
lastenemy = nullptr;
|
lastenemy = nullptr;
|
||||||
|
|
||||||
|
// Make sure to clear poison damage.
|
||||||
|
PoisonDamageReceived = 0;
|
||||||
|
PoisonDamageTypeReceived = NAME_None;
|
||||||
|
PoisonDurationReceived = 0;
|
||||||
|
PoisonPeriodReceived = 0;
|
||||||
|
Poisoner = nullptr;
|
||||||
|
if (player != nullptr)
|
||||||
|
{
|
||||||
|
player->poisoncount = 0;
|
||||||
|
player->poisoner = nullptr;
|
||||||
|
player->poisontype = player->poisonpaintype = NAME_None;
|
||||||
|
}
|
||||||
|
|
||||||
// [RH] If it's a monster, it gets to count as another kill
|
// [RH] If it's a monster, it gets to count as another kill
|
||||||
if (CountsAsKill())
|
if (CountsAsKill())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,8 @@ bool P_NoInterpolation(player_t const *player, AActor const *actor)
|
||||||
&& player->mo->reactiontime == 0
|
&& player->mo->reactiontime == 0
|
||||||
&& !NoInterpolateView
|
&& !NoInterpolateView
|
||||||
&& !paused
|
&& !paused
|
||||||
&& !LocalKeyboardTurner;
|
&& !LocalKeyboardTurner
|
||||||
|
&& !player->mo->isFrozen();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,14 @@ struct WorldEvent native play version("2.4")
|
||||||
native readonly bool DamageIsRadius;
|
native readonly bool DamageIsRadius;
|
||||||
native int NewDamage;
|
native int NewDamage;
|
||||||
native readonly State CrushedState;
|
native readonly State CrushedState;
|
||||||
|
native readonly double AttackAngle;
|
||||||
|
native readonly double AttackPitch;
|
||||||
|
native readonly double AttackDistance;
|
||||||
|
native readonly vector3 AttackPos;
|
||||||
|
native readonly double AttackOffsetForward;
|
||||||
|
native readonly double AttackOffsetSide;
|
||||||
|
native readonly double AttackZ;
|
||||||
|
native readonly class<Actor> AttackPuffType;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlayerEvent native play version("2.4")
|
struct PlayerEvent native play version("2.4")
|
||||||
|
|
@ -155,6 +163,8 @@ class StaticEventHandler : Object native play version("2.4")
|
||||||
virtual void WorldThingRevived(WorldEvent e) {}
|
virtual void WorldThingRevived(WorldEvent e) {}
|
||||||
virtual void WorldThingDamaged(WorldEvent e) {}
|
virtual void WorldThingDamaged(WorldEvent e) {}
|
||||||
virtual void WorldThingDestroyed(WorldEvent e) {}
|
virtual void WorldThingDestroyed(WorldEvent e) {}
|
||||||
|
virtual bool WorldHitscanPreFired(WorldEvent e) { return false; }
|
||||||
|
virtual void WorldHitscanFired(WorldEvent e) {}
|
||||||
virtual void WorldLinePreActivated(WorldEvent e) {}
|
virtual void WorldLinePreActivated(WorldEvent e) {}
|
||||||
virtual void WorldLineActivated(WorldEvent e) {}
|
virtual void WorldLineActivated(WorldEvent e) {}
|
||||||
virtual void WorldSectorDamaged(WorldEvent e) {}
|
virtual void WorldSectorDamaged(WorldEvent e) {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue