MT_RANDOMITEM: Fixes relevant to Blend Eye development

- Custom Mace system
    - Change the OTHER MF2_ that MT_RANDOMITEM uses to also not conflict with the sound-creating property
    - Support being counted for the P_RespawnBattleBoxes system
- If there's only one Random Item on the course, have an extra delay before its respawn is forced
- More prevention of S_RINGBOX1 set in GTR_SPHERES
- Fix potential state issue for Ring Box conversion
This commit is contained in:
toaster 2023-10-24 23:00:51 +01:00
parent 5f10f4de0f
commit 4e2cc4bc34
3 changed files with 33 additions and 19 deletions

View file

@ -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);
}

View file

@ -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++;

View file

@ -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;