From 53931727bddb9a51b0eed348ba23eb1722fd36f3 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 28 Dec 2021 14:28:36 +0100 Subject: [PATCH] Adapt pushables to UDMF --- extras/conf/udb/Includes/SRB222_misc.cfg | 8 ++ extras/conf/udb/Includes/SRB222_things.cfg | 96 ++++++++++++++++++++++ src/p_mobj.c | 44 +++++----- src/p_setup.c | 11 +++ src/p_spec.h | 8 ++ 5 files changed, 146 insertions(+), 21 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 2111c198b..dbcd22629 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -582,6 +582,14 @@ enums 64 = "Clip inside ground"; 128 = "No distance check"; } + + pushablebehavior + { + 0 = "Normal"; + 1 = "Slide"; + 2 = "Immovable"; + 3 = "Classic"; + } } //Default things filters diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index d0dc85cc5..649ddd647 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -3740,6 +3740,12 @@ udmf sprite = "CBBSA1"; width = 32; height = 72; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 119 { @@ -5379,6 +5385,12 @@ udmf sprite = "GARGA1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1009 { @@ -5388,6 +5400,12 @@ udmf sprite = "GARGB1"; width = 32; height = 80; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1001 { @@ -5548,6 +5566,12 @@ udmf sprite = "ESTAA1"; width = 32; height = 240; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1103 { @@ -5875,6 +5899,12 @@ udmf sprite = "CSTAA1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1112 { @@ -5884,6 +5914,12 @@ udmf sprite = "CBBSA1"; width = 32; height = 72; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1114 { @@ -5986,6 +6022,12 @@ udmf sprite = "CBLLA0"; width = 20; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1125 { @@ -6182,6 +6224,12 @@ udmf sprite = "BARRA1"; width = 24; height = 63; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1217 { @@ -6637,6 +6685,12 @@ udmf sprite = "BGARA1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1501 { @@ -6646,6 +6700,12 @@ udmf sprite = "BGARA1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1502 { @@ -6655,6 +6715,12 @@ udmf sprite = "BGARA1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1503 { @@ -6664,6 +6730,12 @@ udmf sprite = "BGARA1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1504 { @@ -6687,6 +6759,12 @@ udmf sprite = "BGARD1"; width = 16; height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } } @@ -7078,6 +7156,12 @@ udmf sprite = "XMS3A0"; width = 16; height = 64; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1853 { @@ -7086,6 +7170,12 @@ udmf sprite = "XMS3B0"; width = 16; height = 80; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } 1854 { @@ -7146,6 +7236,12 @@ udmf sprite = "ESTAB1"; width = 20; height = 96; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } } } diff --git a/src/p_mobj.c b/src/p_mobj.c index c1d0fb7ac..4fe3e02ac 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13117,15 +13117,31 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->flags &= ~MF_NIGHTSITEM; } } + if (mobj->flags & MF_PUSHABLE) + { + switch (mthing->args[0]) + { + case TMP_NORMAL: + default: + break; + case TMP_SLIDE: + mobj->flags2 |= MF2_SLIDEPUSH; + mobj->flags |= MF_BOUNCE; + break; + case TMP_IMMOVABLE: + mobj->flags &= ~MF_PUSHABLE; + break; + case TMP_CLASSIC: + mobj->flags2 |= MF2_CLASSICPUSH; + break; + } + } return true; } static void P_SetAmbush(mobj_t *mobj) { - if (mobj->flags & MF_PUSHABLE) - mobj->flags &= ~MF_PUSHABLE; - if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) { // flag for strong/weak random boxes @@ -13167,13 +13183,6 @@ static void P_SetObjectSpecial(mobj_t *mobj) // any monitor with nonzero speed is allowed to respawn like this mobj->flags2 |= MF2_STRONGBOX; } - - // Pushables bounce and slide coolly with object special flag set - if (mobj->flags & MF_PUSHABLE) - { - mobj->flags2 |= MF2_SLIDEPUSH; - mobj->flags |= MF_BOUNCE; - } } static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, fixed_t z, mobjtype_t i) @@ -13202,18 +13211,11 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, if (i == MT_NIGHTSBUMPER) return mobj; - if ((mthing->options & MTF_AMBUSH) - && (mthing->options & MTF_OBJECTSPECIAL) - && (mobj->flags & MF_PUSHABLE)) - mobj->flags2 |= MF2_CLASSICPUSH; - else - { - if (mthing->options & MTF_AMBUSH) - P_SetAmbush(mobj); + if (mthing->options & MTF_AMBUSH) + P_SetAmbush(mobj); - if (mthing->options & MTF_OBJECTSPECIAL) - P_SetObjectSpecial(mobj); - } + if (mthing->options & MTF_OBJECTSPECIAL) + P_SetObjectSpecial(mobj); // Generic reverse gravity for individual objects flag. if (mthing->options & MTF_OBJECTFLIP) diff --git a/src/p_setup.c b/src/p_setup.c index 5431b0124..de6eb1c93 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4903,6 +4903,17 @@ static void P_ConvertBinaryMap(void) if (mapthings[i].options & MTF_AMBUSH) mapthings[i].args[0] |= TMNI_REVEAL; } + if (mobjinfo[mobjtype].flags & MF_PUSHABLE) + { + if ((mapthings[i].options & (MTF_OBJECTSPECIAL|MTF_AMBUSH)) == (MTF_OBJECTSPECIAL|MTF_AMBUSH)) + mapthings[i].args[0] = TMP_CLASSIC; + else if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[0] = TMP_SLIDE; + else if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[0] = TMP_IMMOVABLE; + else + mapthings[i].args[0] = TMP_NORMAL; + } } if (mapthings[i].type >= 1 && mapthings[i].type <= 35) //Player starts diff --git a/src/p_spec.h b/src/p_spec.h index 61ad5d6e4..220376903 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -88,6 +88,14 @@ typedef enum TMNI_REVEAL = 1<<1, } textmapnightsitem_t; +typedef enum +{ + TMP_NORMAL = 0, + TMP_SLIDE = 1, + TMP_IMMOVABLE = 2, + TMP_CLASSIC = 3, +} textmappushabletype_t; + //FOF flags typedef enum {