diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index 9141009c8..86ba90686 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -450,8 +450,8 @@ public: private: bool RepositionCoords (int &x, int &y, int xo, int yo, const int w, const int h) const; void DrawMessages (int layer, int bottom); - void DrawConsistancy () const; - void DrawWaiting () const; + double DrawConsistancy (double yOfs) const; + double DrawWaiting (double yOfs) const; TObjPtr Messages[NUM_HUDMSGLAYERS]; }; diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 94715337f..16e611dad 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -1222,16 +1222,16 @@ void DBaseStatusBar::DrawTopStuff (EHudState state) DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : twod->GetHeight()); primaryLevel->localEventManager->RenderOverlay(state); - DrawConsistancy (); - DrawWaiting (); + double yOfs = DrawConsistancy (0.0); + DrawWaiting (yOfs); if ((ShowLog && MustDrawLog(state)) || (inter_subtitles && CPlayer->SubtitleCounter > 0)) DrawLog (); } -void DBaseStatusBar::DrawConsistancy() const +double DBaseStatusBar::DrawConsistancy(double yOfs) const { if (!netgame) - return; + return yOfs; bool desync = false; FString text = "Out of sync with:"; @@ -1243,21 +1243,21 @@ void DBaseStatusBar::DrawConsistancy() const // Fell out of sync with the host in packet server mode. Which specific user it is doesn't really matter. if (NetMode == NET_PacketServer && consoleplayer != Net_Arbitrator) { - text.AppendFormat(" %s (%d)", players[Net_Arbitrator].userinfo.GetName(10u), Net_Arbitrator + 1); + text = "Out of sync with host"; break; } else { - text.AppendFormat(" %s (%d)", players[client].userinfo.GetName(10u), client + 1); + text.AppendFormat(" %s (%d)", players[client].userinfo.GetName(10u), client); } } } + double y = yOfs; if (desync) { auto lines = V_BreakLines(SmallFont, twod->GetWidth() / CleanXfac - 40, text.GetChars()); const int height = SmallFont->GetHeight() * CleanYfac; - double y = 0.0; for (auto& line : lines) { DrawText(twod, SmallFont, CR_GREEN, @@ -1266,12 +1266,14 @@ void DBaseStatusBar::DrawConsistancy() const y += height; } } + + return y; } -void DBaseStatusBar::DrawWaiting() const +double DBaseStatusBar::DrawWaiting(double yOfs) const { if (!netgame) - return; + return yOfs; FString text = "Waiting for:"; bool isWaiting = false; @@ -1280,15 +1282,23 @@ void DBaseStatusBar::DrawWaiting() const if (players[client].waiting) { isWaiting = true; - text.AppendFormat(" %s (%d)", players[client].userinfo.GetName(10u), client + 1); + if (NetMode == NET_PacketServer && consoleplayer != Net_Arbitrator) + { + text = "Waiting for host"; + break; + } + else + { + text.AppendFormat(" %s (%d)", players[client].userinfo.GetName(10u), client); + } } } + double y = yOfs; if (isWaiting) { auto lines = V_BreakLines(SmallFont, twod->GetWidth() / CleanXfac - 40, text.GetChars()); const int height = SmallFont->GetHeight() * CleanYfac; - double y = 0.0; for (auto& line : lines) { DrawText(twod, SmallFont, CR_ORANGE, @@ -1297,6 +1307,8 @@ void DBaseStatusBar::DrawWaiting() const y += height; } } + + return y; } void DBaseStatusBar::NewGame ()