- reset the network timer after lengthy operations.

This includes loading a level and busy-waiting for a sound to play.
Also block these loops and the sounds they wait for in network games to avoid problems from longer delays here.
The problem seems to be directly inherited from ZDoom which shows the same issue with screen wipes.

Fixes #297
This commit is contained in:
Christoph Oelckers 2020-09-02 10:00:07 +02:00
parent 4feae913cd
commit aabbbcb2ff
6 changed files with 27 additions and 18 deletions

View file

@ -1972,9 +1972,12 @@ void Net_SkipCommand (int type, uint8_t **stream)
#endif
}
// Reset the network ticker after finishing a lengthy operation.
// Q: How does this affect network sync? Only allowed in SP games?
void Net_ClearFifo(void)
{
// Q: Do we need this?
I_SetFrameTime();
gametime = I_GetTime();
}

View file

@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "statistics.h"
#include "g_input.h"
#include "core/menu/menu.h"
#include "d_net.h"
BEGIN_PS_NS
@ -78,7 +79,7 @@ static int FinishLevel(TArray<JobDesc> &jobs)
STAT_Update(lnum == kMap20);
if (lnum != kMap20)
{
if (EndLevel != 2)
if (EndLevel != 2 && !netgame)
{
// There's really no choice but to enter an active wait loop here to make the sound play out.
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
@ -88,6 +89,7 @@ static int FinishLevel(TArray<JobDesc> &jobs)
I_GetEvent();
soundEngine->UpdateSounds(I_GetTime());
}
Net_ClearFifo();
}
}
else nPlayerLives[0] = 0;

View file

@ -274,7 +274,7 @@ void GameInterface::StartGame(FNewGameStartup& gs)
if (gs.Skill >=0 && gs.Skill <= 5) skillsound = isRR()? sounds_r[gs.Skill] : sounds_d[gs.Skill];
ud.m_player_skill = gs.Skill + 1;
if (menu_sounds && skillsound >= 0 && SoundEnabled())
if (menu_sounds && skillsound >= 0 && SoundEnabled() && !netgame)
{
S_PlaySound(skillsound, CHAN_AUTO, CHANF_UI);
@ -284,6 +284,7 @@ void GameInterface::StartGame(FNewGameStartup& gs)
soundEngine->UpdateSounds(I_GetTime());
I_GetEvent();
}
Net_ClearFifo();
}
ud.m_respawn_monsters = (gs.Skill == 3);

View file

@ -1011,7 +1011,6 @@ int enterlevel(MapRecord *mi, int gamemode)
global_random = 0;
ud.last_level = currentLevel->levelNumber;
Net_ClearFifo();
for (int i=numinterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];
ps[myconnectindex].over_shoulder_on = 0;
clearfrags();

View file

@ -517,7 +517,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
recreateinterpolations();
show_shareware = 0;
everyothertime = 0;
Net_ClearFifo();
// should be unnecessary with the sounds getting serialized as well.
#if 0

View file

@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "menus.h"
#include "pal.h"
#include "keydef.h"
#include "d_net.h"
#include "gamecontrol.h"
#include "misc.h"
@ -218,20 +219,24 @@ void GameInterface::StartGame(FNewGameStartup& gs)
//InitNewGame();
if (Skill == 0)
PlaySound(DIGI_TAUNTAI3, v3df_none, CHAN_VOICE, CHANF_UI);
else if (Skill == 1)
PlaySound(DIGI_NOFEAR, v3df_none, CHAN_VOICE, CHANF_UI);
else if (Skill == 2)
PlaySound(DIGI_WHOWANTSWANG, v3df_none, CHAN_VOICE, CHANF_UI);
else if (Skill == 3)
PlaySound(DIGI_NOPAIN, v3df_none, CHAN_VOICE, CHANF_UI);
while (soundEngine->IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_VOICE))
if (!netgame)
{
gi->UpdateSounds();
soundEngine->UpdateSounds(I_GetTime());
I_GetEvent();
if (Skill == 0)
PlaySound(DIGI_TAUNTAI3, v3df_none, CHAN_VOICE, CHANF_UI);
else if (Skill == 1)
PlaySound(DIGI_NOFEAR, v3df_none, CHAN_VOICE, CHANF_UI);
else if (Skill == 2)
PlaySound(DIGI_WHOWANTSWANG, v3df_none, CHAN_VOICE, CHANF_UI);
else if (Skill == 3)
PlaySound(DIGI_NOPAIN, v3df_none, CHAN_VOICE, CHANF_UI);
while (soundEngine->IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_VOICE))
{
gi->UpdateSounds();
soundEngine->UpdateSounds(I_GetTime());
I_GetEvent();
}
Net_ClearFifo();
}
}