Additional blocking-related flags for Actor.LineTrace()

This commit is contained in:
Marisa Kirisame 2018-06-05 16:54:57 +02:00 committed by Rachael Alexanderson
parent a2f7d36dc3
commit 51b57cebb1
3 changed files with 21 additions and 3 deletions

View file

@ -346,6 +346,9 @@ enum // P_LineTrace flags
TRF_THRUHITSCAN = 32, TRF_THRUHITSCAN = 32,
TRF_NOSKY = 64, TRF_NOSKY = 64,
TRF_ALLACTORS = 128, TRF_ALLACTORS = 128,
TRF_SOLIDACTORS = 256,
TRF_BLOCKUSE = 512,
TRF_BLOCKSELF = 1024,
}; };
void P_TraceBleed(int damage, const DVector3 &pos, AActor *target, DAngle angle, DAngle pitch); void P_TraceBleed(int damage, const DVector3 &pos, AActor *target, DAngle angle, DAngle pitch);

View file

@ -4971,9 +4971,21 @@ bool P_LineTrace(AActor *t1, DAngle angle, double distance,
} }
ActorFlags aflags = (flags & TRF_ALLACTORS) ? ActorFlags::FromInt(0xFFFFFFFF) : MF_SHOOTABLE; ActorFlags aflags = (flags & TRF_ALLACTORS) ? ActorFlags::FromInt(0xFFFFFFFF) : MF_SHOOTABLE;
int lflags = 0; if ( flags & TRF_SOLIDACTORS ) aflags |= MF_SOLID;
if ( !(flags & TRF_THRUBLOCK) ) lflags |= ML_BLOCKEVERYTHING; int lflags = ML_BLOCKEVERYTHING|ML_BLOCKHITSCAN;
if ( !(flags & TRF_THRUHITSCAN) ) lflags |= ML_BLOCKHITSCAN; if ( flags & TRF_BLOCKUSE ) lflags |= ML_BLOCKUSE;
if ( flags & TRF_BLOCKSELF )
{
bool Projectile = ( (t1->flags&MF_MISSILE) || (t1->BounceFlags&BOUNCE_MBF) );
bool NotBlocked = ( (t1->flags3&MF3_NOBLOCKMONST) || ( (i_compatflags&COMPATF_NOBLOCKFRIENDS) && (t1->flags&MF_FRIENDLY) ) );
if ( Projectile ) lflags |= ML_BLOCKPROJECTILE;
if ( !Projectile || (t1->flags8&MF8_BLOCKASPLAYER) ) lflags |= ML_BLOCKING;
if ( !NotBlocked ) lflags |= ML_BLOCKMONSTERS;
if ( t1->player || (t1->flags8&MF8_BLOCKASPLAYER) ) lflags |= ML_BLOCKING|ML_BLOCK_PLAYERS;
if ( t1->flags&MF_FLOAT ) lflags |= ML_BLOCK_FLOATERS;
}
if ( flags & TRF_THRUBLOCK ) lflags &= ~ML_BLOCKEVERYTHING;
if ( flags & TRF_THRUHITSCAN ) lflags &= ~ML_BLOCKHITSCAN;
int tflags = TRACE_ReportPortals; int tflags = TRACE_ReportPortals;
if ( flags & TRF_NOSKY ) tflags |= TRACE_NoSky; if ( flags & TRF_NOSKY ) tflags |= TRACE_NoSky;

View file

@ -908,6 +908,9 @@ enum ELineTraceFlags
TRF_THRUHITSCAN = 32, TRF_THRUHITSCAN = 32,
TRF_NOSKY = 64, TRF_NOSKY = 64,
TRF_ALLACTORS = 128, TRF_ALLACTORS = 128,
TRF_SOLIDACTORS = 256,
TRF_BLOCKUSE = 512,
TRF_BLOCKSELF = 1024,
} }
const DEFMELEERANGE = 64; const DEFMELEERANGE = 64;