From 1cd5e10ab084b2df0649ad3f89e6900c7e852ed4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 11 Apr 2023 16:19:27 +0200 Subject: [PATCH] Fix custom ambient sound mobjs not working --- src/m_cheat.c | 2 +- src/p_mobj.c | 8 +++++++- src/p_mobj.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 1056ecb02..4ea8d13b4 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -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) ); diff --git a/src/p_mobj.c b/src/p_mobj.c index c8adb6f1d..0776e4484 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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; } diff --git a/src/p_mobj.h b/src/p_mobj.h index 2cf177d23..a839eaba6 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -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,