Skip to content

Commit eb8861c

Browse files
committed
Fix stacked flight sound loops in multiplayer
1 parent 8fa2c98 commit eb8861c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/xvt/audio/sound.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,17 @@ int Sound_QueueEffect(const char* soundName, int param2, int loop, int priority,
194194
return 0;
195195
if (Sound_FindLoadedEffectByName(name) == -1)
196196
return 0;
197+
#ifdef XVT_MODERN
198+
/* Loop callers test only playing instances; several simulation steps before
199+
a flush would otherwise start identical, phase-aligned loops. */
200+
if (loop == 1) {
201+
for (queueIndex = 0; queueIndex < g_soundQueueCount; ++queueIndex) {
202+
if (g_soundQueue[queueIndex].loop == 1 &&
203+
strncmp(g_soundQueue[queueIndex].name, name, sizeof(g_soundQueue[queueIndex].name)) == 0)
204+
return 1;
205+
}
206+
}
207+
#endif
197208

198209
queueIndex = 0;
199210
if (g_soundQueueCount > queueIndex) {

0 commit comments

Comments
 (0)