From 6dff8da503b900ad4a501af12a238ef5b8bbcf9f Mon Sep 17 00:00:00 2001 From: Benjamin Moir Date: Tue, 20 Jan 2015 12:05:00 +1030 Subject: [PATCH] Added +NODECAL and +FORCEDECAL actor flags Added FHF_NOIMPACTDECAL for LineAttack --- src/actor.h | 4 ++-- src/p_acs.cpp | 7 +++++-- src/p_local.h | 3 ++- src/p_map.cpp | 8 ++++++-- src/thingdef/thingdef_data.cpp | 4 ++++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/actor.h b/src/actor.h index 0ab5891071..9b6b29a984 100644 --- a/src/actor.h +++ b/src/actor.h @@ -353,8 +353,8 @@ enum MF7_HITTARGET = 0x00004000, // The actor the projectile dies on is set to target, provided it's targetable anyway. MF7_HITMASTER = 0x00008000, // Same as HITTARGET, except it's master instead of target. MF7_HITTRACER = 0x00010000, // Same as HITTARGET, but for tracer. - - + MF7_NODECAL = 0x00020000, // [ZK] Forces puff to have no impact decal + MF7_FORCEDECAL = 0x00040000, // [ZK] Forces P_LineAttack to use the puff's decal, even if the player's weapon has a decal defined // --- mobj.renderflags --- diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 4b9a8bbab8..d4f4be30c2 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -113,8 +113,9 @@ FRandom pr_acs ("ACS"); #define NOT_FLOOR 8 #define NOT_CEILING 16 -// LineAtack flags +// LineAttack flags #define FHF_NORANDOMPUFFZ 1 +#define FHF_NOIMPACTDECAL 2 // SpawnDecal flags #define SDF_ABSANGLE 1 @@ -5398,7 +5399,9 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const fixed_t range = argCount > 6 && args[6]? args[6] : MISSILERANGE; int flags = argCount > 7 && args[7]? args[7] : 0; - int fhflags = (flags & FHF_NORANDOMPUFFZ)? LAF_NORANDOMPUFFZ : 0; + int fhflags = 0; + if (flags & FHF_NORANDOMPUFFZ) fhflags |= LAF_NORANDOMPUFFZ; + if (flags & FHF_NOIMPACTDECAL) fhflags |= LAF_NOIMPACTDECAL; if (args[0] == 0) { diff --git a/src/p_local.h b/src/p_local.h index fe7958807b..873bad5e9e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -459,7 +459,8 @@ enum // P_AimLineAttack flags enum // P_LineAttack flags { LAF_ISMELEEATTACK = 1, - LAF_NORANDOMPUFFZ = 2 + LAF_NORANDOMPUFFZ = 2, + LAF_NOIMPACTDECAL = 4 }; AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL); diff --git a/src/p_map.cpp b/src/p_map.cpp index 68d0b21f00..923387d956 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3714,13 +3714,17 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, } // [RH] Spawn a decal - if (trace.HitType == TRACE_HitWall && trace.Line->special != Line_Horizon) + if (trace.HitType == TRACE_HitWall && trace.Line->special != Line_Horizon && !(flags & LAF_NOIMPACTDECAL) && !(puffDefaults->flags7 & MF7_NODECAL)) { // [TN] If the actor or weapon has a decal defined, use that one. if (t1->DecalGenerator != NULL || (t1->player != NULL && t1->player->ReadyWeapon != NULL && t1->player->ReadyWeapon->DecalGenerator != NULL)) { - SpawnShootDecal(t1, trace); + // [ZK] If puff has FORCEDECAL set, do not use the weapon's decal + if (puffDefaults->flags7 & MF7_FORCEDECAL && puff != NULL && puff->DecalGenerator) + SpawnShootDecal(puff, trace); + else + SpawnShootDecal(t1, trace); } // Else, look if the bulletpuff has a decal defined. diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index fbe28fb5bf..db479464f4 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -253,6 +253,10 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF7, HITTARGET, AActor, flags7), DEFINE_FLAG(MF7, HITMASTER, AActor, flags7), DEFINE_FLAG(MF7, HITTRACER, AActor, flags7), + + // [ZK] Decal flags + DEFINE_FLAG(MF7, NODECAL, AActor, flags7), + DEFINE_FLAG(MF7, FORCEDECAL, AActor, flags7), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),