From c58d789a07afb905a68d0c85055c4b9d74e7c36a Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 24 Feb 2022 22:51:01 -0800 Subject: [PATCH 1/6] Always reset tiregrease --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index a70ac1263..00bcfe378 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -436,9 +436,9 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) P_InitAngle(grease, K_MomentumAngle(object)); grease->extravalue1 = i; } - - object->player->tiregrease = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS } + + object->player->tiregrease = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS } return true; From a3eab3099edba0fc11c5f4dcb28eb84a210b205f Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 12 Mar 2022 23:18:55 +0000 Subject: [PATCH 2/6] Solve the concern about potential tiregrease overwriting. Let the video resume at once --- src/p_map.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 00bcfe378..8b07a4e32 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -438,7 +438,10 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) } } - object->player->tiregrease = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS + if (object->player->tiregrease < greasetics) + { + object->player->tiregrease = greasetics; + } } return true; From fcb6a4e1ab0dd3a58bb2c0d2d6d0f9c9c6a9773d Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 14 Mar 2022 16:33:03 +0000 Subject: [PATCH 3/6] Disable the vanilla-sourced "keepbody" (rejointimeout) feature. --- src/command.c | 2 +- src/d_clisrv.c | 161 +++++-------------------------------------- src/d_clisrv.h | 3 +- src/d_netcmd.c | 51 +++++++------- src/d_player.h | 1 - src/g_game.c | 3 - src/hu_stuff.c | 4 +- src/k_bot.c | 2 +- src/lua_consolelib.c | 2 +- src/lua_playerlib.c | 2 - src/p_enemy.c | 3 - src/p_saveg.c | 2 - src/p_tick.c | 9 --- 13 files changed, 50 insertions(+), 195 deletions(-) diff --git a/src/command.c b/src/command.c index 97c76ffc1..a8b34cbc0 100644 --- a/src/command.c +++ b/src/command.c @@ -1621,7 +1621,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum) // not from server or remote admin, must be hacked/buggy client CONS_Alert(CONS_WARNING, M_GetText("Illegal netvar command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7e87cdfc9..a6e43e4a5 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -93,7 +93,6 @@ UINT8 playerconsole[MAXPLAYERS]; // Server specific vars UINT8 playernode[MAXPLAYERS]; -char playeraddress[MAXPLAYERS][64]; // Minimum timeout for sending the savegame // The actual timeout will be longer depending on the savegame length @@ -409,7 +408,7 @@ static void ExtraDataTicker(void) { if (server) { - SendKick(i, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(i, KICK_MSG_CON_FAIL); DEBFILE(va("player %d kicked [gametic=%u] reason as follows:\n", i, gametic)); } CONS_Alert(CONS_WARNING, M_GetText("Got unknown net command [%s]=%d (max %d)\n"), sizeu1(curpos - bufferstart), *curpos, bufferstart[0]); @@ -460,9 +459,6 @@ void SendKick(UINT8 playernum, UINT8 msg) { UINT8 buf[2]; - if (!(server && cv_rejointimeout.value)) - msg &= ~KICK_MSG_KEEP_BODY; - buf[0] = playernum; buf[1] = msg; SendNetXCmd(XD_KICK, &buf, 2); @@ -807,37 +803,6 @@ static boolean CL_SendJoin(void) return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak)); } -static INT32 FindRejoinerNum(SINT8 node) -{ - char strippednodeaddress[64]; - const char *nodeaddress; - char *port; - INT32 i; - - // Make sure there is no dead dress before proceeding to the stripping - if (!I_GetNodeAddress) - return -1; - nodeaddress = I_GetNodeAddress(node); - if (!nodeaddress) - return -1; - - // Strip the address of its port - strcpy(strippednodeaddress, nodeaddress); - port = strchr(strippednodeaddress, ':'); - if (port) - *port = '\0'; - - // Check if any player matches the stripped address - for (i = 0; i < MAXPLAYERS; i++) - { - if (playeringame[i] && playeraddress[i][0] && playernode[i] == UINT8_MAX - && !strcmp(playeraddress[i], strippednodeaddress)) - return i; - } - - return -1; -} - static void CopyCaretColors (char *p, const char *s, int n) { @@ -922,7 +887,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers(); netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value)); - if (!node || FindRejoinerNum(node) != -1) + if (!node) netbuffer->u.serverinfo.refusereason = 0; else if (!cv_allownewplayer.value) netbuffer->u.serverinfo.refusereason = 1; @@ -1313,11 +1278,6 @@ static void CL_LoadReceivedSavegame(boolean reloading) else { CONS_Alert(CONS_ERROR, M_GetText("Can't load the level!\n")); - Z_Free(savebuffer); - save_p = NULL; - if (unlink(tmpsave) == -1) - CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave); - return; } // done @@ -2356,7 +2316,6 @@ void CL_ClearPlayer(INT32 playernum) splitscreen_original_party_size[playernum] = 0; memset(&players[playernum], 0, sizeof (player_t)); - memset(playeraddress[playernum], 0, sizeof(*playeraddress)); } // @@ -2732,12 +2691,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) char buf[3 + MAX_REASONLENGTH]; char *reason = buf; kickreason_t kickreason = KR_KICK; - boolean keepbody; pnum = READUINT8(*p); msg = READUINT8(*p); - keepbody = (msg & KICK_MSG_KEEP_BODY) != 0; - msg &= ~KICK_MSG_KEEP_BODY; if (pnum == serverplayer && IsPlayerAdmin(playernum)) { @@ -2791,7 +2747,6 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) */ pnum = playernum; msg = KICK_MSG_CON_FAIL; - keepbody = true; } //CONS_Printf("\x82%s ", player_names[pnum]); @@ -2816,8 +2771,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) switch (msg) { case KICK_MSG_GO_AWAY: - if (!players[pnum].quittime) - HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false); + HU_AddChatText(va("\x82*%s has been kicked (Go away)", player_names[pnum]), false); kickreason = KR_KICK; break; case KICK_MSG_PING_HIGH: @@ -2866,7 +2820,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) kickreason = KR_TIMEOUT; break; case KICK_MSG_PLAYER_QUIT: - if (netgame && !players[pnum].quittime) // not splitscreen/bots or soulless body + if (netgame) // not splitscreen/bots HU_AddChatText(va("\x82*%s left the game", player_names[pnum]), false); kickreason = KR_LEAVE; break; @@ -2923,24 +2877,6 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) else M_StartMessage(M_GetText("You have been kicked by the server\n\nPress ESC\n"), NULL, MM_NOTHING); } - else if (keepbody) - { - if (server && !demo.playback && playernode[pnum] != UINT8_MAX) - { - INT32 node = playernode[pnum]; - playerpernode[node]--; - if (playerpernode[node] <= 0) - { - nodeingame[node] = false; - Net_CloseConnection(node); - ResetNode(node); - } - } - - playernode[pnum] = UINT8_MAX; - - players[pnum].quittime = 1; - } else if (server) { // Sal: Because kicks (and a lot of other commands) are player-based, we can't tell which player pnum is on the node from a glance. @@ -3086,8 +3022,6 @@ consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_SAVE|CV_CALL, maxplay static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}}; consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL); -static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}}; -consvar_t cv_rejointimeout = CVAR_INIT ("rejointimeout", "Off", CV_SAVE|CV_NETVAR|CV_FLOAT, rejointimeout_cons_t, NULL); // Here for dedicated servers static CV_PossibleValue_t discordinvites_cons_t[] = {{0, "Admins Only"}, {1, "Everyone"}, {0, NULL}}; @@ -3221,7 +3155,6 @@ void SV_ResetServer(void) LUA_InvalidatePlayer(&players[i]); playeringame[i] = false; playernode[i] = UINT8_MAX; - memset(playeraddress[i], 0, sizeof(*playeraddress)); sprintf(player_names[i], "Player %c", 'A' + i); adminplayers[i] = -1; // Populate the entire adminplayers array with -1. K_ClearClientPowerLevels(); @@ -3342,7 +3275,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) UINT8 console; UINT8 splitscreenplayer = 0; UINT8 i; - boolean rejoined; player_t *newplayer; if (playernum != serverplayer && !IsPlayerAdmin(playernum)) @@ -3350,7 +3282,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) // protect against hacked/buggy client CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -3359,9 +3291,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) CONS_Debug(DBG_NETPLAY, "addplayer: %d %d\n", node, newplayernum); - rejoined = playeringame[newplayernum]; - - if (!rejoined) { // Clear player before joining, lest some things get set incorrectly CL_ClearPlayer(newplayernum); @@ -3371,25 +3300,11 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (newplayernum+1 > doomcom->numslots) doomcom->numslots = (INT16)(newplayernum+1); - - if (server && I_GetNodeAddress) - { - const char *address = I_GetNodeAddress(node); - char *port = NULL; - if (address) // MI: fix msvcrt.dll!_mbscat crash? - { - strcpy(playeraddress[newplayernum], address); - port = strchr(playeraddress[newplayernum], ':'); - if (port) - *port = '\0'; - } - } } newplayer = &players[newplayernum]; newplayer->jointime = 0; - newplayer->quittime = 0; READSTRINGN(*p, player_names[newplayernum], MAXPLAYERNAME); @@ -3423,27 +3338,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) D_SendPlayerConfig(splitscreenplayer); addedtogame = true; - - if (rejoined) - { - if (newplayer->mo) - { - newplayer->viewheight = P_GetPlayerViewHeight(newplayer); - - if (newplayer->mo->eflags & MFE_VERTICALFLIP) - newplayer->viewz = newplayer->mo->z + newplayer->mo->height - newplayer->viewheight; - else - newplayer->viewz = newplayer->mo->z + newplayer->viewheight; - } - - // wake up the status bar - ST_Start(); - // wake up the heads up text - HU_Start(); - - if (camera[splitscreenplayer].chase) - P_ResetCamera(newplayer, &camera[splitscreenplayer]); - } } players[newplayernum].splitscreenindex = splitscreenplayer; @@ -3459,10 +3353,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) { char joinmsg[256]; - if (rejoined) - strcpy(joinmsg, M_GetText("\x82*%s has rejoined the game (player %d)")); - else - strcpy(joinmsg, M_GetText("\x82*%s has joined the game (player %d)")); + strcpy(joinmsg, M_GetText("\x82*%s has joined the game (player %d)")); strcpy(joinmsg, va(joinmsg, player_names[newplayernum], newplayernum)); if (node != mynode) @@ -3482,8 +3373,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (server && multiplayer && motd[0] != '\0') COM_BufAddText(va("sayto %d %s\n", newplayernum, motd)); - if (!rejoined) - LUAh_PlayerJoin(newplayernum); + LUAh_PlayerJoin(newplayernum); #ifdef HAVE_DISCORDRPC DRPC_UpdatePresence(); @@ -3501,7 +3391,7 @@ static void Got_RemovePlayer(UINT8 **p, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal remove player command received from %s\n"), player_names[playernum]); if (server) { - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } return; } @@ -3530,7 +3420,7 @@ static void Got_AddBot(UINT8 **p, INT32 playernum) CONS_Alert(CONS_WARNING, M_GetText("Illegal add player command received from %s\n"), player_names[playernum]); if (server) { - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } return; } @@ -3580,13 +3470,11 @@ static boolean SV_AddWaitingPlayers(SINT8 node, const char *name, const char *na { newplayer = true; - newplayernum = FindRejoinerNum(node); - if (newplayernum == -1) { UINT8 nobotoverwrite; // search for a free playernum - // we can't use playeringame since it is not updated here + // we can't solely use playeringame since it is not updated here for (newplayernum = dedicated ? 1 : 0; newplayernum < MAXPLAYERS; newplayernum++) { if (playeringame[newplayernum]) @@ -3809,7 +3697,6 @@ static size_t TotalTextCmdPerTic(tic_t tic) static void HandleConnect(SINT8 node) { char names[MAXSPLITSCREENPLAYERS][MAXPLAYERNAME + 1]; - INT32 rejoinernum; INT32 i; // Sal: Dedicated mode is INCREDIBLY hacked together. @@ -3817,8 +3704,6 @@ static void HandleConnect(SINT8 node) // It's too much effort to legimately fix right now. Just prevent it from reaching that state. UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value); - rejoinernum = FindRejoinerNum(node); - if (bannednode && bannednode[node]) SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server.")); else if (netbuffer->u.clientcfg._255 != 255 || @@ -3830,9 +3715,9 @@ static void HandleConnect(SINT8 node) else if (netbuffer->u.clientcfg.version != VERSION || netbuffer->u.clientcfg.subversion != SUBVERSION) SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d)"), VERSION, SUBVERSION)); - else if (!cv_allownewplayer.value && node && rejoinernum == -1) + else if (!cv_allownewplayer.value && node) SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment.")); - else if (D_NumPlayers() >= maxplayers && rejoinernum == -1) + else if (D_NumPlayers() >= maxplayers) SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), maxplayers)); else if (netgame && netbuffer->u.clientcfg.localplayers > MAXSPLITSCREENPLAYERS) // Hacked client? SV_SendRefuse(node, M_GetText("Too many players from\nthis node.")); @@ -3854,7 +3739,7 @@ static void HandleConnect(SINT8 node) for (i = 0; i < netbuffer->u.clientcfg.localplayers - playerpernode[node]; i++) { strlcpy(names[i], netbuffer->u.clientcfg.names[i], MAXPLAYERNAME + 1); - if (!EnsurePlayerNameIsGood(names[i], rejoinernum)) + if (!EnsurePlayerNameIsGood(names[i], -1)) { SV_SendRefuse(node, "Bad player name"); return; @@ -4413,7 +4298,7 @@ static void HandlePacketFromPlayer(SINT8 node) } else { - SendKick(netconsole, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(netconsole, KICK_MSG_CON_FAIL); DEBFILE(va("player %d kicked (synch failure) [%u] %d!=%d\n", netconsole, realstart, consistancy[realstart%TICQUEUE], SHORT(netbuffer->u.clientpak.consistancy))); @@ -4552,7 +4437,6 @@ static void HandlePacketFromPlayer(SINT8 node) kickmsg = KICK_MSG_TIMEOUT; else kickmsg = KICK_MSG_PLAYER_QUIT; - kickmsg |= KICK_MSG_KEEP_BODY; SendKick(netconsole, kickmsg); @@ -4607,7 +4491,7 @@ static void HandlePacketFromPlayer(SINT8 node) { CONS_Alert(CONS_WARNING, M_GetText("%s received from non-host %d\n"), "PT_SERVERTICS", node); if (server) - SendKick(netconsole, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(netconsole, KICK_MSG_CON_FAIL); break; } @@ -4667,7 +4551,7 @@ static void HandlePacketFromPlayer(SINT8 node) { CONS_Alert(CONS_WARNING, M_GetText("%s received from non-host %d\n"), "PT_PING", node); if (server) - SendKick(netconsole, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(netconsole, KICK_MSG_CON_FAIL); break; } @@ -4691,7 +4575,7 @@ static void HandlePacketFromPlayer(SINT8 node) { CONS_Alert(CONS_WARNING, M_GetText("%s received from non-host %d\n"), "PT_FILEFRAGMENT", node); if (server) - SendKick(netconsole, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(netconsole, KICK_MSG_CON_FAIL); break; } if (client) @@ -5220,13 +5104,6 @@ static void SV_Maketic(void) ticcmd_t * ticcmd = &netcmds[(maketic ) % TICQUEUE][i]; ticcmd_t *prevticcmd = &netcmds[(maketic - 1) % TICQUEUE][i]; - if (players[i].quittime) - { - // empty inputs but consider recieved - memset(ticcmd, 0, sizeof(netcmds[0][0])); - ticcmd->flags |= TICCMD_RECEIVED; - } - else { DEBFILE(va("MISS tic%4d for player %d\n", maketic, i)); // Copy the input from the previous tic @@ -5365,7 +5242,7 @@ static inline void PingUpdate(void) { for (i = 1; i < MAXPLAYERS; i++) { - if (playeringame[i] && !players[i].quittime + if (playeringame[i] && (realpingtable[i] / pingmeasurecount > (unsigned)cv_maxping.value)) { if (players[i].jointime > 30 * TICRATE) @@ -5390,7 +5267,7 @@ static inline void PingUpdate(void) if (pingtimeout[i] > cv_pingtimeout.value) { pingtimeout[i] = 0; - SendKick(i, KICK_MSG_PING_HIGH | KICK_MSG_KEEP_BODY); + SendKick(i, KICK_MSG_PING_HIGH); } } /* diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 7cd8acce5..471dd50d2 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -409,7 +409,6 @@ extern consvar_t cv_playbackspeed; #define KICK_MSG_PING_HIGH 6 #define KICK_MSG_CUSTOM_KICK 7 #define KICK_MSG_CUSTOM_BAN 8 -#define KICK_MSG_KEEP_BODY 0x80 typedef enum { @@ -445,7 +444,7 @@ extern tic_t servermaxping; extern boolean server_lagless; -extern consvar_t cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_joindelay, cv_rejointimeout; +extern consvar_t cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_joindelay; extern consvar_t cv_resynchattempts, cv_blamecfail; extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 1f4991f19..d1b399373 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -717,7 +717,6 @@ void D_RegisterServerCommands(void) // d_clisrv CV_RegisterVar(&cv_maxplayers); CV_RegisterVar(&cv_joindelay); - CV_RegisterVar(&cv_rejointimeout); CV_RegisterVar(&cv_resynchattempts); CV_RegisterVar(&cv_maxsend); CV_RegisterVar(&cv_noticedownload); @@ -1280,7 +1279,7 @@ static void SetPlayerName(INT32 playernum, char *newname) { CONS_Printf(M_GetText("Player %d sent a bad name change\n"), playernum+1); if (server && netgame) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } } @@ -1609,7 +1608,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) if (kick) { CONS_Alert(CONS_WARNING, M_GetText("Illegal color change received from %s (team: %d), color: %d)\n"), player_names[playernum], p->ctfteam, p->skincolor); - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } } @@ -1714,7 +1713,7 @@ static void Got_PartyInvite(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal splitscreen invitation received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -1745,7 +1744,7 @@ static void Got_AcceptPartyInvite(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -1809,7 +1808,7 @@ static void Got_CancelPartyInvite(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal cancel splitscreen invite received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } } @@ -1821,7 +1820,7 @@ static void Got_LeaveParty(UINT8 **cp,INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal accept splitscreen invite received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -2838,7 +2837,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal map change received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -2951,7 +2950,7 @@ static void Got_Pause(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal pause command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -3028,7 +3027,7 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal respawn command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -3098,7 +3097,7 @@ static void Got_Clearscores(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal clear scores command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -3334,7 +3333,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // this should never happen unless the client is hacked/buggy CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } if (NetPacket.packet.verification) // Special marker that the server sent the request @@ -3343,7 +3342,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } playernum = NetPacket.packet.playernum; @@ -3368,7 +3367,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } return; } @@ -3392,7 +3391,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) if (server && ((NetPacket.packet.newteam < 0 || NetPacket.packet.newteam > 3) || error)) { CONS_Alert(CONS_WARNING, M_GetText("Illegal team change received from player %s\n"), player_names[playernum]); - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } //Safety first! @@ -3679,7 +3678,7 @@ static void Got_Verification(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal verification received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -3729,7 +3728,7 @@ static void Got_Removal(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal demotion received from %s (serverplayer is %s)\n"), player_names[playernum], player_names[serverplayer]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -3803,7 +3802,7 @@ static void Got_MotD_f(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal motd change received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); Z_Free(mymotd); return; } @@ -3859,7 +3858,7 @@ static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal runsoc command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -4053,7 +4052,7 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum) if ((playernum != serverplayer && !IsPlayerAdmin(playernum)) || kick) { CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]); - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -4101,7 +4100,7 @@ static void Got_Addfilecmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal addfile command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -4839,7 +4838,7 @@ static void Got_ExitLevelcmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal exitlevel command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -4855,7 +4854,7 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -4894,7 +4893,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal vote setup received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -4918,7 +4917,7 @@ static void Got_GiveItemcmd(UINT8 **cp, INT32 playernum) M_GetText ("Illegal give item received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -5824,7 +5823,7 @@ void Got_DiscordInfo(UINT8 **p, INT32 playernum) // protect against hacked/buggy client CONS_Alert(CONS_WARNING, M_GetText("Illegal Discord info command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } diff --git a/src/d_player.h b/src/d_player.h index 5aba0dd0b..5c2326365 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -547,7 +547,6 @@ typedef struct player_s UINT8 splitscreenindex; tic_t jointime; // Timer when player joins game to change skin/color - tic_t quittime; // Time elapsed since user disconnected, zero if connected UINT8 typing_timer; // Counts down while keystrokes are not emitted UINT8 typing_duration; // How long since resumed timer diff --git a/src/g_game.c b/src/g_game.c index cf6563022..48b0b6890 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2105,7 +2105,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) UINT32 availabilities; tic_t jointime; - tic_t quittime; UINT8 splitscreenindex; boolean spectator; @@ -2140,7 +2139,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) ctfteam = players[player].ctfteam; jointime = players[player].jointime; - quittime = players[player].quittime; splitscreenindex = players[player].splitscreenindex; spectator = players[player].spectator; @@ -2256,7 +2254,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->pflags = pflags; p->ctfteam = ctfteam; p->jointime = jointime; - p->quittime = quittime; p->splitscreenindex = splitscreenindex; p->spectator = spectator; p->steering = steering; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 525e19b57..61d331fe3 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -641,7 +641,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) M_GetText("Illegal say command received from %s while muted\n") : M_GetText("Illegal csay command received from non-admin %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } @@ -655,7 +655,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) { CONS_Alert(CONS_WARNING, M_GetText("Illegal say command received from %s containing invalid characters\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); return; } } diff --git a/src/k_bot.c b/src/k_bot.c index 44f9c27c2..0c0870716 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -260,7 +260,7 @@ void K_UpdateMatchRaceBots(void) --------------------------------------------------*/ boolean K_PlayerUsesBotMovement(player_t *player) { - if (player->bot || player->exiting || player->quittime) + if (player->bot || player->exiting) return true; return false; diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 743179bf8..b06018efe 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -90,7 +90,7 @@ deny: CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]); if (server) - SendKick(playernum, KICK_MSG_CON_FAIL | KICK_MSG_KEEP_BODY); + SendKick(playernum, KICK_MSG_CON_FAIL); } // Wrapper for COM_AddCommand commands diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 17e1a39b1..f9483aa83 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -461,8 +461,6 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->jointime); else if (fastcmp(field,"splitscreenindex")) lua_pushinteger(L, plr->splitscreenindex); - else if (fastcmp(field,"quittime")) - lua_pushinteger(L, plr->quittime); #ifdef HWRENDER else if (fastcmp(field,"fovadd")) lua_pushfixed(L, plr->fovadd); diff --git a/src/p_enemy.c b/src/p_enemy.c index 04e77bd8f..afe8530c2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -747,9 +747,6 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed if (player->bot) continue; // ignore bots - if (player->quittime) - continue; // Ignore uncontrolled bodies - if (dist > 0 && P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) continue; // Too far away diff --git a/src/p_saveg.c b/src/p_saveg.c index 0a5da687f..6e1e5c5e3 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -192,7 +192,6 @@ static void P_NetArchivePlayers(void) WRITEINT32(save_p, players[i].onconveyor); WRITEUINT32(save_p, players[i].jointime); - WRITEUINT32(save_p, players[i].quittime); WRITEUINT8(save_p, players[i].splitscreenindex); @@ -455,7 +454,6 @@ static void P_NetUnArchivePlayers(void) players[i].onconveyor = READINT32(save_p); players[i].jointime = READUINT32(save_p); - players[i].quittime = READUINT32(save_p); players[i].splitscreenindex = READUINT8(save_p); diff --git a/src/p_tick.c b/src/p_tick.c index 22a090fba..613748db6 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -502,15 +502,6 @@ void P_Ticker(boolean run) if (playeringame[i]) { players[i].jointime++; - - if (players[i].quittime) - { - players[i].quittime++; - - if (server && players[i].quittime >= (tic_t)FixedMul(cv_rejointimeout.value, 60 * TICRATE) - && !(players[i].quittime % TICRATE)) - SendKick(i, KICK_MSG_PLAYER_QUIT); - } } if (objectplacing) From c84a739039c58a39d49d8a21a8a27e61740d7587 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 14 Mar 2022 16:59:18 +0000 Subject: [PATCH 4/6] Fix not being able to escape out of the server connection screen. --- src/d_clisrv.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a6e43e4a5..427c226d2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1889,13 +1889,16 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic if (*oldtic != I_GetTime()) { I_OsPolling(); -#if 0 - for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1)) - G_MapEventsToControls(&events[eventtail]); -#endif if (cl_mode == CL_CONFIRMCONNECT) + { D_ProcessEvents(); //needed for menu system to receive inputs + } + else + { + for (; eventtail != eventhead; eventtail = (eventtail+1) & (MAXEVENTS-1)) + G_MapEventsToControls(&events[eventtail]); + } if ((gamekeydown[KEY_ESCAPE] || gamekeydown[KEY_JOY1+1]) || cl_mode == CL_ABORTED) { From 6e7adedaa0378678f2303e0357e98f948d67209b Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 14 Mar 2022 19:07:20 +0000 Subject: [PATCH 5/6] Make the Kart TICQUEUE system closer to the 2.2 BACKUPTICS system. * Rename TICQUEUE to BACKUPTICS. * Add CLIENTBACKUPTICS to limit the time gap players can send tics in at once * This likely means freezes are more possible, and this variable could be raised later, but prevents some potential duplication in the extrapolerated tic. --- src/d_clisrv.c | 70 +++++++++++++++++++++++++------------------------- src/d_clisrv.h | 3 ++- src/doomstat.h | 2 +- src/g_game.c | 2 +- src/p_setup.c | 2 +- 5 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 427c226d2..511d31031 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -128,7 +128,7 @@ static tic_t firstticstosend; // min of the nettics static tic_t tictoclear = 0; // optimize d_clearticcmd static tic_t maketic; -static INT16 consistancy[TICQUEUE]; +static INT16 consistancy[BACKUPTICS]; static UINT8 player_joining = false; UINT8 hu_redownloadinggamestate = 0; @@ -176,7 +176,7 @@ typedef struct textcmdtic_s struct textcmdtic_s *next; } textcmdtic_t; -ticcmd_t netcmds[TICQUEUE][MAXPLAYERS]; +ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS]; static textcmdtic_t *textcmds[TEXTCMD_HASH_SIZE] = {NULL}; @@ -432,9 +432,9 @@ static void D_Clearticcmd(tic_t tic) D_FreeTextcmd(tic); for (i = 0; i < MAXPLAYERS; i++) - netcmds[tic%TICQUEUE][i].flags = 0; + netcmds[tic%BACKUPTICS][i].flags = 0; - DEBFILE(va("clear tic %5u (%2u)\n", tic, tic%TICQUEUE)); + DEBFILE(va("clear tic %5u (%2u)\n", tic, tic%BACKUPTICS)); } void D_ResetTiccmds(void) @@ -1285,7 +1285,7 @@ static void CL_LoadReceivedSavegame(boolean reloading) save_p = NULL; if (unlink(tmpsave) == -1) CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave); - consistancy[gametic%TICQUEUE] = Consistancy(); + consistancy[gametic%BACKUPTICS] = Consistancy(); CON_ToggleOff(); // Tell the server we have received and reloaded the gamestate @@ -3634,7 +3634,7 @@ void SV_StopServer(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) localtextcmd[i][0] = 0; - for (i = firstticstosend; i < firstticstosend + TICQUEUE; i++) + for (i = firstticstosend; i < firstticstosend + BACKUPTICS; i++) D_Clearticcmd(i); consoleplayer = 0; @@ -4140,8 +4140,8 @@ static void HandlePacketFromAwayNode(SINT8 node) */ static boolean CheckForSpeedHacks(UINT8 p) { - if (netcmds[maketic%TICQUEUE][p].forwardmove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].forwardmove < -MAXPLMOVE - || netcmds[maketic%TICQUEUE][p].turning > KART_FULLTURN || netcmds[maketic%TICQUEUE][p].turning < -KART_FULLTURN) + if (netcmds[maketic%BACKUPTICS][p].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][p].forwardmove < -MAXPLMOVE + || netcmds[maketic%BACKUPTICS][p].turning > KART_FULLTURN || netcmds[maketic%BACKUPTICS][p].turning < -KART_FULLTURN) { CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), playernode[p]); //D_Clearticcmd(k); @@ -4235,7 +4235,7 @@ static void HandlePacketFromPlayer(SINT8 node) break; // Copy ticcmd - G_MoveTiccmd(&netcmds[maketic%TICQUEUE][netconsole], &netbuffer->u.clientpak.cmd, 1); + G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1); // Check ticcmd for "speed hacks" if (CheckForSpeedHacks((UINT8)netconsole)) @@ -4247,7 +4247,7 @@ static void HandlePacketFromPlayer(SINT8 node) || (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)) && (nodetoplayer2[node] >= 0)) { - G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer2[node]], + G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]], &netbuffer->u.client2pak.cmd2, 1); if (CheckForSpeedHacks((UINT8)nodetoplayer2[node])) @@ -4258,7 +4258,7 @@ static void HandlePacketFromPlayer(SINT8 node) || (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)) && (nodetoplayer3[node] >= 0)) { - G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer3[node]], + G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]], &netbuffer->u.client3pak.cmd3, 1); if (CheckForSpeedHacks((UINT8)nodetoplayer3[node])) @@ -4268,7 +4268,7 @@ static void HandlePacketFromPlayer(SINT8 node) if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS) && (nodetoplayer4[node] >= 0)) { - G_MoveTiccmd(&netcmds[maketic%TICQUEUE][(UINT8)nodetoplayer4[node]], + G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]], &netbuffer->u.client4pak.cmd4, 1); if (CheckForSpeedHacks((UINT8)nodetoplayer4[node])) @@ -4276,8 +4276,8 @@ static void HandlePacketFromPlayer(SINT8 node) } // Check player consistancy during the level - if (realstart <= gametic && realstart + TICQUEUE - 1 > gametic && gamestate == GS_LEVEL - && consistancy[realstart%TICQUEUE] != SHORT(netbuffer->u.clientpak.consistancy) + if (realstart <= gametic && realstart + BACKUPTICS - 1 > gametic && gamestate == GS_LEVEL + && consistancy[realstart%BACKUPTICS] != SHORT(netbuffer->u.clientpak.consistancy) && !resendingsavegame[node] && savegameresendcooldown[node] <= I_GetTime() && !SV_ResendingSavegameToAnyone()) { @@ -4292,10 +4292,10 @@ static void HandlePacketFromPlayer(SINT8 node) if (cv_blamecfail.value) CONS_Printf(M_GetText("Synch failure for player %d (%s); expected %hd, got %hd\n"), netconsole+1, player_names[netconsole], - consistancy[realstart%TICQUEUE], + consistancy[realstart%BACKUPTICS], SHORT(netbuffer->u.clientpak.consistancy)); DEBFILE(va("Restoring player %d (synch failure) [%update] %d!=%d\n", - netconsole, realstart, consistancy[realstart%TICQUEUE], + netconsole, realstart, consistancy[realstart%BACKUPTICS], SHORT(netbuffer->u.clientpak.consistancy))); break; } @@ -4303,7 +4303,7 @@ static void HandlePacketFromPlayer(SINT8 node) { SendKick(netconsole, KICK_MSG_CON_FAIL); DEBFILE(va("player %d kicked (synch failure) [%u] %d!=%d\n", - netconsole, realstart, consistancy[realstart%TICQUEUE], + netconsole, realstart, consistancy[realstart%BACKUPTICS], SHORT(netbuffer->u.clientpak.consistancy))); break; } @@ -4376,10 +4376,10 @@ static void HandlePacketFromPlayer(SINT8 node) // search a tic that have enougth space in the ticcmd while ((textcmd = D_GetExistingTextcmd(tic, netconsole)), (TotalTextCmdPerTic(tic) > j || netbuffer->u.textcmd[0] + (textcmd ? textcmd[0] : 0) > MAXTEXTCMD) - && tic < firstticstosend + TICQUEUE) + && tic < firstticstosend + BACKUPTICS) tic++; - if (tic >= firstticstosend + TICQUEUE) + if (tic >= firstticstosend + BACKUPTICS) { DEBFILE(va("GetPacket: Textcmd too long (max %s, used %s, mak %d, " "tosend %u, node %u, player %d)\n", sizeu1(j), sizeu2(TotalTextCmdPerTic(maketic)), @@ -4505,8 +4505,8 @@ static void HandlePacketFromPlayer(SINT8 node) txtpak = (UINT8 *)&netbuffer->u.serverpak.cmds[netbuffer->u.serverpak.numslots * netbuffer->u.serverpak.numtics]; - if (realend > gametic + TICQUEUE) - realend = gametic + TICQUEUE; + if (realend > gametic + CLIENTBACKUPTICS) + realend = gametic + CLIENTBACKUPTICS; cl_packetmissed = realstart > neededtic; if (realstart <= neededtic && realend > neededtic) @@ -4520,7 +4520,7 @@ static void HandlePacketFromPlayer(SINT8 node) D_Clearticcmd(i); // copy the tics - pak = G_ScpyTiccmd(netcmds[i%TICQUEUE], pak, + pak = G_ScpyTiccmd(netcmds[i%BACKUPTICS], pak, netbuffer->u.serverpak.numslots*sizeof (ticcmd_t)); // copy the textcmds @@ -4873,7 +4873,7 @@ static void CL_SendClientCmd(void) packetsize = sizeof (clientcmd_pak); G_MoveTiccmd(&netbuffer->u.clientpak.cmd, &localcmds[0][lagDelay], 1); - netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic % TICQUEUE]); + netbuffer->u.clientpak.consistancy = SHORT(consistancy[gametic % BACKUPTICS]); if (splitscreen) // Send a special packet with 2 cmd for splitscreen { @@ -4951,10 +4951,10 @@ static void SV_SendTics(void) { // assert supposedtics[n]>=nettics[n] realfirsttic = supposedtics[n]; - lasttictosend = maketic; - if (lasttictosend - nettics[n] >= TICQUEUE) - lasttictosend = nettics[n] + TICQUEUE-1; + lasttictosend = nettics[n] + CLIENTBACKUPTICS; + if (lasttictosend > maketic) + lasttictosend = maketic; if (realfirsttic >= lasttictosend) { @@ -5015,7 +5015,7 @@ static void SV_SendTics(void) for (i = realfirsttic; i < lasttictosend; i++) { - bufpos = G_DcpyTiccmd(bufpos, netcmds[i%TICQUEUE], doomcom->numslots * sizeof (ticcmd_t)); + bufpos = G_DcpyTiccmd(bufpos, netcmds[i%BACKUPTICS], doomcom->numslots * sizeof (ticcmd_t)); } // add textcmds @@ -5097,15 +5097,15 @@ static void SV_Maketic(void) if (K_PlayerUsesBotMovement(&players[i])) { - K_BuildBotTiccmd(&players[i], &netcmds[maketic%TICQUEUE][i]); + K_BuildBotTiccmd(&players[i], &netcmds[maketic%BACKUPTICS][i]); continue; } // We didn't receive this tic - if ((netcmds[maketic % TICQUEUE][i].flags & TICCMD_RECEIVED) == 0) + if ((netcmds[maketic % BACKUPTICS][i].flags & TICCMD_RECEIVED) == 0) { - ticcmd_t * ticcmd = &netcmds[(maketic ) % TICQUEUE][i]; - ticcmd_t *prevticcmd = &netcmds[(maketic - 1) % TICQUEUE][i]; + ticcmd_t * ticcmd = &netcmds[(maketic ) % BACKUPTICS][i]; + ticcmd_t *prevticcmd = &netcmds[(maketic - 1) % BACKUPTICS][i]; { DEBFILE(va("MISS tic%4d for player %d\n", maketic, i)); @@ -5204,7 +5204,7 @@ boolean TryRunTics(tic_t realtics) G_Ticker((gametic % NEWTICRATERATIO) == 0); ExtraDataTicker(); gametic++; - consistancy[gametic%TICQUEUE] = Consistancy(); + consistancy[gametic%BACKUPTICS] = Consistancy(); ps_tictime = I_GetPreciseTime() - ps_tictime; @@ -5521,15 +5521,15 @@ void NetUpdate(void) { firstticstosend = nettics[i]; - if (maketic + 1 >= nettics[i] + TICQUEUE) + if (maketic + 1 >= nettics[i] + BACKUPTICS) Net_ConnectionTimeout(i); } // Don't erase tics not acknowledged counts = realtics; - if (maketic + counts >= firstticstosend + TICQUEUE) - counts = firstticstosend+TICQUEUE-maketic-1; + if (maketic + counts >= firstticstosend + BACKUPTICS) + counts = firstticstosend+BACKUPTICS-maketic-1; for (i = 0; i < counts; i++) SV_Maketic(); // Create missed tics and increment maketic diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 471dd50d2..2868b541d 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -37,7 +37,8 @@ applications may follow different packet versions. // be transmitted. // Networking and tick handling related. -#define TICQUEUE 512 // more than enough for most timeouts.... +#define BACKUPTICS 512 // more than enough for most timeouts.... +#define CLIENTBACKUPTICS 32 #define MAXTEXTCMD 256 // No. of tics your controls can be delayed by. diff --git a/src/doomstat.h b/src/doomstat.h index 19359df3b..1d49410ec 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -774,7 +774,7 @@ extern consvar_t cv_downloading; // allow clients to downloading WADs. extern consvar_t cv_nettimeout; // SRB2Kart: Advanced server options menu extern consvar_t cv_jointimeout; extern consvar_t cv_maxping; -extern ticcmd_t netcmds[TICQUEUE][MAXPLAYERS]; +extern ticcmd_t netcmds[BACKUPTICS][MAXPLAYERS]; extern INT32 serverplayer; extern INT32 adminplayers[MAXPLAYERS]; diff --git a/src/g_game.c b/src/g_game.c index 48b0b6890..4e47f7878 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1889,7 +1889,7 @@ void G_Ticker(boolean run) default: I_Error("gameaction = %d\n", gameaction); } - buf = gametic % TICQUEUE; + buf = gametic % BACKUPTICS; if (!demo.playback) { diff --git a/src/p_setup.c b/src/p_setup.c index f5a03e628..72384eb48 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4282,7 +4282,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) if (!fromnetsave) // uglier hack { // to make a newly loaded level start on the second frame. - INT32 buf = gametic % TICQUEUE; + INT32 buf = gametic % BACKUPTICS; for (i = 0; i < MAXPLAYERS; i++) { if (playeringame[i]) From 05c1d61ae1082454f0a44e92c343123f19e61c24 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 14 Mar 2022 20:13:32 +0000 Subject: [PATCH 6/6] Add pmomz and stairjank to net archive (plus re-organise slightly). --- src/p_saveg.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 6e1e5c5e3..5ab29248f 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -171,6 +171,15 @@ static void P_NetArchivePlayers(void) WRITEUINT8(save_p, players[i].checkskip); + WRITEINT16(save_p, players[i].lastsidehit); + WRITEINT16(save_p, players[i].lastlinehit); + + WRITEINT32(save_p, players[i].onconveyor); + + WRITEUINT32(save_p, players[i].jointime); + + WRITEUINT8(save_p, players[i].splitscreenindex); + if (players[i].awayviewmobj) flags |= AWAYVIEW; @@ -186,15 +195,6 @@ static void P_NetArchivePlayers(void) if (players[i].skybox.centerpoint) flags |= SKYBOXCENTER; - WRITEINT16(save_p, players[i].lastsidehit); - WRITEINT16(save_p, players[i].lastlinehit); - - WRITEINT32(save_p, players[i].onconveyor); - - WRITEUINT32(save_p, players[i].jointime); - - WRITEUINT8(save_p, players[i].splitscreenindex); - WRITEUINT16(save_p, flags); if (flags & SKYBOXVIEW) @@ -341,6 +341,8 @@ static void P_NetArchivePlayers(void) WRITEUINT8(save_p, players[i].kickstartaccel); + WRITEUINT8(save_p, players[i].stairjank); + // respawnvars_t WRITEUINT8(save_p, players[i].respawn.state); WRITEUINT32(save_p, K_GetWaypointHeapIndex(players[i].respawn.wp)); @@ -405,7 +407,7 @@ static void P_NetUnArchivePlayers(void) players[i].steering = READINT16(save_p); players[i].angleturn = READANGLE(save_p); players[i].aiming = READANGLE(save_p); - players[i].drawangle = READANGLE(save_p); + players[i].drawangle = players[i].old_drawangle = READANGLE(save_p); players[i].viewrollangle = READANGLE(save_p); players[i].tilt = READANGLE(save_p); players[i].awayviewaiming = READANGLE(save_p); @@ -604,6 +606,8 @@ static void P_NetUnArchivePlayers(void) players[i].kickstartaccel = READUINT8(save_p); + players[i].stairjank = READUINT8(save_p); + // respawnvars_t players[i].respawn.state = READUINT8(save_p); players[i].respawn.wp = (waypoint_t *)(size_t)READUINT32(save_p); @@ -1677,7 +1681,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 = 0; // not the default but the most probable - if (mobj->momx != 0 || mobj->momy != 0 || mobj->momz != 0) + if (mobj->momx != 0 || mobj->momy != 0 || mobj->momz != 0 || mobj->pmomz != 0) diff |= MD_MOM; if (mobj->radius != mobj->info->radius) diff |= MD_RADIUS; @@ -1862,6 +1866,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, mobj->momx); WRITEFIXED(save_p, mobj->momy); WRITEFIXED(save_p, mobj->momz); + WRITEFIXED(save_p, mobj->pmomz); } if (diff & MD_RADIUS) WRITEFIXED(save_p, mobj->radius); @@ -2930,6 +2935,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->momx = READFIXED(save_p); mobj->momy = READFIXED(save_p); mobj->momz = READFIXED(save_p); + mobj->pmomz = READFIXED(save_p); } // otherwise they're zero, and the memset took care of it if (diff & MD_RADIUS)