diff --git a/src/p_mobj.c b/src/p_mobj.c index ae19e7844..d927090fb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13788,8 +13788,15 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numi y + FixedMul(length, FINESINE(fineangle)), z, MT_LOOPCENTERPOINT); - if (!P_MobjWasRemoved(loopanchor)) - Obj_LinkLoopAnchor(loopanchor, loopcenter, mthing->args[0]); + if (P_MobjWasRemoved(loopanchor)) + { + // No recovery. + return; + } + + loopanchor->spawnpoint = NULL; + + Obj_LinkLoopAnchor(loopanchor, loopcenter, mthing->args[0]); } for (r = 0; r < numitems; r++) @@ -13809,15 +13816,15 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numi if (!inclusive) mobj = P_SpawnMobjFromMapThing(&dummything, x, y, z, itemtype); - if (!mobj) + if (P_MobjWasRemoved(mobj)) continue; - if (isloopend) - { - Obj_InitLoopEndpoint(mobj, loopanchor); - } - mobj->spawnpoint = NULL; + + if (!isloopend) + continue; + + Obj_InitLoopEndpoint(mobj, loopanchor); } } @@ -13875,11 +13882,12 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n mobj = P_SpawnMobjFromMapThing(&dummything, x + v[0], y + v[1], z + v[2], itemtype); - if (!mobj) + if (P_MobjWasRemoved(mobj)) continue; - mobj->z -= mobj->height/2; mobj->spawnpoint = NULL; + + mobj->z -= mobj->height/2; } } diff --git a/src/p_saveg.c b/src/p_saveg.c index 885b7b5c0..655e915ff 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -4074,7 +4074,10 @@ static thinker_t* LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker) if (diff2 & MD2_RENDERFLAGS) mobj->renderflags = READUINT32(save->p); if (diff2 & MD2_TID) - P_SetThingTID(mobj, READINT16(save->p)); + { + INT16 tid = READINT16(save->p); + P_SetThingTID(mobj, tid); + } if (diff2 & MD2_SPRITESCALE) { mobj->spritexscale = READFIXED(save->p);