Fix custom ambient sound mobjs not working

This commit is contained in:
MascaraSnake 2023-04-11 16:19:27 +02:00 committed by NepDisk
parent 6808564763
commit f422db029e
3 changed files with 29 additions and 3 deletions

View file

@ -884,7 +884,7 @@ static void OP_CycleThings(INT32 amt)
} while
(mobjinfo[op_currentthing].doomednum == -1
|| op_currentthing == MT_NIGHTSDRONE
|| mobjinfo[op_currentthing].flags & MF_NOSECTOR
|| mobjinfo[op_currentthing].flags & (MF_AMBIENT|MF_NOSECTOR)
|| (states[mobjinfo[op_currentthing].spawnstate].sprite == SPR_NULL
&& states[mobjinfo[op_currentthing].seestate].sprite == SPR_NULL)
);

View file

@ -8826,7 +8826,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->flags2 & MF2_DEBRIS)
K_MineExplodeThink(mobj);
if (mobj->type == MT_AMBIENT)
if (mobj->flags & MF_AMBIENT)
{
if (leveltime % mobj->health)
return;
@ -12073,6 +12073,32 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
}
}
if (mobj->flags & MF_SPRING && mobj->info->painchance == 3)
{
if (mthing->args[0])
mobj->flags2 |= MF2_AMBUSH;
}
if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0)
{
switch (mthing->args[1])
{
case TMMR_SAME:
default:
break;
case TMMR_WEAK:
mobj->flags2 |= MF2_AMBUSH;
break;
case TMMR_STRONG:
mobj->flags2 |= MF2_STRONGBOX;
}
}
// Custom ambient sounds
if ((mobj->flags & MF_AMBIENT) && mobj->type != MT_AMBIENT)
{
mobj->threshold = mobj->info->seesound;
mobj->health = mobj->info->spawnhealth;
}
return true;
}

View file

@ -122,7 +122,7 @@ typedef enum
// Don't apply gravity (every tic); object will float, keeping current height
// or changing it actively.
MF_NOGRAVITY = 1<<9,
// This object is an ambient sound. Obsolete, but keep this around for backwards compatibility.
// This object is an ambient sound.
MF_AMBIENT = 1<<10,
// Slide this object when it hits a wall.
MF_SLIDEME = 1<<11,