Merge branch 'ambient-sound-fix' into 'next'

Fix custom ambient sound mobjs not working

See merge request STJr/SRB2!1961
This commit is contained in:
MascaraSnake 2023-04-12 08:01:38 +00:00
commit 9e8200c1e3
3 changed files with 9 additions and 3 deletions

View file

@ -1004,7 +1004,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

@ -10222,7 +10222,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->flags2 & MF2_FIRING)
P_FiringThink(mobj);
if (mobj->type == MT_AMBIENT)
if (mobj->flags & MF_AMBIENT)
{
if (leveltime % mobj->health)
return;
@ -13272,6 +13272,12 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
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

@ -118,7 +118,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,