Local sound effects play during simulations, other sound effects play during gametic

This commit is contained in:
Louis authored and Ashnal committed 2020-02-17 01:46:39 -05:00
1 parent a7b5df6793
commit afe57f1d05
2 files changed
+6 -15

No files matched your search

+2 -14
View File
@@ -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
+4 -1
View File
@@ -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;