From ede34864acd0eb15973048940ff2dcfbaf7e9ee4 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 11 Aug 2022 23:18:48 +0100 Subject: [PATCH 1/6] Fix changing gamespeed from the menu, for real I originally wrote a ridiculous attempt at reimplementing the existing value rollaround. For one reason or another, that sidesteps net transmission. Let's just avoid all those hacks and limit our influence to changing the maximum allowed range. # Conflicts: # src/command.c --- src/command.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/command.c b/src/command.c index 6bbf58c44..c71fece57 100644 --- a/src/command.c +++ b/src/command.c @@ -2029,6 +2029,7 @@ void CV_AddValue(consvar_t *var, INT32 increment) if (var->PossibleValue[max].value == var->value) currentindice = max; + // The following options will NOT handle netsyncing. if (var == &cv_chooseskin) { // Special case for the chooseskin variable, used only directly from the menu @@ -2080,28 +2081,7 @@ void CV_AddValue(consvar_t *var, INT32 increment) } else if (var == &cv_kartspeed) { - INT32 maxspeed = (M_SecretUnlocked(SECRET_HARDSPEED) ? 2 : 1); - // Special case for the kartspeed variable, used only directly from the menu to prevent selecting hard mode - if (increment > 0) // Going up! - { - newvalue = var->value + 1; - if (newvalue > maxspeed) - newvalue = -1; - var->value = newvalue; - var->string = var->PossibleValue[var->value].strvalue; - var->func(); - return; - } - else if (increment < 0) // Going down! - { - newvalue = var->value - 1; - if (newvalue < -1) - newvalue = maxspeed; - var->value = newvalue; - var->string = var->PossibleValue[var->value].strvalue; - var->func(); - return; - } + max = (M_SecretUnlocked(SECRET_HARDSPEED) ? 3 : 2); } #ifdef PARANOIA if (currentindice == -1) From 1a6e54e6737301ae91d1ef09d71c878ff69e9e1c Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 16 Aug 2022 20:37:19 +0100 Subject: [PATCH 2/6] Fix VHS effect speeding up with interpolation. --- src/v_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 7e01f3393..7f0b86398 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1343,8 +1343,8 @@ void V_DrawVhsEffect(boolean rewind) if (rewind) V_DrawVhsEffect(false); // experimentation - upbary -= vid.dupy * (rewind ? 3 : 1.8f); - downbary += vid.dupy * (rewind ? 2 : 1); + upbary -= FixedMul(vid.dupy * (rewind ? 3 : 1.8f), renderdeltatics); + downbary += FixedMul(vid.dupy * (rewind ? 2 : 1), renderdeltatics); if (upbary < -barsize) upbary = vid.height; if (downbary > vid.height) downbary = -barsize; From 09d48b00f8925cda04b7ed64b27a604c3c9a244f Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 19 Aug 2022 19:55:08 -0700 Subject: [PATCH 3/6] Reset remotenode when discarding STUN/hole punch packet Fixes some wild behavior when a lot of hole punching requests are coming in. --- src/i_tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 1ca1b7f22..48f04b2be 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -595,13 +595,13 @@ static boolean SOCK_Get(void) #ifdef USE_STUN if (STUN_got_response(doomcom->data, c)) { - return false; + break; } #endif if (hole_punch(c)) { - return false; + break; } // find remote node number From 222b1b942202014966f731df59bd940c76655c78 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 19 Aug 2022 20:05:05 -0700 Subject: [PATCH 4/6] Master server: use I_OutputMsg during startup CONS_Printf calls CON_Drawer during startup, thread collision stuff. --- src/http-mserv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/http-mserv.c b/src/http-mserv.c index 68851483a..2def3cf8d 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -21,6 +21,7 @@ Documentation available here. #include "doomdef.h" #include "d_clisrv.h" #include "command.h" +#include "console.h" #include "m_argv.h" #include "m_menu.h" #include "mserv.h" @@ -81,6 +82,19 @@ Contact_error (void) ); } +static void +Printf_url (const char *url) +{ + boolean startup; + + I_lock_mutex(&con_mutex); + startup = con_startup; + I_unlock_mutex(con_mutex); + + (startup ? I_OutputMsg : CONS_Printf)( + "HMS: connecting '%s'...\n", url); +} + static size_t HMS_on_read (char *s, size_t _1, size_t n, void *userdata) { @@ -180,7 +194,7 @@ HMS_connect (const char *format, ...) if (quack_token) sprintf(&url[seek], "&token=%s", quack_token); - CONS_Printf("HMS: connecting '%s'...\n", url); + Printf_url(url); buffer = malloc(sizeof *buffer); buffer->curl = curl; From 41fa7fe14e1a17654cf3306d60f4d70f5ca1bc24 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 19 Aug 2022 20:19:45 -0700 Subject: [PATCH 5/6] Rename rendezvousserver to holepunchserver # Conflicts: # src/mserv.c --- src/mserv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mserv.c b/src/mserv.c index 37a5ea89c..b9d1825eb 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -70,7 +70,7 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = { }; consvar_t cv_masterserver = CVAR_INIT ("masterserver", "https://ms.kartkrew.org/ms/api", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange); -consvar_t cv_rendezvousserver = CVAR_INIT ("rendezvousserver", "relay.kartkrew.org", CV_SAVE|CV_CALL, NULL, RendezvousServer_OnChange); +consvar_t cv_rendezvousserver = CVAR_INIT ("holepunchserver", "relay.kartkrew.org", CV_SAVE|CV_CALL, NULL, RendezvousServer_OnChange); consvar_t cv_servername = CVAR_INIT ("servername", "Ring Racers server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters); consvar_t cv_server_contact = CVAR_INIT ("server_contact", "", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters); From 851a2094cf68433ac67d41ba0e3b842d2bdf04d4 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 24 Aug 2022 15:04:09 +0100 Subject: [PATCH 6/6] Don't even attempt to advertise a non-netgame server. This appears to be a long-time bug that exists upstream too, but nobody even knew about it before the MS rules alert made it clear this was actually happening! # Conflicts: # src/m_menu.c --- src/d_clisrv.c | 2 +- src/mserv.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b03eb478e..e26debd91 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3235,7 +3235,7 @@ void D_QuitNetGame(void) if (nodeingame[i]) HSendPacket(i, true, 0, 0); #ifdef MASTERSERVER - if (serverrunning && cv_advertise.value) + if (serverrunning && netgame && cv_advertise.value) // see mserv.c Online() UnregisterServer(); #endif } diff --git a/src/mserv.c b/src/mserv.c index b9d1825eb..98dd0820b 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -434,7 +434,7 @@ void UnregisterServer(void) static boolean Online (void) { - return ( serverrunning && cv_advertise.value ); + return ( serverrunning && netgame && cv_advertise.value ); } static inline void SendPingToMasterServer(void) @@ -532,7 +532,7 @@ Advertise_OnChange(void) if (cv_advertise.value) { - if (serverrunning) + if (serverrunning && netgame) { Lock_state(); {