mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into ironman
This commit is contained in:
commit
33203bb53f
4 changed files with 139 additions and 80 deletions
139
src/d_clisrv.c
139
src/d_clisrv.c
|
|
@ -5580,53 +5580,56 @@ static INT32 pingtimeout[MAXPLAYERS];
|
||||||
static inline void PingUpdate(void)
|
static inline void PingUpdate(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
boolean laggers[MAXPLAYERS];
|
boolean pingkick[MAXPLAYERS];
|
||||||
UINT8 numlaggers = 0;
|
UINT8 nonlaggers = 0;
|
||||||
memset(laggers, 0, sizeof(boolean) * MAXPLAYERS);
|
memset(pingkick, 0, sizeof(pingkick));
|
||||||
|
|
||||||
netbuffer->packettype = PT_PING;
|
netbuffer->packettype = PT_PING;
|
||||||
|
|
||||||
//check for ping limit breakage.
|
//check for ping limit breakage.
|
||||||
if (cv_maxping.value)
|
if (cv_maxping.value)
|
||||||
{
|
{
|
||||||
for (i = 1; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i]
|
if (!playeringame[i] || P_IsMachineLocalPlayer(&players[i]))
|
||||||
&& (realpingtable[i] / pingmeasurecount > (unsigned)cv_maxping.value))
|
|
||||||
{
|
{
|
||||||
if (players[i].jointime > 30 * TICRATE)
|
pingtimeout[i] = 0;
|
||||||
laggers[i] = true;
|
continue;
|
||||||
numlaggers++;
|
}
|
||||||
|
|
||||||
|
if ((cv_maxping.value)
|
||||||
|
&& (realpingtable[i] / pingmeasurecount > (unsigned)cv_maxping.value))
|
||||||
|
{
|
||||||
|
if (players[i].jointime > 10 * TICRATE)
|
||||||
|
{
|
||||||
|
pingkick[i] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pingtimeout[i] = 0;
|
{
|
||||||
|
nonlaggers++;
|
||||||
|
|
||||||
|
// you aren't lagging, but you aren't free yet. In case you'll keep spiking, we just make the timer go back down. (Very unstable net must still get kicked).
|
||||||
|
if (pingtimeout[i] > 0)
|
||||||
|
pingtimeout[i]--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//kick lagging players... unless everyone but the server's ping sucks.
|
//kick lagging players... unless everyone but the server's ping sucks.
|
||||||
//in that case, it is probably the server's fault.
|
//in that case, it is probably the server's fault.
|
||||||
if (numlaggers < D_NumPlayers() - 1)
|
if (nonlaggers > 0)
|
||||||
{
|
{
|
||||||
for (i = 1; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
if (playeringame[i] && laggers[i])
|
if (!playeringame[i] || !pingkick[i])
|
||||||
{
|
continue;
|
||||||
pingtimeout[i]++;
|
|
||||||
|
|
||||||
// ok your net has been bad for too long, you deserve to die.
|
// Don't kick on ping alone if we haven't reached our threshold yet.
|
||||||
if (pingtimeout[i] > cv_pingtimeout.value)
|
if (++pingtimeout[i] < cv_pingtimeout.value)
|
||||||
{
|
continue;
|
||||||
pingtimeout[i] = 0;
|
|
||||||
SendKick(i, KICK_MSG_PING_HIGH);
|
pingtimeout[i] = 0;
|
||||||
}
|
SendKick(i, KICK_MSG_PING_HIGH);
|
||||||
}
|
|
||||||
/*
|
|
||||||
you aren't lagging,
|
|
||||||
but you aren't free yet.
|
|
||||||
In case you'll keep spiking,
|
|
||||||
we just make the timer go back down. (Very unstable net must still get kicked).
|
|
||||||
*/
|
|
||||||
else
|
|
||||||
pingtimeout[i] = (pingtimeout[i] == 0 ? 0 : pingtimeout[i]-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5807,6 +5810,9 @@ void NetKeepAlive(void)
|
||||||
FileSendTicker();
|
FileSendTicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a tree falls in the forest but nobody is around to hear it, does it make a tic?
|
||||||
|
#define DEDICATEDIDLETIME (10*TICRATE)
|
||||||
|
|
||||||
void NetUpdate(void)
|
void NetUpdate(void)
|
||||||
{
|
{
|
||||||
static tic_t resptime = 0;
|
static tic_t resptime = 0;
|
||||||
|
|
@ -5819,6 +5825,7 @@ void NetUpdate(void)
|
||||||
|
|
||||||
if (realtics <= 0) // nothing new to update
|
if (realtics <= 0) // nothing new to update
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (realtics > 5)
|
if (realtics > 5)
|
||||||
{
|
{
|
||||||
if (server)
|
if (server)
|
||||||
|
|
@ -5827,6 +5834,55 @@ void NetUpdate(void)
|
||||||
realtics = 5;
|
realtics = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEDICATEDIDLETIME
|
||||||
|
if (server && dedicated && gamestate == GS_LEVEL)
|
||||||
|
{
|
||||||
|
static tic_t dedicatedidle = 0;
|
||||||
|
|
||||||
|
for (i = 1; i < MAXNETNODES; ++i)
|
||||||
|
if (nodeingame[i])
|
||||||
|
{
|
||||||
|
if (dedicatedidle == DEDICATEDIDLETIME)
|
||||||
|
{
|
||||||
|
CONS_Printf("DEDICATED: Awakening from idle (Node %d detected...)\n", i);
|
||||||
|
dedicatedidle = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == MAXNETNODES)
|
||||||
|
{
|
||||||
|
if (leveltime == 2)
|
||||||
|
{
|
||||||
|
// On next tick...
|
||||||
|
dedicatedidle = DEDICATEDIDLETIME-1;
|
||||||
|
}
|
||||||
|
else if (dedicatedidle == DEDICATEDIDLETIME)
|
||||||
|
{
|
||||||
|
if (D_GetExistingTextcmd(gametic, 0) || D_GetExistingTextcmd(gametic+1, 0))
|
||||||
|
{
|
||||||
|
CONS_Printf("DEDICATED: Awakening from idle (Netxcmd detected...)\n");
|
||||||
|
dedicatedidle = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realtics = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((dedicatedidle += realtics) >= DEDICATEDIDLETIME)
|
||||||
|
{
|
||||||
|
const char *idlereason = "at round start";
|
||||||
|
if (leveltime > 3)
|
||||||
|
idlereason = va("for %d seconds", dedicatedidle/TICRATE);
|
||||||
|
|
||||||
|
CONS_Printf("DEDICATED: No nodes %s, idling...\n", idlereason);
|
||||||
|
realtics = 0;
|
||||||
|
dedicatedidle = DEDICATEDIDLETIME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gametime = nowtime;
|
gametime = nowtime;
|
||||||
|
|
||||||
UpdatePingTable();
|
UpdatePingTable();
|
||||||
|
|
@ -5864,25 +5920,26 @@ void NetUpdate(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!demo.playback)
|
if (!demo.playback && realtics > 0)
|
||||||
{
|
{
|
||||||
INT32 counts;
|
INT32 counts;
|
||||||
|
|
||||||
hu_redownloadinggamestate = false;
|
hu_redownloadinggamestate = false;
|
||||||
|
|
||||||
firstticstosend = gametic;
|
|
||||||
for (i = 0; i < MAXNETNODES; i++)
|
|
||||||
if (nodeingame[i] && nettics[i] < firstticstosend)
|
|
||||||
{
|
|
||||||
firstticstosend = nettics[i];
|
|
||||||
|
|
||||||
if (maketic + 1 >= nettics[i] + BACKUPTICS)
|
|
||||||
Net_ConnectionTimeout(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't erase tics not acknowledged
|
// Don't erase tics not acknowledged
|
||||||
counts = realtics;
|
counts = realtics;
|
||||||
|
|
||||||
|
firstticstosend = gametic;
|
||||||
|
for (i = 0; i < MAXNETNODES; i++)
|
||||||
|
{
|
||||||
|
if (!nodeingame[i])
|
||||||
|
continue;
|
||||||
|
if (nettics[i] < firstticstosend)
|
||||||
|
firstticstosend = nettics[i];
|
||||||
|
if (maketic + counts >= nettics[i] + (BACKUPTICS - TICRATE))
|
||||||
|
Net_ConnectionTimeout(i);
|
||||||
|
}
|
||||||
|
|
||||||
if (maketic + counts >= firstticstosend + BACKUPTICS)
|
if (maketic + counts >= firstticstosend + BACKUPTICS)
|
||||||
counts = firstticstosend+BACKUPTICS-maketic-1;
|
counts = firstticstosend+BACKUPTICS-maketic-1;
|
||||||
|
|
||||||
|
|
|
||||||
29
src/d_main.c
29
src/d_main.c
|
|
@ -1203,8 +1203,7 @@ D_ConvertVersionNumbers (void)
|
||||||
void D_SRB2Main(void)
|
void D_SRB2Main(void)
|
||||||
{
|
{
|
||||||
INT32 i, p;
|
INT32 i, p;
|
||||||
|
INT32 pstartmap = 0;
|
||||||
INT32 pstartmap = 1;
|
|
||||||
boolean autostart = false;
|
boolean autostart = false;
|
||||||
|
|
||||||
/* break the version string into version numbers, for netplay */
|
/* break the version string into version numbers, for netplay */
|
||||||
|
|
@ -1756,11 +1755,14 @@ void D_SRB2Main(void)
|
||||||
|
|
||||||
// Has to be done before anything else so skin, color, etc in command buffer has an affect.
|
// Has to be done before anything else so skin, color, etc in command buffer has an affect.
|
||||||
// ttlprofilen used because it's roughly equivalent in functionality - a QoL aid for quickly getting from startup to action
|
// ttlprofilen used because it's roughly equivalent in functionality - a QoL aid for quickly getting from startup to action
|
||||||
PR_ApplyProfile(cv_ttlprofilen.value, 0);
|
if (!dedicated)
|
||||||
|
|
||||||
for (i = 1; i < cv_splitplayers.value; i++)
|
|
||||||
{
|
{
|
||||||
PR_ApplyProfile(cv_lastprofile[i].value, i);
|
PR_ApplyProfile(cv_ttlprofilen.value, 0);
|
||||||
|
|
||||||
|
for (i = 1; i < cv_splitplayers.value; i++)
|
||||||
|
{
|
||||||
|
PR_ApplyProfile(cv_lastprofile[i].value, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autostart || netgame)
|
if (autostart || netgame)
|
||||||
|
|
@ -1842,8 +1844,13 @@ void D_SRB2Main(void)
|
||||||
CV_SetValue(&cv_kartspeed, newskill);
|
CV_SetValue(&cv_kartspeed, newskill);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server && !M_CheckParm("+map"))
|
if (server && (dedicated || !M_CheckParm("+map")))
|
||||||
{
|
{
|
||||||
|
if (!pstartmap && (pstartmap = G_GetFirstMapOfGametype(gametype)+1) > nummapheaders)
|
||||||
|
{
|
||||||
|
I_Error("Can't get first map of gametype\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (M_MapLocked(pstartmap))
|
if (M_MapLocked(pstartmap))
|
||||||
{
|
{
|
||||||
G_SetUsedCheats();
|
G_SetUsedCheats();
|
||||||
|
|
@ -1865,14 +1872,6 @@ void D_SRB2Main(void)
|
||||||
|
|
||||||
CON_ToggleOff();
|
CON_ToggleOff();
|
||||||
|
|
||||||
if (dedicated && server)
|
|
||||||
{
|
|
||||||
levelstarttic = gametic;
|
|
||||||
G_SetGamestate(GS_LEVEL);
|
|
||||||
if (!P_LoadLevel(false, false))
|
|
||||||
I_Quit(); // fail so reset game stuff
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
#ifdef HAVE_DISCORDRPC
|
||||||
if (! dedicated)
|
if (! dedicated)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -801,8 +801,6 @@ void D_RegisterServerCommands(void)
|
||||||
CV_RegisterVar(&cv_pingmeasurement);
|
CV_RegisterVar(&cv_pingmeasurement);
|
||||||
CV_RegisterVar(&cv_showviewpointtext);
|
CV_RegisterVar(&cv_showviewpointtext);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_director);
|
|
||||||
|
|
||||||
CV_RegisterVar(&cv_schedule);
|
CV_RegisterVar(&cv_schedule);
|
||||||
CV_RegisterVar(&cv_automate);
|
CV_RegisterVar(&cv_automate);
|
||||||
CV_RegisterVar(&cv_livestudioaudience);
|
CV_RegisterVar(&cv_livestudioaudience);
|
||||||
|
|
@ -815,6 +813,23 @@ void D_RegisterServerCommands(void)
|
||||||
|
|
||||||
CV_RegisterVar(&cv_discordinvites);
|
CV_RegisterVar(&cv_discordinvites);
|
||||||
RegisterNetXCmd(XD_DISCORD, Got_DiscordInfo);
|
RegisterNetXCmd(XD_DISCORD, Got_DiscordInfo);
|
||||||
|
|
||||||
|
COM_AddCommand("numthinkers", Command_Numthinkers_f);
|
||||||
|
COM_AddCommand("countmobjs", Command_CountMobjs_f);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
||||||
|
CV_RegisterVar(&cv_netdemosyncquality);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_shoutname);
|
||||||
|
CV_RegisterVar(&cv_shoutcolor);
|
||||||
|
CV_RegisterVar(&cv_autoshout);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
COM_AddCommand("causecfail", Command_CauseCfail_f);
|
||||||
|
#endif
|
||||||
|
#ifdef LUA_ALLOW_BYTECODE
|
||||||
|
COM_AddCommand("dumplua", Command_Dumplua_f);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
@ -838,9 +853,6 @@ void D_RegisterClientCommands(void)
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COM_AddCommand("numthinkers", Command_Numthinkers_f);
|
|
||||||
COM_AddCommand("countmobjs", Command_CountMobjs_f);
|
|
||||||
|
|
||||||
COM_AddCommand("changeteam", Command_Teamchange_f);
|
COM_AddCommand("changeteam", Command_Teamchange_f);
|
||||||
COM_AddCommand("changeteam2", Command_Teamchange2_f);
|
COM_AddCommand("changeteam2", Command_Teamchange2_f);
|
||||||
COM_AddCommand("changeteam3", Command_Teamchange3_f);
|
COM_AddCommand("changeteam3", Command_Teamchange3_f);
|
||||||
|
|
@ -936,9 +948,6 @@ void D_RegisterClientCommands(void)
|
||||||
|
|
||||||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_recordmultiplayerdemos);
|
|
||||||
CV_RegisterVar(&cv_netdemosyncquality);
|
|
||||||
|
|
||||||
// FIXME: not to be here.. but needs be done for config loading
|
// FIXME: not to be here.. but needs be done for config loading
|
||||||
CV_RegisterVar(&cv_globalgamma);
|
CV_RegisterVar(&cv_globalgamma);
|
||||||
CV_RegisterVar(&cv_globalsaturation);
|
CV_RegisterVar(&cv_globalsaturation);
|
||||||
|
|
@ -977,10 +986,6 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_chatnotifications);
|
CV_RegisterVar(&cv_chatnotifications);
|
||||||
CV_RegisterVar(&cv_chatbacktint);
|
CV_RegisterVar(&cv_chatbacktint);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_shoutname);
|
|
||||||
CV_RegisterVar(&cv_shoutcolor);
|
|
||||||
CV_RegisterVar(&cv_autoshout);
|
|
||||||
|
|
||||||
CV_RegisterVar(&cv_songcredits);
|
CV_RegisterVar(&cv_songcredits);
|
||||||
CV_RegisterVar(&cv_tutorialprompt);
|
CV_RegisterVar(&cv_tutorialprompt);
|
||||||
CV_RegisterVar(&cv_showfocuslost);
|
CV_RegisterVar(&cv_showfocuslost);
|
||||||
|
|
@ -1028,7 +1033,6 @@ void D_RegisterClientCommands(void)
|
||||||
// screen.c
|
// screen.c
|
||||||
CV_RegisterVar(&cv_fullscreen);
|
CV_RegisterVar(&cv_fullscreen);
|
||||||
CV_RegisterVar(&cv_renderview);
|
CV_RegisterVar(&cv_renderview);
|
||||||
CV_RegisterVar(&cv_renderhitbox);
|
|
||||||
CV_RegisterVar(&cv_vhseffect);
|
CV_RegisterVar(&cv_vhseffect);
|
||||||
CV_RegisterVar(&cv_shittyscreen);
|
CV_RegisterVar(&cv_shittyscreen);
|
||||||
CV_RegisterVar(&cv_renderer);
|
CV_RegisterVar(&cv_renderer);
|
||||||
|
|
@ -1036,6 +1040,8 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_scr_width);
|
CV_RegisterVar(&cv_scr_width);
|
||||||
CV_RegisterVar(&cv_scr_height);
|
CV_RegisterVar(&cv_scr_height);
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_director);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_soundtest);
|
CV_RegisterVar(&cv_soundtest);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_invincmusicfade);
|
CV_RegisterVar(&cv_invincmusicfade);
|
||||||
|
|
@ -1056,7 +1062,7 @@ void D_RegisterClientCommands(void)
|
||||||
// CV_RegisterVar(&cv_grid);
|
// CV_RegisterVar(&cv_grid);
|
||||||
// CV_RegisterVar(&cv_snapto);
|
// CV_RegisterVar(&cv_snapto);
|
||||||
|
|
||||||
// add cheat commands
|
// add cheats
|
||||||
COM_AddCommand("noclip", Command_CheatNoClip_f);
|
COM_AddCommand("noclip", Command_CheatNoClip_f);
|
||||||
COM_AddCommand("god", Command_CheatGod_f);
|
COM_AddCommand("god", Command_CheatGod_f);
|
||||||
COM_AddCommand("setrings", Command_Setrings_f);
|
COM_AddCommand("setrings", Command_Setrings_f);
|
||||||
|
|
@ -1071,12 +1077,7 @@ void D_RegisterClientCommands(void)
|
||||||
COM_AddCommand("skynum", Command_Skynum_f);
|
COM_AddCommand("skynum", Command_Skynum_f);
|
||||||
COM_AddCommand("weather", Command_Weather_f);
|
COM_AddCommand("weather", Command_Weather_f);
|
||||||
COM_AddCommand("grayscale", Command_Grayscale_f);
|
COM_AddCommand("grayscale", Command_Grayscale_f);
|
||||||
#ifdef _DEBUG
|
CV_RegisterVar(&cv_renderhitbox);
|
||||||
COM_AddCommand("causecfail", Command_CauseCfail_f);
|
|
||||||
#endif
|
|
||||||
#ifdef LUA_ALLOW_BYTECODE
|
|
||||||
COM_AddCommand("dumplua", Command_Dumplua_f);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
#ifdef HAVE_DISCORDRPC
|
||||||
CV_RegisterVar(&cv_discordrp);
|
CV_RegisterVar(&cv_discordrp);
|
||||||
|
|
|
||||||
|
|
@ -449,9 +449,10 @@ void PR_ApplyProfile(UINT8 profilenum, UINT8 playernum)
|
||||||
profile_t *p = PR_GetProfile(profilenum);
|
profile_t *p = PR_GetProfile(profilenum);
|
||||||
|
|
||||||
// this CAN happen!!
|
// this CAN happen!!
|
||||||
if (p == NULL)
|
if (dedicated || p == NULL)
|
||||||
{
|
{
|
||||||
CONS_Printf("Profile '%d' could not be loaded as it does not exist. Guest Profile will be loaded instead.\n", profilenum);
|
if (!dedicated)
|
||||||
|
CONS_Printf("Profile '%d' could not be loaded as it does not exist. Guest Profile will be loaded instead.\n", profilenum);
|
||||||
profilenum = 0; // make sure to set this so that the cvar is set properly.
|
profilenum = 0; // make sure to set this so that the cvar is set properly.
|
||||||
p = PR_GetProfile(profilenum);
|
p = PR_GetProfile(profilenum);
|
||||||
}
|
}
|
||||||
|
|
@ -481,9 +482,10 @@ void PR_ApplyProfilePretend(UINT8 profilenum, UINT8 playernum)
|
||||||
profile_t *p = PR_GetProfile(profilenum);
|
profile_t *p = PR_GetProfile(profilenum);
|
||||||
|
|
||||||
// this CAN happen!!
|
// this CAN happen!!
|
||||||
if (p == NULL)
|
if (dedicated || p == NULL)
|
||||||
{
|
{
|
||||||
CONS_Printf("Profile '%d' could not be loaded as it does not exist. Guest Profile will be loaded instead.\n", profilenum);
|
if (!dedicated)
|
||||||
|
CONS_Printf("Profile '%d' could not be loaded as it does not exist. Guest Profile will be loaded instead.\n", profilenum);
|
||||||
profilenum = 0; // make sure to set this so that the cvar is set properly.
|
profilenum = 0; // make sure to set this so that the cvar is set properly.
|
||||||
p = PR_GetProfile(profilenum);
|
p = PR_GetProfile(profilenum);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue