diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 688c5191e..bc7e5079f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5518,7 +5518,6 @@ void TryRunTics(tic_t realtics) // record the actual local controls boolean recordingStates = (gamestate == GS_LEVEL) && leveltime >= 1 && gametic >= BACKUPTICS; boolean canSimulate = (gamestate == GS_LEVEL) && leveltime >= BACKUPTICS && gametic >= BACKUPTICS && (cv_simulate.value && !server) && !resynch_local_inprogress; - boolean preserveSoundDisabled = sound_disabled; if (simtic > gametic && !canSimulate) { @@ -5533,9 +5532,6 @@ void TryRunTics(tic_t realtics) InvalidateSavestates(); } - if (canSimulate) - sound_disabled = true; - PerformDebugRewinds(); // record the actual local controls for this frame @@ -5557,9 +5553,7 @@ void TryRunTics(tic_t realtics) P_LoadGameState(&gameStateBuffer[gametic % BACKUPTICS]); if (Consistancy() != consistancy[gametic%BACKUPTICS]) - { CONS_Printf("oops, consistency error, even I got that one!\n"); - } } else if (simtic != gametic && !gameStateBufferIsValid[gametic % BACKUPTICS]) CONS_Printf("Problem: game state buffer inaccessible but a simulation happened!!\n"); @@ -5569,6 +5563,8 @@ void TryRunTics(tic_t realtics) { DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic)); + targetsimtic = gametic + 1; + G_Ticker((gametic % NEWTICRATERATIO) == 0); ExtraDataTicker(); gametic++; @@ -5614,10 +5610,7 @@ void TryRunTics(tic_t realtics) // Simulate the game locally if (canSimulate) - { RunSimulations(); - sound_disabled = preserveSoundDisabled; - } // we're gonna need more debugs... MakeNetDebugString(); @@ -5631,7 +5624,6 @@ static void RunSimulations() if (!gameStateBufferIsValid[gametic % BACKUPTICS]) return; // do not simulate if we cannot guarantee a recovery - boolean preserveSoundDisabled = sound_disabled; static int lastsimtic = 0; int tastyFudge = 0; @@ -5679,7 +5671,6 @@ static void RunSimulations() // simulate the rest o da future issimulation = true; - sound_disabled = true; con_muted = true; simStartTime = I_GetTimeUs(); @@ -5699,8 +5690,6 @@ static void RunSimulations() else netcmds[gametic % BACKUPTICS][consoleplayer] = localTicBuffer[(liveTic - estimatedRTT + i + 1 + BACKUPTICS) % BACKUPTICS]; - sound_disabled = (i != numToSimulate - 1); - G_Ticker(true); // tic a bunch of times lol see what happens lolol simtic++; @@ -5718,7 +5707,6 @@ static void RunSimulations() } issimulation = false; - sound_disabled = preserveSoundDisabled; con_muted = false; // Finalise steadyplayers diff --git a/src/s_sound.c b/src/s_sound.c index 936e3ced9..c391a91f4 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -451,6 +451,9 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) if (sound_disabled || !sound_started) return; + if (((simtic != targetsimtic - 1 && origin == listenmobj) || (origin != listenmobj && issimulation))) // local player sounds play immediately during simulations + return; + // Don't want a sound? Okay then... if (sfx_id == sfx_None) return; @@ -1237,7 +1240,7 @@ void S_DetachChannelsFromOrigin(void* origin) if (channels[i].origin == origin) { // small hack: player-made sounds should stay hearable - if (channels[i].origin != players[displayplayer].mo) + if (originmobj->player != &players[displayplayer]) { channels[i].isdetached = true; channels[i].detachedx = originmobj->x;