From 7d885f7100ca9d49b752cd60c44d6e8f4f2c8efb Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 15 Jul 2024 14:34:33 +0200 Subject: [PATCH] dont access delayremoved thinkers uhhh --- src/d_clisrv.c | 8 ++--- src/d_netcmd.c | 3 +- src/g_game.c | 12 +++++-- src/lua_script.c | 5 +++ src/m_cheat.c | 2 ++ src/p_enemy.c | 43 +++++++++++++++++++++---- src/p_inter.c | 4 +++ src/p_mobj.c | 23 +++++++++++--- src/p_polyobj.c | 82 ++++++++++++++++++------------------------------ src/p_saveg.c | 8 +++++ src/p_setup.c | 4 +++ src/p_spec.c | 16 ++++++++++ src/p_tick.c | 4 +++ src/p_user.c | 14 +++++++++ src/r_data.c | 3 +- 15 files changed, 159 insertions(+), 72 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 38f7415fc..51067797b 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5588,11 +5588,6 @@ static INT16 Consistancy(void) ret += P_GetRandSeed(); #ifdef MOBJCONSISTANCY - if (!thinkercap.next) - { - DEBFILE(va("Consistancy = %u\n", ret)); - return ret; - } if (gamestate == GS_LEVEL) { for (th = thinkercap.next; th != &thinkercap; th = th->next) @@ -5600,6 +5595,9 @@ static INT16 Consistancy(void) if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + mo = (mobj_t *)th; if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY)) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a9d4f3f2e..7030d29b2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5781,7 +5781,8 @@ static void Command_Archivetest_f(void) i = 1; for (th = thinkercap.next; th != &thinkercap; th = th->next) if (th->function.acp1 == (actionf_p1)P_MobjThinker) - ((mobj_t *)th)->mobjnum = i++; + if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) + ((mobj_t *)th)->mobjnum = i++; // allocate buffer buf = save_p = ZZ_Alloc(1024); diff --git a/src/g_game.c b/src/g_game.c index d1a3106ae..28b7aa75b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3020,6 +3020,9 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo) if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + mo2 = (mobj_t *)th; if (!(mo2->flags & MF_MISSILE)) @@ -5619,11 +5622,13 @@ void G_ConsGhostTic(INT32 playernum) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mobj = (mobj_t *)th; if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z) break; } - if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it! + if ((th != &thinkercap && th->function.acp1 != (actionf_p1)P_MobjThinker) && mobj->health != health) // Wasn't damaged?! This is desync! Fix it! { if (demosynced) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); @@ -8090,11 +8095,14 @@ void G_DoPlayMetal(void) if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + mo = (mobj_t *)th; if (mo->type == MT_METALSONIC_RACE) break; } - if (!mo) + if (th == &thinkercap && th->function.acp1 == (actionf_p1)P_MobjThinker) { CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n")); Z_Free(metalbuffer); diff --git a/src/lua_script.c b/src/lua_script.c index c460a4d62..75019ecda 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1596,6 +1596,9 @@ void LUA_Archive(void) if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + // archive function will determine when to skip mobjs, // and write mobjnum in otherwise. ArchiveExtVars(th, "mobj"); @@ -1632,6 +1635,8 @@ void LUA_UnArchive(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj continue; UnArchiveExtVars(th); // apply variables diff --git a/src/m_cheat.c b/src/m_cheat.c index abada4be5..6b93461f3 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -906,6 +906,8 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)th; // get offset from mt, which points to old mapthings, then add new location diff --git a/src/p_enemy.c b/src/p_enemy.c index 3a032fbf0..1a23317ed 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2635,6 +2635,8 @@ void A_BossDeath(mobj_t *mo) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2 != mo && (mo2->flags & MF_BOSS) && mo2->health > 0) @@ -2693,6 +2695,8 @@ bossjustdie: { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -5300,6 +5304,8 @@ void A_RingExplode(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -6868,13 +6874,23 @@ void A_Boss3Path(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; - if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && mo2->spawnpoint->angle == actor->threshold) - { - P_SetTarget(&actor->target, mo2); - break; - } + + if (mo2->type != MT_BOSS3WAYPOINT) + continue; + + if(!mo2->spawnpoint) + continue; + + if (mo2->spawnpoint->angle != actor->threshold) + continue; + + + P_SetTarget(&actor->target, mo2); + break; } if (!actor->target) // Should NEVER happen @@ -7305,6 +7321,8 @@ void A_FindTarget(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -7369,6 +7387,8 @@ void A_FindTracer(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -7911,6 +7931,8 @@ void A_RemoteAction(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -8689,6 +8711,8 @@ void A_MementosTPParticles(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == MT_MEMENTOSTP && mo2 != actor) @@ -8788,6 +8812,8 @@ void A_ReaperThinker(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -8844,7 +8870,6 @@ void A_ReaperThinker(mobj_t *actor) // Waypoint behavior. if (actor->target->type == MT_REAPERWAYPOINT) { - if (R_PointToDist2(actor->x, actor->y, actor->target->x, actor->target->y) < 22<target, NULL); // remove target so we can default back to first waypoint if things go ham. @@ -8854,6 +8879,8 @@ void A_ReaperThinker(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -9029,6 +9056,8 @@ void A_SetObjectTypeState(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -9651,6 +9680,8 @@ void A_CheckThingCount(mobj_t *actor) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; diff --git a/src/p_inter.c b/src/p_inter.c index e0e0986e6..9b89ec6f9 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1209,6 +1209,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == MT_KOOPA) @@ -2367,6 +2369,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)th; if (mo->type == (mobjtype_t)target->info->mass && mo->tracer == target) diff --git a/src/p_mobj.c b/src/p_mobj.c index ea299729c..5134f3a40 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3217,6 +3217,8 @@ void P_DestroyRobots(void) { if (think->function.acp1 != (actionf_p1)P_MobjThinker) continue; // not a mobj thinker + if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)think; if (mo->health <= 0 || !(mo->flags & MF_ENEMY || mo->flags & MF_BOSS)) @@ -4027,6 +4029,8 @@ static void P_Boss3Thinker(mobj_t *mobj) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == (mobjtype_t)mobj->info->mass && mo2->tracer == mobj) @@ -4118,6 +4122,8 @@ static void P_Boss3Thinker(mobj_t *mobj) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -4752,6 +4758,8 @@ static void P_Boss7Thinker(mobj_t *mobj) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint) @@ -4807,6 +4815,8 @@ static void P_Boss7Thinker(mobj_t *mobj) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && (mo2->spawnpoint->options & 7) == waypointNum) @@ -4930,6 +4940,8 @@ static void P_Boss9Thinker(mobj_t *mobj) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == MT_BOSS9GATHERPOINT) @@ -5363,6 +5375,8 @@ mobj_t *P_GetClosestAxis(mobj_t *source) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -10043,11 +10057,6 @@ void P_RemoveMobj(mobj_t *mobj) R_RemoveMobjInterpolator(mobj); -#ifdef SCRAMBLE_REMOVED - // Invalidate mobj_t data to cause crashes if accessed! - memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t)); -#endif - // free block if (!mobj->thinker.next) { // Uh-oh, the mobj doesn't think, P_RemoveThinker would never go through! @@ -10369,6 +10378,8 @@ void P_RespawnSpecials(void) if (th->function.acp1 != (actionf_p1)P_MobjThinker) // not a mobj continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; box = (mobj_t *)th; @@ -11515,6 +11526,8 @@ ML_NOCLIMB : Direction not controllable { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 942f12b8b..03df03905 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1516,28 +1516,29 @@ void Polyobj_InitLevel(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + + mobj_t *mo = (mobj_t *)th; + + if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM || + mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM) { - mobj_t *mo = (mobj_t *)th; + ++numPolyObjects; - if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM || - mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM) - { - ++numPolyObjects; + qitem = malloc(sizeof(mobjqitem_t)); + memset(qitem, 0, sizeof(mobjqitem_t)); + qitem->mo = mo; + M_QueueInsert(&(qitem->mqitem), &spawnqueue); + } + else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM) + { + ++numAnchors; - qitem = malloc(sizeof(mobjqitem_t)); - memset(qitem, 0, sizeof(mobjqitem_t)); - qitem->mo = mo; - M_QueueInsert(&(qitem->mqitem), &spawnqueue); - } - else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM) - { - ++numAnchors; - - qitem = malloc(sizeof(mobjqitem_t)); - memset(qitem, 0, sizeof(mobjqitem_t)); - qitem->mo = mo; - M_QueueInsert(&(qitem->mqitem), &anchorqueue); - } + qitem = malloc(sizeof(mobjqitem_t)); + memset(qitem, 0, sizeof(mobjqitem_t)); + qitem->mo = mo; + M_QueueInsert(&(qitem->mqitem), &anchorqueue); } } @@ -1572,39 +1573,6 @@ void Polyobj_InitLevel(void) Polyobj_linkToBlockmap(&PolyObjects[i]); } -#if 0 - // haleyjd 02/22/06: temporary debug - printf("DEBUG: numPolyObjects = %d\n", numPolyObjects); - for (i = 0; i < numPolyObjects; ++i) - { - INT32 j; - polyobj_t *po = &PolyObjects[i]; - - printf("polyobj %d:\n", i); - printf("id = %d, first = %d, next = %d\n", po->id, po->first, po->next); - printf("segCount = %d, numSegsAlloc = %d\n", po->segCount, po->numSegsAlloc); - for (j = 0; j < po->segCount; ++j) - printf("\tseg %d: %p\n", j, po->segs[j]); - printf("numVertices = %d, numVerticesAlloc = %d\n", po->numVertices, po->numVerticesAlloc); - for (j = 0; j < po->numVertices; ++j) - { - printf("\tvtx %d: (%d, %d) / orig: (%d, %d)\n", - j, po->vertices[j]->x>>FRACBITS, po->vertices[j]->y>>FRACBITS, - po->origVerts[j].x>>FRACBITS, po->origVerts[j].y>>FRACBITS); - } - printf("numLines = %d, numLinesAlloc = %d\n", po->numLines, po->numLinesAlloc); - for (j = 0; j < po->numLines; ++j) - printf("\tline %d: %p\n", j, po->lines[j]); - printf("spawnSpot = (%d, %d)\n", po->spawnSpot.x >> FRACBITS, po->spawnSpot.y >> FRACBITS); - printf("centerPt = (%d, %d)\n", po->centerPt.x >> FRACBITS, po->centerPt.y >> FRACBITS); - printf("attached = %d, linked = %d, validcount = %d, isBad = %d\n", - po->attached, po->linked, po->validcount, po->isBad); - printf("blockbox: [%d, %d, %d, %d]\n", - po->blockbox[BOXLEFT], po->blockbox[BOXRIGHT], po->blockbox[BOXBOTTOM], - po->blockbox[BOXTOP]); - } -#endif - // done with mobj queues M_QueueFree(&spawnqueue); M_QueueFree(&anchorqueue); @@ -1821,6 +1789,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) { if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker continue; + if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)wp; @@ -1905,6 +1875,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) { if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker continue; + if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)wp; @@ -1944,6 +1916,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) { if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker continue; + if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)wp; @@ -1981,6 +1955,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th) { if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker continue; + if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)wp; @@ -2501,6 +2477,8 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata) { if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker continue; + if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)wp; diff --git a/src/p_saveg.c b/src/p_saveg.c index 037efe9ed..969dfc714 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1879,6 +1879,8 @@ mobj_t *P_FindNewPosition(UINT32 oldposition) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mobj = (mobj_t *)th; if (mobj->mobjnum != oldposition) @@ -3001,6 +3003,8 @@ static inline void P_FinishMobjs(void) { if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mobj = (mobj_t *)currentthinker; mobj->info = &mobjinfo[mobj->type]; } @@ -3018,6 +3022,8 @@ static void P_RelinkPointers(void) { if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mobj = (mobj_t *)currentthinker; @@ -3459,6 +3465,8 @@ void P_SaveNetGame(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mobj = (mobj_t *)th; if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER) continue; diff --git a/src/p_setup.c b/src/p_setup.c index 28036557d..c94a117f5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -750,6 +750,8 @@ void P_ReloadRings(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)th; @@ -2265,6 +2267,8 @@ void P_LoadThingsOnly(void) { if (think->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; P_RemoveMobj((mobj_t *)think); } diff --git a/src/p_spec.c b/src/p_spec.c index e72cb5371..5b9b452ea 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3270,6 +3270,8 @@ void P_SetupSignExit(player_t *player) { if (think->function.acp1 != (actionf_p1)P_MobjThinker) continue; // not a mobj thinker + if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; thing = (mobj_t *)think; if (thing->type != MT_SIGN) @@ -3319,6 +3321,8 @@ boolean P_IsFlagAtBase(mobjtype_t flag) { if (think->function.acp1 != (actionf_p1)P_MobjThinker) continue; // not a mobj thinker + if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)think; @@ -3757,6 +3761,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -4101,6 +4107,8 @@ DoneSection2: { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -4180,6 +4188,8 @@ DoneSection2: { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -4402,6 +4412,8 @@ DoneSection2: { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -4440,6 +4452,8 @@ DoneSection2: { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -4467,6 +4481,8 @@ DoneSection2: { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; diff --git a/src/p_tick.c b/src/p_tick.c index 2d51b461a..2044534f2 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -154,6 +154,8 @@ void Command_CountMobjs_f(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; if (((mobj_t *)th)->type == i) count++; @@ -174,6 +176,8 @@ void Command_CountMobjs_f(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; if (((mobj_t *)th)->type == i) count++; diff --git a/src/p_user.c b/src/p_user.c index 8bf961ba6..14062a366 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1143,6 +1143,8 @@ void P_SpawnShieldOrb(player_t *player) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; shieldobj = (mobj_t *)th; @@ -1871,6 +1873,8 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -2624,6 +2628,8 @@ static void P_DoZoomTube(player_t *player) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; @@ -2719,6 +2725,8 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) { if (think->function.acp1 != (actionf_p1)P_MobjThinker) continue; // not a mobj thinker + if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)think; @@ -2799,6 +2807,8 @@ boolean P_LookForEnemies(player_t *player) { if (think->function.acp1 != (actionf_p1)P_MobjThinker) continue; // not a mobj thinker + if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo = (mobj_t *)think; if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING))) @@ -2924,6 +2934,8 @@ void P_FindEmerald(void) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; if (mo2->type == MT_EMERHUNT) @@ -4637,6 +4649,8 @@ void P_PlayerThink(player_t *player) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; mo2 = (mobj_t *)th; diff --git a/src/r_data.c b/src/r_data.c index ad8b420f3..a725d2ac9 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1687,7 +1687,8 @@ void R_PrecacheLevel(void) for (th = thinkercap.next; th != &thinkercap; th = th->next) if (th->function.acp1 == (actionf_p1)P_MobjThinker) - spritepresent[((mobj_t *)th)->sprite] = 1; + if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) + spritepresent[((mobj_t *)th)->sprite] = 1; spritememory = 0; for (i = 0; i < numsprites; i++)