From f561956ff17660dc44a7c1d886481d1cbccae2ce Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 29 Jul 2024 02:38:57 -0400 Subject: [PATCH] Revert "Fix respawning item boxes with P_RespawnBattlesBoxes" This reverts commit b7c9e5608373bd8fcd75883c27dedddbb5daac99. --- src/info.c | 2 +- src/p_enemy.c | 6 ------ src/p_inter.c | 39 ++++++++++++++++----------------------- src/p_mobj.c | 24 +++++++++++++++++++----- 4 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/info.c b/src/info.c index 983ad50bc..f8d573ab4 100644 --- a/src/info.c +++ b/src/info.c @@ -22494,7 +22494,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MT_RANDOMITEMPOP, // damage sfx_None, // activesound MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags - S_RANDOMITEM1 // raisestate + S_NULL // raisestate }, { // MT_SPHEREBOX diff --git a/src/p_enemy.c b/src/p_enemy.c index 60d98effb..c5701b7ea 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13255,13 +13255,7 @@ void A_ItemPop(mobj_t *actor) // Here at mapload in battle? if ((gametyperules & GTR_BUMPERS) && (actor->flags2 & MF2_BOSSNOTRAP)) - { numgotboxes++; - - // do not flicker back in just yet, handled by - // P_RespawnBattleBoxes eventually - P_SetMobjState(actor, S_INVISIBLE); - } } void A_JawzChase(mobj_t *actor) diff --git a/src/p_inter.c b/src/p_inter.c index 435279a33..57c4f816c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1033,34 +1033,27 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget { if (target->flags & MF_MONITOR || target->type == MT_RANDOMITEM) { + UINT8 i; + P_SetTarget(&target->target, source); - if (gametyperules & GTR_BUMPERS) + for (i = 0; i < MAXPLAYERS; i++) { - target->fuse = 2; + if (&players[i] == source->player) + { + continue; + } + + if (playeringame[i] && !players[i].spectator && players[i].lives != 0) + { + break; + } } - else + + if (i < MAXPLAYERS) { - UINT8 i; - - for (i = 0; i < MAXPLAYERS; i++) - { - if (&players[i] == source->player) - { - continue; - } - - if (playeringame[i] && !players[i].spectator && players[i].lives != 0) - { - break; - } - } - - if (i < MAXPLAYERS) - { - // Respawn items in multiplayer, don't respawn them when alone - target->fuse = 2*TICRATE + 2; - } + // Respawn items in multiplayer, don't respawn them when alone + target->fuse = 2*TICRATE + 2; } } } diff --git a/src/p_mobj.c b/src/p_mobj.c index e695bdbca..614b10dc4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9253,7 +9253,7 @@ static boolean P_FuseThink(mobj_t *mobj) { ; } - else if ((gametyperules & GTR_BUMPERS) && (mobj->state == &states[S_INVISIBLE])) + else if ((gametyperules & GTR_BUMPERS) && (mobj->threshold != 70)) { break; } @@ -11064,6 +11064,7 @@ void P_RespawnBattleBoxes(void) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { mobj_t *box; + mobj_t *newmobj; if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; @@ -11072,12 +11073,25 @@ void P_RespawnBattleBoxes(void) if (box->type != MT_RANDOMITEM || (box->flags2 & MF2_DONTRESPAWN) - || box->health > 0 - || box->fuse) + || box->threshold != 68 + || box->fuse + || ((tic_t)box->cvmem+1 >= leveltime)) continue; // only popped items - box->fuse = TICRATE; // flicker back in (A_ItemPop preps this effect) - P_SetMobjState(box, box->info->raisestate); + // Respawn from mapthing if you have one! + if (box->spawnpoint) + { + P_SpawnMapThing(box->spawnpoint); + newmobj = box->spawnpoint->mobj; // this is set to the new mobj in P_SpawnMapThing + } + else + { + newmobj = P_SpawnMobj(box->x, box->y, box->z, box->type); + } + + // Transfer flags2 (strongbox, objectflip, bossnotrap) + newmobj->flags2 = box->flags2; + P_RemoveMobj(box); // make sure they disappear if (numgotboxes > 0) numgotboxes--; // you've restored a box, remove it from the count