From f422db029eaf1287fc0b287438a8fc2933c4dade 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 | 28 +++++++++++++++++++++++++++- src/p_mobj.h | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 8cf65b60e..875be4366 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -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) ); diff --git a/src/p_mobj.c b/src/p_mobj.c index cfc99ad13..a9b339a3b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -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; } diff --git a/src/p_mobj.h b/src/p_mobj.h index 3a3ebcf4f..97ca4ff2c 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -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,