From 116ab95d26b5743cbb2d8598bc34c3dbeabad62b Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Sun, 15 Aug 2021 12:10:29 -0500 Subject: [PATCH 01/23] Add MF_NOSTEPUP flag --- src/p_mobj.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index 82cd056a8..0e327cfbb 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -87,7 +87,7 @@ // block or has the MF_NOBLOCKMAP flag set. // Links should only be modified by the P_[Un]SetThingPosition() // functions. -// Do not change the MF_NO? flags while a thing is valid. +// Do not change the MF_NO? flags while a thing is valid with the exception of the MF_NOSTEPUP flag. // // Any questions? // @@ -159,7 +159,9 @@ typedef enum MF_GRENADEBOUNCE = 1<<28, // Run the action thinker on spawn. MF_RUNSPAWNFUNC = 1<<29, - // free: 1<<30 and 1<<31 + // Don't allow the mobj to be affected by the stepup code. + MF_NOSTEPUP = 1<<30, + // free: to and including 1<<31 } mobjflag_t; typedef enum From 910052070e82dc08c70e8768bd822a670e7af0a5 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Sun, 15 Aug 2021 12:17:09 -0500 Subject: [PATCH 02/23] Expose MF_NOSTEPUP flag to SOC and Lua --- src/deh_tables.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 677b23214..0254555ec 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4302,6 +4302,7 @@ const char *const MOBJFLAG_LIST[] = { "NOCLIPTHING", "GRENADEBOUNCE", "RUNSPAWNFUNC", + "NOSTEPUP", NULL }; From 063d07fdc5df6eef67766dd780376110d6bb8afc Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Sun, 15 Aug 2021 12:46:26 -0500 Subject: [PATCH 03/23] Add collidex, collidey, and collidez fixed_t variables to mobj_t userdata --- src/lua_mobjlib.c | 26 +++++++++++++++++++++++++- src/p_mobj.h | 3 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index cf8ccab2c..a131ae72b 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -96,7 +96,10 @@ enum mobj_e { mobj_standingslope, mobj_colorized, mobj_mirrored, - mobj_shadowscale + mobj_shadowscale, + mobj_collidex, + mobj_collidey, + mobj_collidez }; static const char *const mobj_opt[] = { @@ -173,6 +176,9 @@ static const char *const mobj_opt[] = { "colorized", "mirrored", "shadowscale", + "collidex", + "collidey", + "collidez", NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field]) @@ -439,6 +445,15 @@ static int mobj_get(lua_State *L) case mobj_shadowscale: lua_pushfixed(L, mo->shadowscale); break; + case mobj_collidex: + lua_pushfixed(L, mo->collidex); + break; + case mobj_collidey: + lua_pushfixed(L, mo->collidey); + break; + case mobj_collidez: + lua_pushfixed(L, mo->collidez); + break; default: // extra custom variables in Lua memory lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1)); @@ -803,6 +818,15 @@ static int mobj_set(lua_State *L) case mobj_shadowscale: mo->shadowscale = luaL_checkfixed(L, 3); break; + case mobj_collidex: + mo->collidex = luaL_checkfixed(L, 3); + break; + case mobj_collidey: + mo->collidey = luaL_checkfixed(L, 3); + break; + case mobj_collidez: + mo->collidez = luaL_checkfixed(L, 3); + break; default: lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1)); diff --git a/src/p_mobj.h b/src/p_mobj.h index 0e327cfbb..ec5fa79ae 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -440,6 +440,9 @@ typedef struct precipmobj_s fixed_t momx, momy, momz; fixed_t precipflags; // fixed_t so it uses the same spot as "pmomz" even as we use precipflags_t for it + // Used to prevent stepup with MF_NOSTEPUP objects + fixed_t collidex, collidey, collidez; + INT32 tics; // state tic counter state_t *state; INT32 flags; // flags from mobjinfo tables From debc48fec0274b9dab1557ba5c6a5728a90797ce Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Sun, 15 Aug 2021 13:10:05 -0500 Subject: [PATCH 04/23] Set mobj->collidex, mobj->collidey, and mobj->collidez to zero and synch these variables as well --- src/p_mobj.c | 3 +++ src/p_saveg.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index da7385be5..bc32249f6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10523,6 +10523,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // Set shadowscale here, before spawn hook so that Lua can change it mobj->shadowscale = P_DefaultMobjShadowScale(mobj); + mobj->collidex = mobj->collidey = mobj->collidez = 0; + + // DANGER! This can cause P_SpawnMobj to return NULL! // Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks! if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn))) diff --git a/src/p_saveg.c b/src/p_saveg.c index 770c641b9..53ae51b79 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1459,6 +1459,7 @@ typedef enum MD2_SPRITEXOFFSET = 1<<20, MD2_SPRITEYOFFSET = 1<<21, MD2_FLOORSPRITESLOPE = 1<<22, + MD2_COLLIDE = 1<<23 } mobj_diff2_t; typedef enum @@ -1693,6 +1694,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) || (slope->normal.z != FRACUNIT)) diff2 |= MD2_FLOORSPRITESLOPE; } + if (mobj->collidex != 0 || mobj->collidey != 0 || mobj->collidez != 0) + diff2 |= MD2_COLLIDE; if (diff2 != 0) diff |= MD_MORE; @@ -1867,6 +1870,12 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, slope->normal.y); WRITEFIXED(save_p, slope->normal.z); } + if (diff2 & MD2_COLLIDE) + { + WRITEFIXED(save_p, mobj->collidex); + WRITEFIXED(save_p, mobj->collidey); + WRITEFIXED(save_p, mobj->collidez); + } WRITEUINT32(save_p, mobj->mobjnum); } @@ -2913,6 +2922,12 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) slope->normal.y = READFIXED(save_p); slope->normal.z = READFIXED(save_p); } + if (diff2 & MD2_COLLIDE) + { + mobj->collidex = READFIXED(save_p); + mobj->collidey = READFIXED(save_p); + mobj->collidez = READFIXED(save_p); + } if (diff & MD_REDFLAG) { From 27bc2b4db2b8ee499142eb4d26eb4e0626b9aac1 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 01:35:36 -0500 Subject: [PATCH 05/23] Time to test out this new branch --- src/p_map.c | 7 +++++++ src/p_mobj.c | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index e55bebb9a..4935dacc6 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -941,6 +941,13 @@ static boolean PIT_CheckThing(mobj_t *thing) == P_PointOnLineSide(thing->x - thing->radius, thing->y + thing->radius, &junk))) return true; // the line doesn't cross between either pair of opposite corners } + + if (thing->flags & MF_NOSTEPUP) + { + thing->collidex = thing->x; + thing->collidey = thing->y; + thing->collidez = thing->z; + } { UINT8 shouldCollide = LUA_Hook2Mobj(thing, tmthing, MOBJ_HOOK(MobjCollide)); // checks hook for thing's type diff --git a/src/p_mobj.c b/src/p_mobj.c index bc32249f6..cfac08be1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10168,6 +10168,12 @@ void P_MobjThinker(mobj_t *mobj) } } + if ((mo->flags & MF_NOSTEPUP) && (mo->collidex != 0 || mo->collidey != 0 || mo->collidez != 0)) + { + P_TeleportMove(mo, mo->collidex, mo->collidey, mo->collidez); + mo->collidex = mo->collidey = mo->collidez = 0; + } + // Can end up here if a player dies. if (mobj->player) P_CyclePlayerMobjState(mobj); @@ -10363,6 +10369,12 @@ void P_SceneryThinker(mobj_t *mobj) mobj->eflags &= ~MFE_JUSTHITFLOOR; } + if ((mo->flags & MF_NOSTEPUP) && (mo->collidex != 0 || mo->collidey != 0 || mo->collidez != 0)) + { + P_TeleportMove(mo, mo->collidex, mo->collidey, mo->collidez); + mo->collidex = mo->collidey = mo->collidez = 0; + } + P_CycleMobjState(mobj); } From a66cff10c2c4f4f0fff59199b1c719dee1082570 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 01:39:59 -0500 Subject: [PATCH 06/23] Bruh moment from yesterday --- src/p_mobj.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index ec5fa79ae..f3a821059 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -386,6 +386,9 @@ typedef struct mobj_s boolean mirrored; // The object's rotations will be mirrored left to right, e.g., see frame AL from the right and AR from the left fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius + // Used to prevent stepup with MF_NOSTEPUP objects + fixed_t collidex, collidey, collidez; + // WARNING: New fields must be added separately to savegame and Lua. } mobj_t; @@ -440,9 +443,6 @@ typedef struct precipmobj_s fixed_t momx, momy, momz; fixed_t precipflags; // fixed_t so it uses the same spot as "pmomz" even as we use precipflags_t for it - // Used to prevent stepup with MF_NOSTEPUP objects - fixed_t collidex, collidey, collidez; - INT32 tics; // state tic counter state_t *state; INT32 flags; // flags from mobjinfo tables From 7a70879bb49a097040a7b89cd23ec8c4b945989d Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 01:44:54 -0500 Subject: [PATCH 07/23] Bruh moment - it is called mobj not mo --- src/p_mobj.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index cfac08be1..b3ebf0b95 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10168,10 +10168,10 @@ void P_MobjThinker(mobj_t *mobj) } } - if ((mo->flags & MF_NOSTEPUP) && (mo->collidex != 0 || mo->collidey != 0 || mo->collidez != 0)) + if ((mobj->flags & MF_NOSTEPUP) && (mobj->collidex != 0 || mobj->collidey != 0 || mobj->collidez != 0)) { - P_TeleportMove(mo, mo->collidex, mo->collidey, mo->collidez); - mo->collidex = mo->collidey = mo->collidez = 0; + P_TeleportMove(mobj, mobj->collidex, mobj->collidey, mobj->collidez); + mobj->collidex = mobj->collidey = mobj->collidez = 0; } // Can end up here if a player dies. @@ -10369,10 +10369,10 @@ void P_SceneryThinker(mobj_t *mobj) mobj->eflags &= ~MFE_JUSTHITFLOOR; } - if ((mo->flags & MF_NOSTEPUP) && (mo->collidex != 0 || mo->collidey != 0 || mo->collidez != 0)) + if ((mobj->flags & MF_NOSTEPUP) && (mobj->collidex != 0 || mobj->collidey != 0 || mobj->collidez != 0)) { - P_TeleportMove(mo, mo->collidex, mo->collidey, mo->collidez); - mo->collidex = mo->collidey = mo->collidez = 0; + P_TeleportMove(mobj, mobj->collidex, mobj->collidey, mobj->collidez); + mobj->collidex = mobj->collidey = mobj->collidez = 0; } P_CycleMobjState(mobj); From 95c8bfe55d2cee8bd333a08ae54984ece867efe8 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 17:52:22 -0500 Subject: [PATCH 08/23] Remove workaround so that I can actually fix the darn stepup --- src/lua_mobjlib.c | 26 +------------------------- src/p_map.c | 7 ------- src/p_mobj.c | 15 --------------- src/p_mobj.h | 3 --- src/p_saveg.c | 17 +---------------- 5 files changed, 2 insertions(+), 66 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index a131ae72b..cf8ccab2c 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -96,10 +96,7 @@ enum mobj_e { mobj_standingslope, mobj_colorized, mobj_mirrored, - mobj_shadowscale, - mobj_collidex, - mobj_collidey, - mobj_collidez + mobj_shadowscale }; static const char *const mobj_opt[] = { @@ -176,9 +173,6 @@ static const char *const mobj_opt[] = { "colorized", "mirrored", "shadowscale", - "collidex", - "collidey", - "collidez", NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field]) @@ -445,15 +439,6 @@ static int mobj_get(lua_State *L) case mobj_shadowscale: lua_pushfixed(L, mo->shadowscale); break; - case mobj_collidex: - lua_pushfixed(L, mo->collidex); - break; - case mobj_collidey: - lua_pushfixed(L, mo->collidey); - break; - case mobj_collidez: - lua_pushfixed(L, mo->collidez); - break; default: // extra custom variables in Lua memory lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1)); @@ -818,15 +803,6 @@ static int mobj_set(lua_State *L) case mobj_shadowscale: mo->shadowscale = luaL_checkfixed(L, 3); break; - case mobj_collidex: - mo->collidex = luaL_checkfixed(L, 3); - break; - case mobj_collidey: - mo->collidey = luaL_checkfixed(L, 3); - break; - case mobj_collidez: - mo->collidez = luaL_checkfixed(L, 3); - break; default: lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1)); diff --git a/src/p_map.c b/src/p_map.c index 4935dacc6..e55bebb9a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -941,13 +941,6 @@ static boolean PIT_CheckThing(mobj_t *thing) == P_PointOnLineSide(thing->x - thing->radius, thing->y + thing->radius, &junk))) return true; // the line doesn't cross between either pair of opposite corners } - - if (thing->flags & MF_NOSTEPUP) - { - thing->collidex = thing->x; - thing->collidey = thing->y; - thing->collidez = thing->z; - } { UINT8 shouldCollide = LUA_Hook2Mobj(thing, tmthing, MOBJ_HOOK(MobjCollide)); // checks hook for thing's type diff --git a/src/p_mobj.c b/src/p_mobj.c index b3ebf0b95..da7385be5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10168,12 +10168,6 @@ void P_MobjThinker(mobj_t *mobj) } } - if ((mobj->flags & MF_NOSTEPUP) && (mobj->collidex != 0 || mobj->collidey != 0 || mobj->collidez != 0)) - { - P_TeleportMove(mobj, mobj->collidex, mobj->collidey, mobj->collidez); - mobj->collidex = mobj->collidey = mobj->collidez = 0; - } - // Can end up here if a player dies. if (mobj->player) P_CyclePlayerMobjState(mobj); @@ -10369,12 +10363,6 @@ void P_SceneryThinker(mobj_t *mobj) mobj->eflags &= ~MFE_JUSTHITFLOOR; } - if ((mobj->flags & MF_NOSTEPUP) && (mobj->collidex != 0 || mobj->collidey != 0 || mobj->collidez != 0)) - { - P_TeleportMove(mobj, mobj->collidex, mobj->collidey, mobj->collidez); - mobj->collidex = mobj->collidey = mobj->collidez = 0; - } - P_CycleMobjState(mobj); } @@ -10535,9 +10523,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) // Set shadowscale here, before spawn hook so that Lua can change it mobj->shadowscale = P_DefaultMobjShadowScale(mobj); - mobj->collidex = mobj->collidey = mobj->collidez = 0; - - // DANGER! This can cause P_SpawnMobj to return NULL! // Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks! if (LUA_HookMobj(mobj, MOBJ_HOOK(MobjSpawn))) diff --git a/src/p_mobj.h b/src/p_mobj.h index f3a821059..0e327cfbb 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -386,9 +386,6 @@ typedef struct mobj_s boolean mirrored; // The object's rotations will be mirrored left to right, e.g., see frame AL from the right and AR from the left fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius - // Used to prevent stepup with MF_NOSTEPUP objects - fixed_t collidex, collidey, collidez; - // WARNING: New fields must be added separately to savegame and Lua. } mobj_t; diff --git a/src/p_saveg.c b/src/p_saveg.c index 53ae51b79..e7a267a82 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1458,8 +1458,7 @@ typedef enum MD2_SPRITEYSCALE = 1<<19, MD2_SPRITEXOFFSET = 1<<20, MD2_SPRITEYOFFSET = 1<<21, - MD2_FLOORSPRITESLOPE = 1<<22, - MD2_COLLIDE = 1<<23 + MD2_FLOORSPRITESLOPE = 1<<22 } mobj_diff2_t; typedef enum @@ -1694,8 +1693,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) || (slope->normal.z != FRACUNIT)) diff2 |= MD2_FLOORSPRITESLOPE; } - if (mobj->collidex != 0 || mobj->collidey != 0 || mobj->collidez != 0) - diff2 |= MD2_COLLIDE; if (diff2 != 0) diff |= MD_MORE; @@ -1870,12 +1867,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, slope->normal.y); WRITEFIXED(save_p, slope->normal.z); } - if (diff2 & MD2_COLLIDE) - { - WRITEFIXED(save_p, mobj->collidex); - WRITEFIXED(save_p, mobj->collidey); - WRITEFIXED(save_p, mobj->collidez); - } WRITEUINT32(save_p, mobj->mobjnum); } @@ -2922,12 +2913,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) slope->normal.y = READFIXED(save_p); slope->normal.z = READFIXED(save_p); } - if (diff2 & MD2_COLLIDE) - { - mobj->collidex = READFIXED(save_p); - mobj->collidey = READFIXED(save_p); - mobj->collidez = READFIXED(save_p); - } if (diff & MD_REDFLAG) { From a3037ac2ffc29e4a187c80e1300711a70a60b489 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 18:57:55 -0500 Subject: [PATCH 09/23] Don't stepup if the object has the MF_NOSTEPUP flag --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index e55bebb9a..d4a3b3294 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2728,7 +2728,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) maxstep = 0; } - if (thing->type == MT_SKIM) + if ((thing->flags & MF_NOSTEPUP) || (thing->type == MT_SKIM)) maxstep = 0; if (tmceilingz - tmfloorz < thing->height From 8121a94d8b310e2dd687a2a1892a3493ae95c80f Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 21:30:37 -0500 Subject: [PATCH 10/23] The MF_NOSTEP flag shall now work with scenery objects --- src/p_map.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index d4a3b3294..20d5d515b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2904,6 +2904,9 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) { const fixed_t maxstep = MAXSTEPMOVE; + if (thing->flags & MF_NOSTEPUP) + return false; // don't stepup + if (tmceilingz - tmfloorz < thing->height) return false; // doesn't fit From a14ef4767192309fe90cde0efb47ef916f0489da Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 21:39:44 -0500 Subject: [PATCH 11/23] Revert "The MF_NOSTEP flag shall now work with scenery objects" This reverts commit 8121a94d8b310e2dd687a2a1892a3493ae95c80f. --- src/p_map.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 20d5d515b..d4a3b3294 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2904,9 +2904,6 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) { const fixed_t maxstep = MAXSTEPMOVE; - if (thing->flags & MF_NOSTEPUP) - return false; // don't stepup - if (tmceilingz - tmfloorz < thing->height) return false; // doesn't fit From 72f8667d7a4e2f566971e9507a5e7a808ff6e30e Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 21:50:41 -0500 Subject: [PATCH 12/23] Give MT_SKIM the MF_NOSTEPUP flag --- src/info.c | 2 +- src/p_map.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/info.c b/src/info.c index efcf1c044..726212e9b 100644 --- a/src/info.c +++ b/src/info.c @@ -4365,7 +4365,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_ENEMY|MF_SPECIAL|MF_NOGRAVITY|MF_SHOOTABLE, // flags + MF_ENEMY|MF_SPECIAL|MF_NOGRAVITY|MF_SHOOTABLE|MF_NOSTEPUP, // flags (statenum_t)MT_MINE// raisestate }, diff --git a/src/p_map.c b/src/p_map.c index d4a3b3294..94d6d4038 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2728,7 +2728,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) maxstep = 0; } - if ((thing->flags & MF_NOSTEPUP) || (thing->type == MT_SKIM)) + if (thing->flags & MF_NOSTEPUP) maxstep = 0; if (tmceilingz - tmfloorz < thing->height From ae436a0ef3f33e39364189a59cfca603c8281aa4 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 21:59:23 -0500 Subject: [PATCH 13/23] Bruh moment fixed --- src/p_saveg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index e7a267a82..770c641b9 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1458,7 +1458,7 @@ typedef enum MD2_SPRITEYSCALE = 1<<19, MD2_SPRITEXOFFSET = 1<<20, MD2_SPRITEYOFFSET = 1<<21, - MD2_FLOORSPRITESLOPE = 1<<22 + MD2_FLOORSPRITESLOPE = 1<<22, } mobj_diff2_t; typedef enum From 86c65076d2b105527d3b77ab043777bdd04ea167 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Mon, 16 Aug 2021 22:03:02 -0500 Subject: [PATCH 14/23] Comment update --- src/p_mobj.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index 0e327cfbb..5a243455f 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -159,7 +159,7 @@ typedef enum MF_GRENADEBOUNCE = 1<<28, // Run the action thinker on spawn. MF_RUNSPAWNFUNC = 1<<29, - // Don't allow the mobj to be affected by the stepup code. + // Don't allow the mobj to be affected by the stepup code (does not support scenery objects yet since I have not figured out how the stepup code works for scenery objects). MF_NOSTEPUP = 1<<30, // free: to and including 1<<31 } mobjflag_t; From 0c072237f1a3234d2c1d97e5303e3b34b423c2a8 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 09:54:28 -0500 Subject: [PATCH 15/23] Don't run P_SceneryZMovement for MF_NOSTEP scenery objects! --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index da7385be5..7aa030d24 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10347,7 +10347,7 @@ void P_SceneryThinker(mobj_t *mobj) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) || P_IsObjectInGoop(mobj)) { - if (!P_SceneryZMovement(mobj)) + if (!(mobj->flags & MF_NOSTEPUP) && !P_SceneryZMovement(mobj)) return; // mobj was removed P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! if (P_MobjWasRemoved(mobj)) From 24b5e73bc97cf1ad222fdf0237ee95d29683fd75 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 09:56:25 -0500 Subject: [PATCH 16/23] Don't run P_SceneryXYMovement for MF_NOSTEP scenery objects! --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7aa030d24..01bc8985b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10332,7 +10332,7 @@ void P_SceneryThinker(mobj_t *mobj) } // momentum movement - if (mobj->momx || mobj->momy) + if (!(mobj->flags & MF_NOSTEPUP) && (mobj->momx || mobj->momy)) { P_SceneryXYMovement(mobj); From d28eeb26348a84303ff25d9b08204966ab8db7be Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 10:12:25 -0500 Subject: [PATCH 17/23] Added a comment explaining why I used the fix that I did to stop the stepup for scenery objects. --- src/p_mobj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 01bc8985b..b70dfc610 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10313,6 +10313,9 @@ void P_PushableThinker(mobj_t *mobj) // Quick, optimized function for scenery void P_SceneryThinker(mobj_t *mobj) { + // TODO: Make MF_NOSTEPUP not run the stepup code in the movement scenery movement functions instead of not running the movement functions for scenery objects, + // but due to lack of time this fix had to be used. + if (mobj->flags & MF_BOXICON) { if (!(mobj->eflags & MFE_VERTICALFLIP)) From 2d67e790b019f6ad67539af08aeec8142ef1c6f1 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 11:29:49 -0500 Subject: [PATCH 18/23] Get rid of temp fix --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index b70dfc610..62de29c54 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10335,7 +10335,7 @@ void P_SceneryThinker(mobj_t *mobj) } // momentum movement - if (!(mobj->flags & MF_NOSTEPUP) && (mobj->momx || mobj->momy)) + if (mobj->momx || mobj->momy) { P_SceneryXYMovement(mobj); @@ -10350,7 +10350,7 @@ void P_SceneryThinker(mobj_t *mobj) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) || P_IsObjectInGoop(mobj)) { - if (!(mobj->flags & MF_NOSTEPUP) && !P_SceneryZMovement(mobj)) + if (!P_SceneryZMovement(mobj) return; // mobj was removed P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! if (P_MobjWasRemoved(mobj)) From 2782b9bcc1674a093c04e7034869530489d92560 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 11:31:50 -0500 Subject: [PATCH 19/23] Hopefully this attempt at a new fix works --- src/p_mobj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 62de29c54..0de148f14 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10355,6 +10355,8 @@ void P_SceneryThinker(mobj_t *mobj) P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! if (P_MobjWasRemoved(mobj)) return; + if (mobj->flags & MF_NOSTEPUP) + return; mobj->floorz = tmfloorz; mobj->ceilingz = tmceilingz; mobj->floorrover = tmfloorrover; From aa5343ed8f1cb6c1782dd17571807636e5a0396a Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 11:33:24 -0500 Subject: [PATCH 20/23] Bruh moment again --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0de148f14..9ba3a1895 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10350,7 +10350,7 @@ void P_SceneryThinker(mobj_t *mobj) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) || P_IsObjectInGoop(mobj)) { - if (!P_SceneryZMovement(mobj) + if (!P_SceneryZMovement(mobj)) return; // mobj was removed P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! if (P_MobjWasRemoved(mobj)) From 3d3b032647665e53ad61edec874ba35d93190dc8 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 11:48:04 -0500 Subject: [PATCH 21/23] P_CycleMobjState shall still execute for MF_NOSTEP scenery objects --- src/p_mobj.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9ba3a1895..2d0227812 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10355,12 +10355,13 @@ void P_SceneryThinker(mobj_t *mobj) P_CheckPosition(mobj, mobj->x, mobj->y); // Need this to pick up objects! if (P_MobjWasRemoved(mobj)) return; - if (mobj->flags & MF_NOSTEPUP) - return; - mobj->floorz = tmfloorz; - mobj->ceilingz = tmceilingz; - mobj->floorrover = tmfloorrover; - mobj->ceilingrover = tmceilingrover; + if (!(mobj->flags & MF_NOSTEPUP)) + { + mobj->floorz = tmfloorz; + mobj->ceilingz = tmceilingz; + mobj->floorrover = tmfloorrover; + mobj->ceilingrover = tmceilingrover; + } } else { From 08b17cc9fc0e9a84c2a21f50816eb3f06e99e8e1 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 17 Aug 2021 11:48:40 -0500 Subject: [PATCH 22/23] Removed comment since the real fix has been completed --- src/p_mobj.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2d0227812..b4f2c87c1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10313,9 +10313,6 @@ void P_PushableThinker(mobj_t *mobj) // Quick, optimized function for scenery void P_SceneryThinker(mobj_t *mobj) { - // TODO: Make MF_NOSTEPUP not run the stepup code in the movement scenery movement functions instead of not running the movement functions for scenery objects, - // but due to lack of time this fix had to be used. - if (mobj->flags & MF_BOXICON) { if (!(mobj->eflags & MFE_VERTICALFLIP)) From 35fe17a934ad34cc79cc18144e816d5b87e17f09 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Fri, 20 Aug 2021 20:32:57 -0500 Subject: [PATCH 23/23] Update comment that I forgot to update --- src/p_mobj.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index 5a243455f..0e327cfbb 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -159,7 +159,7 @@ typedef enum MF_GRENADEBOUNCE = 1<<28, // Run the action thinker on spawn. MF_RUNSPAWNFUNC = 1<<29, - // Don't allow the mobj to be affected by the stepup code (does not support scenery objects yet since I have not figured out how the stepup code works for scenery objects). + // Don't allow the mobj to be affected by the stepup code. MF_NOSTEPUP = 1<<30, // free: to and including 1<<31 } mobjflag_t;