- Duke: hardened the sound controller a bit by flagging the callsound call from doanimations as most likely terminating.

This allows avoiding unnecessary sound repeats on some doors.
A real fix is not possible with the broken setup here - the sound controller can only implicitly toggle its state so it is likely that improper use is frequent.
This commit is contained in:
Christoph Oelckers 2022-01-09 23:03:11 +01:00
parent 0f925d4cc0
commit 3c54495c58
2 changed files with 5 additions and 5 deletions

View file

@ -137,7 +137,7 @@ int haskey(sectortype* sect, int snum);
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
void breakwall(int newpn, DDukeActor* spr, walltype* dawallnum);
int callsound(sectortype* sectnum,DDukeActor* snum);
int callsound(sectortype* sectnum,DDukeActor* snum, bool endstate = false);
int hitasprite(DDukeActor* snum,DDukeActor **hitSprite);
int findplayer(const DDukeActor* s, int* dist);
void operatejaildoors(int hitag);

View file

@ -51,7 +51,7 @@ static int interptype[] = { Interp_Sect_Floorz, Interp_Sect_Ceilingz, Interp_Wal
//---------------------------------------------------------------------------
static bool haltsoundhack;
int callsound(sectortype* sn, DDukeActor* whatsprite)
int callsound(sectortype* sn, DDukeActor* whatsprite, bool endstate)
{
if (!isRRRA() && haltsoundhack)
{
@ -71,7 +71,7 @@ int callsound(sectortype* sn, DDukeActor* whatsprite)
// Reset if the desired actor isn't playing anything.
bool hival = S_IsSoundValid(act->spr.hitag);
if (act->temp_data[0] == 1 && !hival)
if (act->temp_data[0] == 1 && !hival && !endstate)
{
if (!S_CheckActorSoundPlaying(act->temp_actor, snum))
act->temp_data[0] = 0;
@ -335,7 +335,7 @@ void doanimations(void)
continue;
if ((dasectp->lotag & 0xff) != ST_22_SPLITTING_DOOR)
callsound(dasectp, nullptr);
callsound(dasectp, nullptr, true);
continue;
}
@ -1154,7 +1154,7 @@ void operateactivators(int low, int plnum)
}
}
if (k == -1 && (act->sector()->lotag & 0xff) == 22)
if (k == -1 && (act->sector()->lotag & 0xff) == SE_22_TEETH_DOOR)
k = callsound(act->sector(), act);
operatesectors(act->sector(), act);