From 96ee117657018df5f686c340c56ff3a2aaf33e7a Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 3 Aug 2024 17:36:31 +0200 Subject: [PATCH] Revert "more reference fixes" This reverts commit 94bd1cb37b9b0e90e8c1fb00649aed96b2c0e20d. --- src/lua_blockmaplib.c | 4 +--- src/p_map.c | 18 ++++++++---------- src/p_mobj.c | 27 +++++---------------------- 3 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c index 2367673cd..0b93766b8 100644 --- a/src/lua_blockmaplib.c +++ b/src/lua_blockmaplib.c @@ -53,12 +53,10 @@ static UINT8 lib_searchBlockmap_Objects(lua_State *L, INT32 x, INT32 y, mobj_t * CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); blockfuncerror = true; - P_SetTarget(&bnext, NULL); return 0; // *shrugs* } if (!lua_isnil(gL, -1)) { // if nil, continue - P_SetTarget(&bnext, NULL); if (lua_toboolean(gL, -1)) return 2; // stop whole search else @@ -258,4 +256,4 @@ int LUA_BlockmapLib(lua_State *L) { lua_register(L, "searchBlockmap", lib_searchBlockmap); return 0; -} +} \ No newline at end of file diff --git a/src/p_map.c b/src/p_map.c index bcb2b6a73..6051d5d1c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1548,13 +1548,13 @@ static boolean PIT_CheckThing(mobj_t *thing) { tmfloorz = tmceilingz = topz; // block while in air tmceilingslope = NULL; - P_SetTarget(&tmfloorthing, thing); // needed for side collision + tmfloorthing = thing; // needed for side collision } else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) { tmceilingz = topz; tmceilingslope = NULL; - P_SetTarget(&tmfloorthing, thing); // thing we may stand on + tmfloorthing = thing; // thing we may stand on } } else @@ -1585,13 +1585,13 @@ static boolean PIT_CheckThing(mobj_t *thing) { tmfloorz = tmceilingz = topz; // block while in air tmfloorslope = NULL; - P_SetTarget(&tmfloorthing, thing); // needed for side collision + tmfloorthing = thing; // needed for side collision } else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) { tmfloorz = topz; tmfloorslope = NULL; - P_SetTarget(&tmfloorthing, thing); // thing we may stand on + tmfloorthing = thing; // thing we may stand on } } } @@ -1991,8 +1991,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) } // tmfloorthing is set when tmfloorz comes from a thing's top - P_SetTarget(&tmfloorthing, NULL); - P_SetTarget(&tmhitthing, NULL); + tmfloorthing = NULL; + tmhitthing = NULL; validcount++; @@ -2489,10 +2489,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (tmceilingz - tmfloorz < thing->height) { - if (tmfloorthing != NULL) - { - P_SetTarget(&tmhitthing, tmfloorthing); - } + if (tmfloorthing) + tmhitthing = tmfloorthing; return false; // doesn't fit } diff --git a/src/p_mobj.c b/src/p_mobj.c index 5e5b9924b..3cfb92f85 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6112,8 +6112,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->flags2 &= ~MF2_PUSHED; mobj->eflags &= ~(MFE_SPRUNG|MFE_JUSTBOUNCEDWALL); - P_SetTarget(&tmfloorthing, NULL); - P_SetTarget(&tmhitthing, NULL); + tmfloorthing = tmhitthing = NULL; // 970 allows ANY mobj to trigger a linedef exec if (mobj->subsector && GETSECSPECIAL(mobj->subsector->sector->special, 2) == 8) @@ -10070,29 +10069,13 @@ void P_RemoveMobj(mobj_t *mobj) P_SetTarget(&mobj->target, NULL); P_SetTarget(&mobj->tracer, NULL); - // repair hnext chain - mobj_t *cachenext = mobj->hnext; - if (mobj->hnext && !P_MobjWasRemoved(mobj->hnext)) - { - if (mobj->hnext->hprev == mobj) - { - P_SetTarget(&mobj->hnext->hprev, mobj->hprev); - } - - P_SetTarget(&mobj->hnext, NULL); - } - + P_SetTarget(&mobj->hnext->hprev, mobj->hprev); if (mobj->hprev && !P_MobjWasRemoved(mobj->hprev)) - { - if (mobj->hprev->hnext == mobj) - { - P_SetTarget(&mobj->hprev->hnext, cachenext); - } + P_SetTarget(&mobj->hprev->hnext, mobj->hnext); + + P_SetTarget(&mobj->hnext, P_SetTarget(&mobj->hprev, NULL)); - P_SetTarget(&mobj->hprev, NULL); - } - // clear the reference from the mapthing if (mobj->spawnpoint) P_SetTarget(&mobj->spawnpoint->mobj, NULL);