From 0a258f95ea6466daa5366065a826c0f78a333411 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Aug 2013 16:25:16 +0200 Subject: [PATCH 1/3] - added gravity property to UDMF things. Positive values are multiplied with the class's gravity property, negative values are used as their absolute. --- specs/udmf_zdoom.txt | 2 ++ src/doomdata.h | 1 + src/p_buildmap.cpp | 1 + src/p_mobj.cpp | 4 ++++ src/p_setup.cpp | 2 ++ src/p_udmf.cpp | 6 ++++++ 6 files changed, 16 insertions(+) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 4fc57f856..a6d8acb5d 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -204,6 +204,8 @@ Note: All fields default to false unless mentioned otherwise. // Parameter is the conversation ID, 0 meaning none. countsecret = ; // Picking up this actor counts as a secret. arg0str = ; // Alternate string-based version of arg0 + gravity = ; // Set per-actor gravity. Positive values are multiplied with the class's property, + // negative values are used as their absolute. Default = 1.0. * Note about arg0str diff --git a/src/doomdata.h b/src/doomdata.h index eeff13e2e..46af9d6a4 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -342,6 +342,7 @@ struct FMapThing int special; int args[5]; int Conversation; + fixed_t gravity; void Serialize (FArchive &); }; diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 417343f21..f2fd7b0bf 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -698,6 +698,7 @@ static int LoadSprites (spritetype *sprites, Xsprite *xsprites, int numsprites, mapthings[count].SkillFilter = 0xffff; mapthings[count].flags = MTF_SINGLE|MTF_COOPERATIVE|MTF_DEATHMATCH; mapthings[count].special = 0; + mapthings[count].gravity = FRACUNIT; if (xsprites != NULL && sprites[i].lotag == 710) { // Blood ambient sound diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3b11ec415..14607a682 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4712,6 +4712,10 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) mobj->SpawnPoint[2] = mthing->z; mobj->SpawnAngle = mthing->angle; mobj->SpawnFlags = mthing->flags; + if (mthing->gravity < 0) mobj->gravity = -mthing->gravity; + else if (mthing->gravity > 0) mobj->gravity = FixedMul(mobj->gravity, mthing->gravity); + else mobj->flags &= ~MF_NOGRAVITY; + P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); if (!(mobj->flags2 & MF2_ARGSDEFINED)) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 2535641a5..784e6946f 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1750,6 +1750,7 @@ void P_LoadThings (MapData * map) memset (&mti[i], 0, sizeof(mti[i])); + mti[i].gravity = FRACUNIT; mti[i].Conversation = 0; mti[i].SkillFilter = MakeSkill(flags); mti[i].ClassFilter = 0xffff; // Doom map format doesn't have class flags so spawn for all player classes @@ -1825,6 +1826,7 @@ void P_LoadThings2 (MapData * map) mti[i].ClassFilter = (mti[i].flags & MTF_CLASS_MASK) >> MTF_CLASS_SHIFT; mti[i].flags &= ~(MTF_SKILLMASK|MTF_CLASS_MASK); mti[i].Conversation = 0; + mti[i].gravity = FRACUNIT; } delete[] mtp; } diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 91e4c8565..6d935ba63 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -475,6 +475,7 @@ public: FString arg0str, arg1str; memset(th, 0, sizeof(*th)); + th->gravity = FRACUNIT; sc.MustGetToken('{'); while (!sc.CheckToken('}')) { @@ -515,6 +516,11 @@ public: th->special = CheckInt(key); break; + case NAME_Gravity: + CHECK_N(Zd | Zdt) + th->gravity = CheckFixed(key); + break; + case NAME_Arg0: case NAME_Arg1: case NAME_Arg2: From a78ad3188bc8ff7361b83460967e3ef5a0391257 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Aug 2013 20:20:23 +0200 Subject: [PATCH 2/3] - added MF5_NOFORWARDFALL flag to prevent attacks from making its victim fall forward randomly. --- src/actor.h | 2 +- src/p_interaction.cpp | 4 +++- src/thingdef/thingdef_data.cpp | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/actor.h b/src/actor.h index 7ec653447..15a135b99 100644 --- a/src/actor.h +++ b/src/actor.h @@ -268,7 +268,7 @@ enum MF5_DONTDRAIN = 0x00000001, // cannot be drained health from. /* = 0x00000002, */ MF5_NODROPOFF = 0x00000004, // cannot drop off under any circumstances. - /* = 0x00000008, */ + MF5_NOFORWARDFALL = 0x00000008, // Does not make any actor fall forward by being damaged by this MF5_COUNTSECRET = 0x00000010, // From Doom 64: actor acts like a secret MF5_AVOIDINGDROPOFF = 0x00000020, // Used to move monsters away from dropoffs MF5_NODAMAGE = 0x00000040, // Actor can be shot and reacts to being shot but takes no damage diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 96f04f75c..0ee955a82 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1143,7 +1143,9 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, && (pr_damagemobj()&1) // [RH] But only if not too fast and not flying && thrust < 10*FRACUNIT - && !(target->flags & MF_NOGRAVITY)) + && !(target->flags & MF_NOGRAVITY) + && (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL)) + ) { ang += ANG180; thrust *= 4; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 795bcb5cc..455f700df 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -184,6 +184,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF5, DONTDRAIN, AActor, flags5), DEFINE_FLAG(MF5, NODROPOFF, AActor, flags5), + DEFINE_FLAG(MF5, NOFORWARDFALL, AActor, flags5), DEFINE_FLAG(MF5, COUNTSECRET, AActor, flags5), DEFINE_FLAG(MF5, NODAMAGE, AActor, flags5), DEFINE_FLAG(MF5, BLOODSPLATTER, AActor, flags5), From 6a07118ea4bbbe3d901693b93300550cc0d2b02a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Aug 2013 20:35:10 +0200 Subject: [PATCH 3/3] - added ML_BLOCKHITSCAN line flag. --- specs/udmf_zdoom.txt | 1 + src/doomdata.h | 1 + src/namedef.h | 1 + src/p_lnspec.cpp | 1 + src/p_map.cpp | 2 +- src/p_udmf.cpp | 4 ++++ 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index a6d8acb5d..3241bf4c8 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -113,6 +113,7 @@ Note: All fields default to false unless mentioned otherwise. blockprojectiles = ;// Line blocks all projectiles blockuse = ; // Line blocks all use actions blocksight = ; // Line blocks monster line of sight + blockhitscan = ; // Line blocks hitscan attacks locknumber = ; // Line special is locked arg0str = ; // Alternate string-based version of arg0 diff --git a/src/doomdata.h b/src/doomdata.h index 46af9d6a4..55903170a 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -153,6 +153,7 @@ enum ELineFlags ML_BLOCKPROJECTILE = 0x01000000, ML_BLOCKUSE = 0x02000000, // blocks all use actions through this line ML_BLOCKSIGHT = 0x04000000, // blocks monster line of sight + ML_BLOCKHITSCAN = 0x08000000, // blocks hitscan attacks }; diff --git a/src/namedef.h b/src/namedef.h index f2d601eb5..f7607400e 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -465,6 +465,7 @@ xx(blockprojectiles) xx(blockuse) xx(hidden) xx(blocksight) +xx(blockhitscan) xx(Renderstyle) diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index a0164ab82..869fd5169 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2545,6 +2545,7 @@ FUNC(LS_Line_SetBlocking) ML_RAILING, ML_BLOCKUSE, ML_BLOCKSIGHT, + ML_BLOCKHITSCAN, -1 }; diff --git a/src/p_map.cpp b/src/p_map.cpp index 211e03056..da87481d0 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3563,7 +3563,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, else tflags = TRACE_NoSky|TRACE_Impact; if (!Trace (t1->x, t1->y, shootz, t1->Sector, vx, vy, vz, distance, - MF_SHOOTABLE, ML_BLOCKEVERYTHING, t1, trace, + MF_SHOOTABLE, ML_BLOCKEVERYTHING|ML_BLOCKHITSCAN, t1, trace, tflags, hitGhosts ? CheckForGhost : CheckForSpectral)) { // hit nothing if (puffDefaults == NULL) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 6d935ba63..fc5964737 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -927,6 +927,10 @@ public: Flag(ld->flags, ML_BLOCKSIGHT, key); continue; + case NAME_blockhitscan: + Flag(ld->flags, ML_BLOCKHITSCAN, key); + continue; + // [Dusk] lock number case NAME_Locknumber: ld->locknumber = CheckInt(key);