From 4140f93e41eb2da2a777e5e741b79042a8366445 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 4 Jun 2026 09:00:50 +0200 Subject: [PATCH] update pingdisplay only once per second this will make sense later...... --- src/d_clisrv.c | 12 ++++++++++-- src/d_clisrv.h | 2 ++ src/hu_stuff.c | 20 ++++++++++++++++++++ src/hu_stuff.h | 1 + src/screen.c | 2 +- src/v_video.c | 10 ++++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index fb163acfa..23c0551b5 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -125,6 +125,7 @@ static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the UINT16 pingmeasurecount = 1; UINT32 realpingtable[MAXPLAYERS] = {}; //the base table of ping where an average will be sent to everyone. UINT32 playerpingtable[MAXPLAYERS] = {}; //table of player latency values. +UINT32 localplayerping = 0; #define GENTLEMANSMOOTHING (TICRATE) static tic_t reference_lag = 0; @@ -4447,6 +4448,7 @@ void SV_ResetServer(void) pingmeasurecount = 1; memset(realpingtable, 0, sizeof(realpingtable)); memset(playerpingtable, 0, sizeof(playerpingtable)); + localplayerping = 0; ClearAdminPlayers(); @@ -6983,10 +6985,12 @@ static void UpdatePingTable(void) INT32 i; + const boolean playing = Playing(); + if (server) { - //if (Playing() && !(gametime % 8)) // Value chosen based on _my vibes man_ << dont do this for v8 atleast, this is placeboeing ppl to hell and back - if (Playing() && !(gametime % 35)) // update once per second. + //if (playing && !(gametime % 8)) // Value chosen based on _my vibes man_ << dont do this for v8 atleast, this is placeboeing ppl to hell and back + if (playing && !(gametime % 35)) // update once per second. PingUpdate(); fastest = 0; @@ -7045,6 +7049,10 @@ static void UpdatePingTable(void) else lowest_lag = simulated_lag = 0; } + + // this is really dumb but oh well + if (playing && !(gametime % 35)) + localplayerping = playerpingtable[consoleplayer]; } #ifdef HOLEPUNCH diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 8392f13a1..29a33e351 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -650,6 +650,8 @@ extern UINT8 playernode[MAXPLAYERS]; extern boolean player_muted[MAXPLAYERS]; +extern UINT32 localplayerping; + INT32 D_NumPlayers(void); void D_ResetTiccmds(void); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 145ce240f..65bcf4e94 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2478,6 +2478,26 @@ void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags) } } +void HU_drawLocalPlayerPing(INT32 x, INT32 y, INT32 flags) +{ + UINT32 lag = localplayerping; + const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag)); + + if (gentleman) + { + lag = simulated_lag; + } + + if (cv_pingstyle.value == 0) // kart + { + HU_drawKartPing(x, y, lag, flags, gentleman); + } + else if (cv_pingstyle.value == 1) // old style ping + { + HU_drawOldPing(x, y, lag, flags, gentleman); + } +} + // // HU_DrawSpectatorTicker // diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 16b4bf0fc..30dfddc0c 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -104,6 +104,7 @@ void HU_Drawer(void); char HU_dequeueChatChar(void); void HU_clearChatChars(void); void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard. +void HU_drawLocalPlayerPing(INT32 x, INT32 y, INT32 flags); void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 hilicol); void HU_DrawEmeralds(INT32 x, INT32 y, INT32 pemeralds); const char *HU_SkinColorToConsoleColor(skincolors_t color); diff --git a/src/screen.c b/src/screen.c index a874ed530..67b7e0bf3 100644 --- a/src/screen.c +++ b/src/screen.c @@ -530,6 +530,6 @@ void SCR_DisplayLocalPing(void) if (cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level { INT32 dispy = (cv_ticrate.value == 1) ? 165 : ((cv_ticrate.value == 2 || cv_ticrate.value == 4) ? 172 : ((cv_ticrate.value == 3) ? 163 : 181)); // absolute buttpain - HU_drawPlayerPing(308, dispy, consoleplayer, pingflags); // consoleplayer's ping is everyone's ping in a splitnetgame :P + HU_drawLocalPlayerPing(308, dispy, pingflags); // consoleplayer's ping is everyone's ping in a splitnetgame :P } } diff --git a/src/v_video.c b/src/v_video.c index 585478c3a..0f4540216 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2203,6 +2203,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) { if (!*ch) break; + if (*ch & 0x80) //color parsing -x 2.16.09 { // manually set flags override color codes @@ -2213,6 +2214,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) } continue; } + if (*ch == '\n') { cx = x; @@ -2247,6 +2249,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string) if (cx > scrwidth) break; + if (cx+left + w < 0) //left boundary check { cx += w; @@ -2304,6 +2307,7 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) { if (!*ch) break; + if (*ch & 0x80) //color parsing -x 2.16.09 { // manually set flags override color codes @@ -2314,6 +2318,7 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) } continue; } + if (*ch == '\n') { cx = x; @@ -2348,6 +2353,7 @@ void V_DrawKartString(INT32 x, INT32 y, INT32 option, const char *string) if (cx > scrwidth) break; + if (cx+left + w < 0) //left boundary check { cx += w; @@ -2422,6 +2428,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) { if (!*ch) break; + if (*ch & 0x80) //color parsing -x 2.16.09 { // manually set flags override color codes @@ -2432,6 +2439,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string) } continue; } + if (*ch == '\n') { cx = x; @@ -2540,6 +2548,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) { if (!*ch) break; + if (*ch & 0x80) //color parsing -x 2.16.09 { // manually set flags override color codes @@ -2550,6 +2559,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string) } continue; } + if (*ch == '\n') { cx = x;