From cabd8baae5555c1753a6f92528dd130cbfa6d52f Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 21 Jun 2026 23:13:39 +0200 Subject: [PATCH] some P_MobjWasRemoved for non COMPAT_VANILLA builds --- src/k_kart.c | 12 ++++++++++-- src/p_inter.c | 11 +++++++++-- src/p_mobj.c | 26 ++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index cb4641849..c27c8ad73 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4693,7 +4693,11 @@ void K_RepairOrbitChain(mobj_t *orbit) } // Then recount to make sure item amount is correct - if (orbit->target && orbit->target->player) // !P_MobjWasRemoved(orbit->target) +#ifndef COMPAT_VANILLA + if (!P_MobjWasRemoved(orbit->target) && orbit->target->player) +#else + if (orbit->target && orbit->target->player) +#endif { INT32 num = 0; @@ -4710,7 +4714,11 @@ void K_RepairOrbitChain(mobj_t *orbit) prev->movedir = num; } - if (orbit->target) // !P_MobjWasRemoved(orbit->target) +#ifndef COMPAT_VANILLA + if (!P_MobjWasRemoved(orbit->target)) +#else + if (orbit->target) +#endif orbit->target->player->kartstuff[k_itemamount] = num; } } diff --git a/src/p_inter.c b/src/p_inter.c index 76e4d2e8b..48961c229 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1466,8 +1466,11 @@ static void P_UpdateRemovedOrbital(mobj_t *target, mobj_t *inflictor, mobj_t *so { // SRB2kart // I wish I knew a better way to do this - //if (!P_MobjWasRemoved(target->target) && target->target->player && !P_MobjWasRemoved(target->target->player->mo)) +#ifndef COMPAT_VANILLA + if (!P_MobjWasRemoved(target->target) && target->target->player && !P_MobjWasRemoved(target->target->player->mo)) +#else if (target->target && target->target->player && target->target->player->mo) +#endif { if (target->target->player->kartstuff[k_eggmanheld] && target->type == MT_EGGMANITEM_SHIELD) target->target->player->kartstuff[k_eggmanheld] = 0; @@ -1480,7 +1483,11 @@ static void P_UpdateRemovedOrbital(mobj_t *target, mobj_t *inflictor, mobj_t *so { if (target->movedir != 0 && target->movedir < (UINT16)target->target->player->kartstuff[k_itemamount]) { - if (target->target->hnext) // !P_MobjWasRemoved(target->target->hnext)) +#ifndef COMPAT_VANILLA + if (!P_MobjWasRemoved(target->target->hnext)) +#else + if (target->target->hnext) +#endif K_KillBananaChain(target->target->hnext, inflictor, source); target->target->player->kartstuff[k_itemamount] = 0; diff --git a/src/p_mobj.c b/src/p_mobj.c index 5e33a9803..b885e76dd 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3372,7 +3372,11 @@ static void P_PlayerMobjThinker(mobj_t *mobj) I_Assert(mobj->player != NULL); I_Assert(!P_MobjWasRemoved(mobj)); +#ifndef COMPAT_VANILLA + if (P_MobjWasRemoved(mobj)) +#else if (!mobj) +#endif return; P_MobjCheckWater(mobj); @@ -5614,7 +5618,11 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale) player_t *player; fixed_t oldscale; +#ifndef COMPAT_VANILLA + if (P_MobjWasRemoved(mobj)) +#else if (!mobj) +#endif return; oldscale = mobj->scale; //keep for adjusting stuff below @@ -8962,7 +8970,11 @@ static boolean P_FuseThink(mobj_t *mobj) static boolean P_MobjPushableThink(mobj_t *mobj) { // would be cool if we could use P_MobjWasRemoved Zzz... +#ifndef COMPAT_VANILLA + if (P_MobjWasRemoved(mobj)) +#else if (!mobj) +#endif return false; P_MobjCheckWater(mobj); @@ -9168,8 +9180,11 @@ void P_MobjThinker(mobj_t *mobj) { P_TryMove(mobj, mobj->x, mobj->y, true); // Sets mo->standingslope correctly - //if (P_MobjWasRemoved(mobj)) +#ifndef COMPAT_VANILLA + if (P_MobjWasRemoved(mobj)) // anything that calls checkposition can be lethal +#else if (!mobj) // anything that calls checkposition can be lethal +#endif return; P_ButteredSlope(mobj); @@ -9197,8 +9212,11 @@ void P_MobjThinker(mobj_t *mobj) } } - //if (P_MobjWasRemoved(mobj)) +#ifndef COMPAT_VANILLA + if (P_MobjWasRemoved(mobj)) +#else if (!mobj) +#endif return; // obligatory paranoia check // Can end up here if a player dies. @@ -9258,7 +9276,11 @@ void P_PushableThinker(mobj_t *mobj) I_Assert(!P_MobjWasRemoved(mobj)); +#ifndef COMPAT_VANILLA + if (P_MobjWasRemoved(mobj)) +#else if (!mobj) +#endif return; sec = mobj->subsector->sector;