From 3bdddeeec94ba69a0515cdad3c4a0eb9d97e45bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 20 Jan 2025 17:28:23 +0100 Subject: [PATCH] Avoid calling P_CheckMobjTrigger twice on pushables --- src/p_mobj.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5a508e008..d67022b49 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10134,6 +10134,7 @@ static boolean P_FuseThink(mobj_t *mobj) // void P_MobjThinker(mobj_t *mobj) { + boolean ispushable; I_Assert(mobj != NULL); I_Assert(!P_MobjWasRemoved(mobj)); @@ -10159,8 +10160,10 @@ void P_MobjThinker(mobj_t *mobj) tmfloorthing = tmhitthing = NULL; + ispushable = mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse); + // Sector flag MSF_TRIGGERLINE_MOBJ allows ANY mobj to trigger a linedef exec - P_CheckMobjTrigger(mobj, false); + P_CheckMobjTrigger(mobj, ispushable); if (mobj->scale != mobj->destscale) P_MobjScaleThink(mobj); // Slowly scale up/down to reach your destscale. @@ -10204,7 +10207,7 @@ void P_MobjThinker(mobj_t *mobj) // if it's pushable, or if it would be pushable other than temporary disablement, use the // separate thinker - if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse)) + if (ispushable) { if (!P_MobjPushableThink(mobj)) return; @@ -10380,8 +10383,6 @@ void P_PushableThinker(mobj_t *mobj) I_Assert(mobj != NULL); I_Assert(!P_MobjWasRemoved(mobj)); - P_CheckMobjTrigger(mobj, true); - // it has to be pushable RIGHT NOW for this part to happen if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy)) P_TryMove(mobj, mobj->x, mobj->y, true);