Fix custom ambient sound mobjs not working

This commit is contained in:
MascaraSnake 2023-04-11 16:19:27 +02:00
parent 3c81938496
commit 1cd5e10ab0
3 changed files with 9 additions and 3 deletions

View file

@ -1004,7 +1004,7 @@ static void OP_CycleThings(INT32 amt)
} while } while
(mobjinfo[op_currentthing].doomednum == -1 (mobjinfo[op_currentthing].doomednum == -1
|| op_currentthing == MT_NIGHTSDRONE || 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].spawnstate].sprite == SPR_NULL
&& states[mobjinfo[op_currentthing].seestate].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) if (mobj->flags2 & MF2_FIRING)
P_FiringThink(mobj); P_FiringThink(mobj);
if (mobj->type == MT_AMBIENT) if (mobj->flags & MF_AMBIENT)
{ {
if (leveltime % mobj->health) if (leveltime % mobj->health)
return; return;
@ -13272,6 +13272,12 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
mobj->flags2 |= MF2_STRONGBOX; 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; return true;
} }

View file

@ -118,7 +118,7 @@ typedef enum
// Don't apply gravity (every tic); object will float, keeping current height // Don't apply gravity (every tic); object will float, keeping current height
// or changing it actively. // or changing it actively.
MF_NOGRAVITY = 1<<9, 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, MF_AMBIENT = 1<<10,
// Slide this object when it hits a wall. // Slide this object when it hits a wall.
MF_SLIDEME = 1<<11, MF_SLIDEME = 1<<11,