From 85a121ad282225254987b67233d340a460c9aee3 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Fri, 23 Oct 2020 11:38:47 -0500 Subject: [PATCH] ThruBits is now opt-in for convenience with the +THRUBITS flag. --- src/playsim/actor.h | 2 +- src/playsim/p_map.cpp | 13 +++++++++---- src/scripting/thingdef_data.cpp | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index ca86337888..8c1a32d539 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -414,7 +414,7 @@ enum ActorFlag8 MF8_STOPRAILS = 0x00000200, // [MC] Prevent rails from going further if an actor has this flag. MF8_ABSVIEWANGLES = 0x00000400, // [MC] By default view angle/pitch/roll is an offset. This will make it absolute instead. MF8_FALLDAMAGE = 0x00000800, // Monster will take fall damage regardless of map settings. - + MF8_THRUBITS = 0x00008000, // [MC] Enable ThruBits property }; // --- mobj.renderflags --- diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index 824bba9b45..e051b3a526 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -450,7 +450,7 @@ bool P_TeleportMove(AActor* thing, const DVector3 &pos, bool telefrag, bool modi if ((th->flags2 | tmf.thing->flags2) & MF2_THRUACTORS) continue; - if (th->ThruBits & tmf.thing->ThruBits) + if (((th->flags8 | tmf.thing->flags8) & MF8_THRUBITS) && th->ThruBits & tmf.thing->ThruBits) continue; double blockdist = th->radius + tmf.thing->radius; @@ -1304,7 +1304,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS) return true; - if (thing->ThruBits & tm.thing->ThruBits) + if (((thing->flags8 | tm.thing->flags8) & MF8_THRUBITS) && thing->ThruBits & tm.thing->ThruBits) return true; if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY)) @@ -2000,7 +2000,7 @@ int P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj) { continue; } - if (actor->ThruBits & thing->ThruBits) + if (((actor->flags8 | thing->flags8) & MF8_THRUBITS) && actor->ThruBits & thing->ThruBits) { continue; } @@ -4498,7 +4498,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, { TData.ThruSpecies = (puffDefaults && (puffDefaults->flags6 & MF6_THRUSPECIES)); TData.ThruActors = (puffDefaults && (puffDefaults->flags2 & MF2_THRUACTORS)); - TData.UseThruBits = true; + // [MC] Because this is a one-hit trace event, we need to spawn the puff, get the species // and destroy it. Assume there is no species unless tempuff isn't NULL. We cannot get // a proper species the same way as puffDefaults flags it appears... @@ -4509,6 +4509,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance, if (tempuff != NULL) { TData.PuffSpecies = tempuff->GetSpecies(); + TData.UseThruBits = tempuff->flags8 & MF8_THRUBITS; TData.ThruBits = tempuff->ThruBits; tempuff->Destroy(); } @@ -5265,7 +5266,11 @@ void P_RailAttack(FRailParams *p) rail_data.PuffSpecies = (thepuff != NULL) ? thepuff->GetSpecies() : NAME_None; if (thepuff) + { rail_data.ThruBits = thepuff->ThruBits; + if (rail_data.UseThruBits) + rail_data.UseThruBits = (thepuff->flags8 & MF8_THRUBITS); + } Trace(start, source->Sector, vec, p->distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data); diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index fb32e4f8b9..0749f5a9ca 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -327,6 +327,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF8, STOPRAILS, AActor, flags8), DEFINE_FLAG(MF8, FALLDAMAGE, AActor, flags8), DEFINE_FLAG(MF8, ABSVIEWANGLES, AActor, flags8), + DEFINE_FLAG(MF8, THRUBITS, AActor, flags8), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),