From 3c54495c5825ea1c7f841cbc0b2085f505deda80 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 9 Jan 2022 23:03:11 +0100 Subject: [PATCH] - 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. --- source/games/duke/src/funct.h | 2 +- source/games/duke/src/sectors.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 2de7df663..b1f41e3f4 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -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); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 9c6c6bce1..29c36e8ac 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -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);