diff --git a/src/objects/random-item.c b/src/objects/random-item.c index 160a516c9..8df3fb937 100644 --- a/src/objects/random-item.c +++ b/src/objects/random-item.c @@ -127,7 +127,7 @@ void Obj_RandomItemVisuals(mobj_t *mobj) // Don't transform stuff that isn't a Ring Box, idiot statenum_t boxstate = mobj->state - states; - if (boxstate >= S_RANDOMITEM1 && boxstate <= S_RANDOMITEM12) + if (boxstate < S_RINGBOX1 || boxstate > S_RINGBOX12) return; if (mobj->extravalue1 == RINGBOX_TIME || specialstageinfo.valid) @@ -141,7 +141,7 @@ void Obj_RandomItemVisuals(mobj_t *mobj) boolean Obj_RandomItemSpawnIn(mobj_t *mobj) { - if ((leveltime == starttime) && !(gametyperules & GTR_CIRCUIT) && (mobj->flags2 & MF2_BOSSNOTRAP)) // here on map start? + if ((leveltime == starttime) && !(gametyperules & GTR_CIRCUIT) && (mobj->flags2 & MF2_BOSSFLEE)) // here on map start? { if (gametyperules & GTR_PAPERITEMS) { @@ -192,6 +192,18 @@ void Obj_RandomItemSpawn(mobj_t *mobj) P_SetMobjState(mobj, S_RANDOMITEM1); } + if (leveltime == 0) + { + mobj->flags2 |= MF2_BOSSFLEE; // mark as here on map start + if ((gametyperules & GTR_CIRCUIT) != GTR_CIRCUIT) // delayed + { + P_UnsetThingPosition(mobj); + mobj->flags |= (MF_NOCLIPTHING|MF_NOBLOCKMAP); + mobj->renderflags |= RF_DONTDRAW; + P_SetThingPosition(mobj); + } + } + mobj->destscale = Obj_RandomItemScale(mobj->destscale); P_SetScale(mobj, mobj->destscale); } diff --git a/src/p_inter.c b/src/p_inter.c index d74a43126..3c12d2fd8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -253,8 +253,13 @@ static void P_ItemPop(mobj_t *actor) Obj_SpawnItemDebrisEffects(actor, actor->target); - if (!specialstageinfo.valid) // In Special, you'll respawn as a Ring Box (random-item.c), don't confuse the player. + if (!specialstageinfo.valid + && (gametyperules & GTR_SPHERES) != GTR_SPHERES) + { + // Doesn't apply to Special P_SetMobjState(actor, S_RINGBOX1); + } + actor->extravalue1 = 0; // de-solidify @@ -281,7 +286,7 @@ static void P_ItemPop(mobj_t *actor) */ // Here at mapload in battle? - if (!(gametyperules & GTR_CIRCUIT) && (actor->flags2 & MF2_BOSSNOTRAP)) + if (!(gametyperules & GTR_CIRCUIT) && (actor->flags2 & MF2_BOSSFLEE)) { numgotboxes++; diff --git a/src/p_mobj.c b/src/p_mobj.c index e04cd2c5d..a0cddb1e4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12147,6 +12147,8 @@ void P_RespawnBattleBoxes(void) if (gametyperules & GTR_CIRCUIT) return; + tic_t setduration = (nummapboxes > 1) ? TICRATE : (2*TICRATE); + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { mobj_t *box; @@ -12157,13 +12159,20 @@ void P_RespawnBattleBoxes(void) box = (mobj_t *)th; if (box->type != MT_RANDOMITEM - || (box->flags2 & MF2_DONTRESPAWN) + || ((box->flags2 & (MF2_DONTRESPAWN|MF2_BOSSFLEE)) != MF2_BOSSFLEE) || !(box->flags & MF_NOCLIPTHING) || box->fuse) continue; // only popped items - box->fuse = TICRATE; // flicker back in - P_SetMobjState(box, box->info->raisestate); + box->fuse = setduration; // flicker back in + P_SetMobjState( + box, + (((gametyperules & GTR_SPHERES) == GTR_SPHERES) + ? box->info->raisestate + : box->info->spawnstate + ) + ); + box->renderflags |= RF_DONTDRAW; // guarantee start invisible if (numgotboxes > 0) numgotboxes--; // you've restored a box, remove it from the count @@ -13766,18 +13775,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj) } case MT_RANDOMITEM: { - const boolean delayed = !(gametyperules & GTR_CIRCUIT); - if (leveltime == 0) - { - mobj->flags2 |= MF2_BOSSNOTRAP; // mark as here on map start - if (delayed) - { - P_UnsetThingPosition(mobj); - mobj->flags |= (MF_NOCLIPTHING|MF_NOBLOCKMAP); - mobj->renderflags |= RF_DONTDRAW; - P_SetThingPosition(mobj); - } - } if (mthing->thing_args[0] == 1) mobj->flags2 |= MF2_BOSSDEAD; break;