mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'master' into boss
# Conflicts: # src/k_bot.c
This commit is contained in:
commit
8de92e8dca
16 changed files with 118 additions and 250 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
242
src/d_clisrv.c
242
src/d_clisrv.c
|
@ -94,7 +94,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
|
||||
|
@ -130,7 +129,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;
|
||||
|
@ -178,7 +177,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};
|
||||
|
||||
|
||||
|
@ -410,7 +409,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]);
|
||||
|
@ -434,9 +433,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)
|
||||
|
@ -461,9 +460,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);
|
||||
|
@ -808,37 +804,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)
|
||||
{
|
||||
|
@ -923,7 +888,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;
|
||||
|
@ -1314,11 +1279,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
|
||||
|
@ -1326,7 +1286,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
|
||||
|
@ -1930,13 +1890,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)
|
||||
{
|
||||
|
@ -2357,7 +2320,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));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2733,12 +2695,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))
|
||||
{
|
||||
|
@ -2792,7 +2751,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]);
|
||||
|
@ -2817,8 +2775,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:
|
||||
|
@ -2867,7 +2824,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;
|
||||
|
@ -2924,24 +2881,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.
|
||||
|
@ -3087,8 +3026,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}};
|
||||
|
@ -3222,7 +3159,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();
|
||||
|
@ -3343,7 +3279,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))
|
||||
|
@ -3351,7 +3286,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;
|
||||
}
|
||||
|
||||
|
@ -3360,9 +3295,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);
|
||||
|
@ -3372,25 +3304,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);
|
||||
|
||||
|
@ -3424,27 +3342,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;
|
||||
|
@ -3460,10 +3357,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)
|
||||
|
@ -3483,8 +3377,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();
|
||||
|
@ -3502,7 +3395,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;
|
||||
}
|
||||
|
@ -3531,7 +3424,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;
|
||||
}
|
||||
|
@ -3581,13 +3474,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])
|
||||
|
@ -3744,7 +3635,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;
|
||||
|
@ -3814,7 +3705,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.
|
||||
|
@ -3822,8 +3712,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 ||
|
||||
|
@ -3835,9 +3723,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."));
|
||||
|
@ -3859,7 +3747,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;
|
||||
|
@ -4257,8 +4145,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);
|
||||
|
@ -4352,7 +4240,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))
|
||||
|
@ -4364,7 +4252,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]))
|
||||
|
@ -4375,7 +4263,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]))
|
||||
|
@ -4385,7 +4273,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]))
|
||||
|
@ -4393,8 +4281,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())
|
||||
{
|
||||
|
@ -4409,18 +4297,18 @@ 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;
|
||||
}
|
||||
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],
|
||||
netconsole, realstart, consistancy[realstart%BACKUPTICS],
|
||||
SHORT(netbuffer->u.clientpak.consistancy)));
|
||||
break;
|
||||
}
|
||||
|
@ -4493,10 +4381,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)),
|
||||
|
@ -4557,7 +4445,6 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
kickmsg = KICK_MSG_TIMEOUT;
|
||||
else
|
||||
kickmsg = KICK_MSG_PLAYER_QUIT;
|
||||
kickmsg |= KICK_MSG_KEEP_BODY;
|
||||
|
||||
SendKick(netconsole, kickmsg);
|
||||
|
||||
|
@ -4612,7 +4499,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;
|
||||
}
|
||||
|
||||
|
@ -4623,8 +4510,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)
|
||||
|
@ -4638,7 +4525,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
|
||||
|
@ -4672,7 +4559,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;
|
||||
}
|
||||
|
||||
|
@ -4696,7 +4583,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)
|
||||
|
@ -4991,7 +4878,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
|
||||
{
|
||||
|
@ -5069,10 +4956,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)
|
||||
{
|
||||
|
@ -5133,7 +5020,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
|
||||
|
@ -5215,23 +5102,16 @@ 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];
|
||||
|
||||
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
|
||||
|
@ -5329,7 +5209,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;
|
||||
|
||||
|
@ -5370,7 +5250,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)
|
||||
|
@ -5395,7 +5275,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);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -5646,15 +5526,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
|
||||
|
|
|
@ -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.
|
||||
|
@ -409,7 +410,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 +445,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;
|
||||
|
||||
|
|
|
@ -718,7 +718,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);
|
||||
|
@ -1281,7 +1280,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1610,7 +1609,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;
|
||||
}
|
||||
}
|
||||
|
@ -1715,7 +1714,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;
|
||||
}
|
||||
|
||||
|
@ -1746,7 +1745,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;
|
||||
}
|
||||
|
||||
|
@ -1810,7 +1809,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1822,7 +1821,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;
|
||||
}
|
||||
|
||||
|
@ -2867,7 +2866,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;
|
||||
}
|
||||
|
||||
|
@ -2980,7 +2979,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;
|
||||
}
|
||||
|
||||
|
@ -3057,7 +3056,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;
|
||||
}
|
||||
|
||||
|
@ -3127,7 +3126,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;
|
||||
}
|
||||
|
||||
|
@ -3363,7 +3362,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
|
||||
|
@ -3372,7 +3371,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;
|
||||
|
@ -3397,7 +3396,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;
|
||||
}
|
||||
|
@ -3421,7 +3420,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!
|
||||
|
@ -3708,7 +3707,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;
|
||||
}
|
||||
|
||||
|
@ -3758,7 +3757,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;
|
||||
}
|
||||
|
||||
|
@ -3832,7 +3831,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;
|
||||
}
|
||||
|
@ -3888,7 +3887,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;
|
||||
}
|
||||
|
||||
|
@ -4082,7 +4081,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;
|
||||
}
|
||||
|
||||
|
@ -4130,7 +4129,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;
|
||||
}
|
||||
|
||||
|
@ -4870,7 +4869,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;
|
||||
}
|
||||
|
||||
|
@ -4886,7 +4885,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;
|
||||
}
|
||||
|
||||
|
@ -4925,7 +4924,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;
|
||||
}
|
||||
|
||||
|
@ -4949,7 +4948,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;
|
||||
}
|
||||
|
||||
|
@ -5855,7 +5854,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -548,7 +548,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
|
||||
|
|
|
@ -775,7 +775,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];
|
||||
|
||||
|
|
|
@ -1890,7 +1890,7 @@ void G_Ticker(boolean run)
|
|||
default: I_Error("gameaction = %d\n", gameaction);
|
||||
}
|
||||
|
||||
buf = gametic % TICQUEUE;
|
||||
buf = gametic % BACKUPTICS;
|
||||
|
||||
if (!demo.playback)
|
||||
{
|
||||
|
@ -2107,7 +2107,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
|
|||
UINT32 availabilities;
|
||||
|
||||
tic_t jointime;
|
||||
tic_t quittime;
|
||||
|
||||
UINT8 splitscreenindex;
|
||||
boolean spectator;
|
||||
|
@ -2142,7 +2141,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;
|
||||
|
@ -2266,7 +2264,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;
|
||||
|
|
|
@ -642,7 +642,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;
|
||||
}
|
||||
|
||||
|
@ -656,7 +656,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ void K_UpdateMatchRaceBots(void)
|
|||
--------------------------------------------------*/
|
||||
boolean K_PlayerUsesBotMovement(player_t *player)
|
||||
{
|
||||
if (player->exiting || player->quittime)
|
||||
if (player->exiting)
|
||||
return true;
|
||||
|
||||
if (player->bot)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -463,8 +463,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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -436,8 +436,11 @@ 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
|
||||
if (object->player->tiregrease < greasetics)
|
||||
{
|
||||
object->player->tiregrease = greasetics;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,16 +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);
|
||||
WRITEUINT32(save_p, players[i].quittime);
|
||||
|
||||
WRITEUINT8(save_p, players[i].splitscreenindex);
|
||||
|
||||
WRITEUINT16(save_p, flags);
|
||||
|
||||
if (flags & SKYBOXVIEW)
|
||||
|
@ -343,6 +342,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));
|
||||
|
@ -407,7 +408,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);
|
||||
|
@ -456,7 +457,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);
|
||||
|
||||
|
@ -608,6 +608,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);
|
||||
|
@ -1681,7 +1683,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;
|
||||
|
@ -1866,6 +1868,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);
|
||||
|
@ -2934,6 +2937,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)
|
||||
|
|
|
@ -4313,7 +4313,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])
|
||||
|
|
|
@ -504,15 +504,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)
|
||||
|
|
Loading…
Add table
Reference in a new issue