Remove NONET
This commit is contained in:
parent
2658038feb
commit
febde8d181
16 changed files with 74 additions and 409 deletions
|
|
@ -64,7 +64,6 @@
|
||||||
#
|
#
|
||||||
# Netplay incompatible
|
# Netplay incompatible
|
||||||
# --------------------
|
# --------------------
|
||||||
# NONET=1 - Disable online capability.
|
|
||||||
# NOMD5=1 - Disable MD5 checksum (validation tool).
|
# NOMD5=1 - Disable MD5 checksum (validation tool).
|
||||||
# NOPOSTPROCESSING=1 - ?
|
# NOPOSTPROCESSING=1 - ?
|
||||||
# MOBJCONSISTANCY=1 - ??
|
# MOBJCONSISTANCY=1 - ??
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
passthru_opts+=\
|
passthru_opts+=\
|
||||||
NONET NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
|
NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
|
||||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||||
HAVE_MINIUPNPC\
|
HAVE_MINIUPNPC\
|
||||||
HAVE_DISCORDRPC DEVELOP
|
HAVE_DISCORDRPC DEVELOP
|
||||||
|
|
@ -48,13 +48,11 @@ sources+=apng.c
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NONET
|
|
||||||
ifndef NOCURL
|
ifndef NOCURL
|
||||||
CURLCONFIG?=curl-config
|
CURLCONFIG?=curl-config
|
||||||
$(eval $(call Configure,CURL,$(CURLCONFIG)))
|
$(eval $(call Configure,CURL,$(CURLCONFIG)))
|
||||||
opts+=-DHAVE_CURL
|
opts+=-DHAVE_CURL
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef HAVE_MINIUPNPC
|
ifdef HAVE_MINIUPNPC
|
||||||
libs+=-lminiupnpc
|
libs+=-lminiupnpc
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,10 @@ ifndef MINGW64
|
||||||
libs+=-Wl,--large-address-aware
|
libs+=-Wl,--large-address-aware
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NONET
|
|
||||||
ifndef MINGW64 # miniupnc is broken with MINGW64
|
ifndef MINGW64 # miniupnc is broken with MINGW64
|
||||||
opts+=-I../libs -DSTATIC_MINIUPNPC
|
opts+=-I../libs -DSTATIC_MINIUPNPC
|
||||||
libs+=-L../thirdparty/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
|
libs+=-L../thirdparty/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef NO_DISCORDRPC
|
ifndef NO_DISCORDRPC
|
||||||
HAVE_DISCORDRPC=1
|
HAVE_DISCORDRPC=1
|
||||||
|
|
|
||||||
|
|
@ -58,11 +58,9 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "s_sound.h" // sfx_syfail
|
#include "s_sound.h" // sfx_syfail
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// cl loading screen
|
// cl loading screen
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "f_finale.h"
|
#include "f_finale.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
#ifdef HAVE_DISCORDRPC
|
||||||
#include "discord.h"
|
#include "discord.h"
|
||||||
|
|
@ -566,8 +564,6 @@ char http_source[MAX_MIRROR_LENGTH];
|
||||||
|
|
||||||
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
|
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CL_DrawConnectionStatus
|
// CL_DrawConnectionStatus
|
||||||
//
|
//
|
||||||
|
|
@ -787,8 +783,6 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static boolean CL_AskFileList(INT32 firstfile)
|
static boolean CL_AskFileList(INT32 firstfile)
|
||||||
{
|
{
|
||||||
netbuffer->packettype = PT_TELLFILESNEEDED;
|
netbuffer->packettype = PT_TELLFILESNEEDED;
|
||||||
|
|
@ -1368,7 +1362,6 @@ static void CL_ReloadReceivedSavegame(void)
|
||||||
CONS_Printf(M_GetText("Game state reloaded\n"));
|
CONS_Printf(M_GetText("Game state reloaded\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void SendAskInfo(INT32 node)
|
static void SendAskInfo(INT32 node)
|
||||||
{
|
{
|
||||||
tic_t asktime;
|
tic_t asktime;
|
||||||
|
|
@ -1507,11 +1500,8 @@ void CL_UpdateServerList (void)
|
||||||
SendAskInfo(BROADCASTADDR);
|
SendAskInfo(BROADCASTADDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ifndef NONET
|
|
||||||
|
|
||||||
static void M_ConfirmConnect(event_t *ev)
|
static void M_ConfirmConnect(event_t *ev)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
if (ev->type == ev_keydown)
|
if (ev->type == ev_keydown)
|
||||||
{
|
{
|
||||||
if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[0][gc_accelerate][0] || ev->data1 == gamecontrol[0][gc_accelerate][1])
|
if (ev->data1 == ' ' || ev->data1 == 'y' || ev->data1 == KEY_ENTER || ev->data1 == gamecontrol[0][gc_accelerate][0] || ev->data1 == gamecontrol[0][gc_accelerate][1])
|
||||||
|
|
@ -1547,9 +1537,6 @@ static void M_ConfirmConnect(event_t *ev)
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
(void)ev;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean CL_FinishedFileList(void)
|
static boolean CL_FinishedFileList(void)
|
||||||
|
|
@ -1636,28 +1623,22 @@ static boolean CL_FinishedFileList(void)
|
||||||
if (!curl_failedwebdownload)
|
if (!curl_failedwebdownload)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
downloadcompletednum = 0;
|
downloadcompletednum = 0;
|
||||||
downloadcompletedsize = 0;
|
downloadcompletedsize = 0;
|
||||||
totalfilesrequestednum = 0;
|
totalfilesrequestednum = 0;
|
||||||
totalfilesrequestedsize = 0;
|
totalfilesrequestedsize = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0; i < fileneedednum; i++)
|
for (i = 0; i < fileneedednum; i++)
|
||||||
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
totalfilesrequestednum++;
|
totalfilesrequestednum++;
|
||||||
totalfilesrequestedsize += fileneeded[i].totalsize;
|
totalfilesrequestedsize += fileneeded[i].totalsize;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
if (totalfilesrequestedsize>>20 >= 10)
|
if (totalfilesrequestedsize>>20 >= 10)
|
||||||
downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20));
|
downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20));
|
||||||
else
|
else
|
||||||
downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10));
|
downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (serverisfull)
|
if (serverisfull)
|
||||||
M_StartMessage(va(M_GetText(
|
M_StartMessage(va(M_GetText(
|
||||||
|
|
@ -1705,7 +1686,6 @@ static boolean CL_FinishedFileList(void)
|
||||||
*/
|
*/
|
||||||
static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
// serverlist is updated by GetPacket function
|
// serverlist is updated by GetPacket function
|
||||||
|
|
@ -1767,11 +1747,6 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||||
SendAskInfo(servernode);
|
SendAskInfo(servernode);
|
||||||
*asksent = I_GetTime() + NEWTICRATE;
|
*asksent = I_GetTime() + NEWTICRATE;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
(void)asksent;
|
|
||||||
// No netgames, so we skip this state.
|
|
||||||
cl_mode = CL_ASKJOIN;
|
|
||||||
#endif // ifndef NONET/else
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1791,10 +1766,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
boolean waitmore;
|
boolean waitmore;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
#ifdef NONET
|
|
||||||
(void)tmpsave;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (cl_mode)
|
switch (cl_mode)
|
||||||
{
|
{
|
||||||
case CL_SEARCHING:
|
case CL_SEARCHING:
|
||||||
|
|
@ -2004,7 +1975,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
//FileSendTicker();
|
//FileSendTicker();
|
||||||
*oldtic = I_GetTime();
|
*oldtic = I_GetTime();
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
|
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
|
||||||
{
|
{
|
||||||
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_DOWNLOADSAVEGAME)
|
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_DOWNLOADSAVEGAME)
|
||||||
|
|
@ -2026,10 +1996,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
S_UpdateSounds();
|
S_UpdateSounds();
|
||||||
S_UpdateClosedCaptions();
|
S_UpdateClosedCaptions();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
CON_Drawer();
|
|
||||||
I_UpdateNoVsync();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2049,22 +2015,18 @@ static void CL_ConnectToServer(void)
|
||||||
{
|
{
|
||||||
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
|
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
|
||||||
tic_t oldtic;
|
tic_t oldtic;
|
||||||
#ifndef NONET
|
|
||||||
tic_t asksent;
|
tic_t asksent;
|
||||||
char tmpsave[256];
|
char tmpsave[256];
|
||||||
|
|
||||||
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
|
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
|
||||||
|
|
||||||
lastfilenum = -1;
|
lastfilenum = -1;
|
||||||
#endif
|
|
||||||
|
|
||||||
cl_mode = CL_SEARCHING;
|
cl_mode = CL_SEARCHING;
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// Don't get a corrupt savegame error because tmpsave already exists
|
// Don't get a corrupt savegame error because tmpsave already exists
|
||||||
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
|
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
|
||||||
I_Error("Can't delete %s\n", tmpsave);
|
I_Error("Can't delete %s\n", tmpsave);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (netgame)
|
if (netgame)
|
||||||
{
|
{
|
||||||
|
|
@ -2091,7 +2053,6 @@ static void CL_ConnectToServer(void)
|
||||||
|
|
||||||
pnumnodes = 1;
|
pnumnodes = 1;
|
||||||
oldtic = 0;
|
oldtic = 0;
|
||||||
#ifndef NONET
|
|
||||||
asksent = 0;
|
asksent = 0;
|
||||||
firstconnectattempttime = I_GetTime();
|
firstconnectattempttime = I_GetTime();
|
||||||
|
|
||||||
|
|
@ -2107,16 +2068,11 @@ static void CL_ConnectToServer(void)
|
||||||
serverlist[i].info.version, serverlist[i].info.subversion);
|
serverlist[i].info.version, serverlist[i].info.subversion);
|
||||||
}
|
}
|
||||||
SL_ClearServerList(servernode);
|
SL_ClearServerList(servernode);
|
||||||
#endif
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// If the connection was aborted for some reason, leave
|
// If the connection was aborted for some reason, leave
|
||||||
#ifndef NONET
|
|
||||||
if (!CL_ServerConnectionTicker(tmpsave, &oldtic, &asksent))
|
if (!CL_ServerConnectionTicker(tmpsave, &oldtic, &asksent))
|
||||||
#else
|
|
||||||
if (!CL_ServerConnectionTicker((char*)NULL, &oldtic, (tic_t *)NULL))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (P_PartialAddGetStage() >= 0)
|
if (P_PartialAddGetStage() >= 0)
|
||||||
|
|
@ -2135,16 +2091,13 @@ static void CL_ConnectToServer(void)
|
||||||
}
|
}
|
||||||
while (!(cl_mode == CL_CONNECTED && (client || (server && nodewaited <= pnumnodes))));
|
while (!(cl_mode == CL_CONNECTED && (client || (server && nodewaited <= pnumnodes))));
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
if (netgame)
|
if (netgame)
|
||||||
F_StartWaitingPlayers();
|
F_StartWaitingPlayers();
|
||||||
#endif
|
|
||||||
DEBFILE(va("Synchronisation Finished\n"));
|
DEBFILE(va("Synchronisation Finished\n"));
|
||||||
|
|
||||||
displayplayers[0] = consoleplayer;
|
displayplayers[0] = consoleplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void Command_ShowBan(void) //Print out ban list
|
static void Command_ShowBan(void) //Print out ban list
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
@ -2516,7 +2469,6 @@ static void Command_connect(void)
|
||||||
|
|
||||||
CL_ConnectToServer();
|
CL_ConnectToServer();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void ResetNode(INT32 node);
|
static void ResetNode(INT32 node);
|
||||||
|
|
||||||
|
|
@ -2666,10 +2618,8 @@ void CL_Reset(void)
|
||||||
fileneedednum = 0;
|
fileneedednum = 0;
|
||||||
memset(fileneeded, 0, sizeof(fileneeded));
|
memset(fileneeded, 0, sizeof(fileneeded));
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
totalfilesrequestednum = 0;
|
totalfilesrequestednum = 0;
|
||||||
totalfilesrequestedsize = 0;
|
totalfilesrequestedsize = 0;
|
||||||
#endif
|
|
||||||
firstconnectattempttime = 0;
|
firstconnectattempttime = 0;
|
||||||
serverisfull = false;
|
serverisfull = false;
|
||||||
connectiontimeout = (tic_t)cv_nettimeout.value; //reset this temporary hack
|
connectiontimeout = (tic_t)cv_nettimeout.value; //reset this temporary hack
|
||||||
|
|
@ -2684,7 +2634,6 @@ void CL_Reset(void)
|
||||||
// D_StartTitle should get done now, but the calling function will handle it
|
// D_StartTitle should get done now, but the calling function will handle it
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void Command_GetPlayerNum(void)
|
static void Command_GetPlayerNum(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
@ -2946,7 +2895,6 @@ static void Command_Kick(void)
|
||||||
else
|
else
|
||||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
{
|
{
|
||||||
|
|
@ -3364,7 +3312,6 @@ void D_ClientServerInit(void)
|
||||||
DEBFILE(va("- - -== SRB2Kart v%d.%d "VERSIONSTRING" debugfile ==- - -\n",
|
DEBFILE(va("- - -== SRB2Kart v%d.%d "VERSIONSTRING" debugfile ==- - -\n",
|
||||||
VERSION, SUBVERSION));
|
VERSION, SUBVERSION));
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
COM_AddCommand("getplayernum", Command_GetPlayerNum);
|
COM_AddCommand("getplayernum", Command_GetPlayerNum);
|
||||||
COM_AddCommand("kick", Command_Kick);
|
COM_AddCommand("kick", Command_Kick);
|
||||||
COM_AddCommand("ban", Command_Ban);
|
COM_AddCommand("ban", Command_Ban);
|
||||||
|
|
@ -3385,19 +3332,16 @@ void D_ClientServerInit(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
COM_AddCommand("numnodes", Command_Numnodes);
|
COM_AddCommand("numnodes", Command_Numnodes);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RegisterNetXCmd(XD_KICK, Got_KickCmd);
|
RegisterNetXCmd(XD_KICK, Got_KickCmd);
|
||||||
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
|
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
|
||||||
RegisterNetXCmd(XD_REMOVEPLAYER, Got_RemovePlayer);
|
RegisterNetXCmd(XD_REMOVEPLAYER, Got_RemovePlayer);
|
||||||
RegisterNetXCmd(XD_ADDBOT, Got_AddBot);
|
RegisterNetXCmd(XD_ADDBOT, Got_AddBot);
|
||||||
#ifndef NONET
|
|
||||||
#ifdef DUMPCONSISTENCY
|
#ifdef DUMPCONSISTENCY
|
||||||
CV_RegisterVar(&cv_dumpconsistency);
|
CV_RegisterVar(&cv_dumpconsistency);
|
||||||
#endif
|
#endif
|
||||||
D_LoadBan(false);
|
D_LoadBan(false);
|
||||||
#endif
|
|
||||||
|
|
||||||
gametic = 0;
|
gametic = 0;
|
||||||
localgametic = 0;
|
localgametic = 0;
|
||||||
|
|
@ -4119,9 +4063,7 @@ static void HandleConnect(SINT8 node)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
boolean newnode = false;
|
boolean newnode = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0; i < netbuffer->u.clientcfg.localplayers - playerpernode[node]; i++)
|
for (i = 0; i < netbuffer->u.clientcfg.localplayers - playerpernode[node]; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -4138,9 +4080,7 @@ static void HandleConnect(SINT8 node)
|
||||||
if (!nodeingame[node])
|
if (!nodeingame[node])
|
||||||
{
|
{
|
||||||
gamestate_t backupstate = gamestate;
|
gamestate_t backupstate = gamestate;
|
||||||
#ifndef NONET
|
|
||||||
newnode = true;
|
newnode = true;
|
||||||
#endif
|
|
||||||
|
|
||||||
SV_AddNode(node);
|
SV_AddNode(node);
|
||||||
|
|
||||||
|
|
@ -4162,7 +4102,6 @@ static void HandleConnect(SINT8 node)
|
||||||
G_SetGamestate(backupstate);
|
G_SetGamestate(backupstate);
|
||||||
DEBFILE("new node joined\n");
|
DEBFILE("new node joined\n");
|
||||||
}
|
}
|
||||||
#ifndef NONET
|
|
||||||
if (nodewaiting[node])
|
if (nodewaiting[node])
|
||||||
{
|
{
|
||||||
if (node && newnode)
|
if (node && newnode)
|
||||||
|
|
@ -4174,7 +4113,6 @@ static void HandleConnect(SINT8 node)
|
||||||
joindelay += cv_joindelay.value * TICRATE;
|
joindelay += cv_joindelay.value * TICRATE;
|
||||||
player_joining = true;
|
player_joining = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4208,7 +4146,6 @@ static void HandleTimeout(SINT8 node)
|
||||||
M_StartMessage(M_GetText("Server Timeout\n\nPress Esc\n"), NULL, MM_NOTHING);
|
M_StartMessage(M_GetText("Server Timeout\n\nPress Esc\n"), NULL, MM_NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
/** Called when a PT_SERVERINFO packet is received
|
/** Called when a PT_SERVERINFO packet is received
|
||||||
*
|
*
|
||||||
* \param node The packet sender
|
* \param node The packet sender
|
||||||
|
|
@ -4233,7 +4170,6 @@ static void HandleServerInfo(SINT8 node)
|
||||||
|
|
||||||
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void PT_WillResendGamestate(void)
|
static void PT_WillResendGamestate(void)
|
||||||
{
|
{
|
||||||
|
|
@ -4449,23 +4385,15 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
playernode[(UINT8)serverplayer] = servernode;
|
playernode[(UINT8)serverplayer] = servernode;
|
||||||
|
|
||||||
if (netgame)
|
if (netgame)
|
||||||
#ifndef NONET
|
|
||||||
CONS_Printf(M_GetText("Join accepted, waiting for complete game state...\n"));
|
CONS_Printf(M_GetText("Join accepted, waiting for complete game state...\n"));
|
||||||
#else
|
|
||||||
CONS_Printf(M_GetText("Join accepted, waiting for next level change...\n"));
|
|
||||||
#endif
|
|
||||||
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
|
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
||||||
/// Shouldn't them be downloaded even at intermission time?
|
/// Shouldn't them be downloaded even at intermission time?
|
||||||
/// Also, according to HandleConnect, the server will send the savegame even during intermission...
|
/// Also, according to HandleConnect, the server will send the savegame even during intermission...
|
||||||
/// Sryder 2018-07-05: If we don't want to send the player config another way we need to send the gamestate
|
/// Sryder 2018-07-05: If we don't want to send the player config another way we need to send the gamestate
|
||||||
/// At almost any gamestate there could be joiners... So just always send gamestate?
|
/// At almost any gamestate there could be joiners... So just always send gamestate?
|
||||||
cl_mode = ((server) ? CL_CONNECTED : CL_DOWNLOADSAVEGAME);
|
cl_mode = ((server) ? CL_CONNECTED : CL_DOWNLOADSAVEGAME);
|
||||||
#else
|
|
||||||
cl_mode = CL_CONNECTED;
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5051,13 +4979,11 @@ static void GetPackets(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
if (netbuffer->packettype == PT_SERVERINFO)
|
if (netbuffer->packettype == PT_SERVERINFO)
|
||||||
{
|
{
|
||||||
HandleServerInfo(node);
|
HandleServerInfo(node);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (netbuffer->packettype == PT_PLAYERINFO)
|
if (netbuffer->packettype == PT_PLAYERINFO)
|
||||||
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
||||||
|
|
|
||||||
|
|
@ -501,11 +501,9 @@ boolean TryRunTics(tic_t realtic);
|
||||||
/*boolean AddLmpExtradata(UINT8 **demo_p, INT32 playernum);
|
/*boolean AddLmpExtradata(UINT8 **demo_p, INT32 playernum);
|
||||||
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum);*/
|
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum);*/
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// translate a playername in a player number return -1 if not found and
|
// translate a playername in a player number return -1 if not found and
|
||||||
// print a error message in the console
|
// print a error message in the console
|
||||||
SINT8 nametonum(const char *name);
|
SINT8 nametonum(const char *name);
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char motd[254], server_context[8];
|
extern char motd[254], server_context[8];
|
||||||
extern UINT8 playernode[MAXPLAYERS];
|
extern UINT8 playernode[MAXPLAYERS];
|
||||||
|
|
|
||||||
48
src/d_net.c
48
src/d_net.c
|
|
@ -152,7 +152,6 @@ boolean Net_GetNetStat(void)
|
||||||
#define URGENTFREESLOTNUM 10
|
#define URGENTFREESLOTNUM 10
|
||||||
#define ACKTOSENDTIMEOUT (TICRATE/11)
|
#define ACKTOSENDTIMEOUT (TICRATE/11)
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT8 acknum;
|
UINT8 acknum;
|
||||||
|
|
@ -166,7 +165,6 @@ typedef struct
|
||||||
doomdata_t data;
|
doomdata_t data;
|
||||||
} pak;
|
} pak;
|
||||||
} ackpak_t;
|
} ackpak_t;
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
@ -174,10 +172,8 @@ typedef enum
|
||||||
NF_TIMEOUT = 2, // Flag is set when the node got a timeout
|
NF_TIMEOUT = 2, // Flag is set when the node got a timeout
|
||||||
} node_flags_t;
|
} node_flags_t;
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// Table of packets that were not acknowleged can be resent (the sender window)
|
// Table of packets that were not acknowleged can be resent (the sender window)
|
||||||
static ackpak_t ackpak[MAXACKPACKETS];
|
static ackpak_t ackpak[MAXACKPACKETS];
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
@ -205,7 +201,6 @@ typedef struct
|
||||||
static netnode_t nodes[MAXNETNODES];
|
static netnode_t nodes[MAXNETNODES];
|
||||||
#define NODETIMEOUT 14
|
#define NODETIMEOUT 14
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// return <0 if a < b (mod 256)
|
// return <0 if a < b (mod 256)
|
||||||
// 0 if a = n (mod 256)
|
// 0 if a = n (mod 256)
|
||||||
// >0 if a > b (mod 256)
|
// >0 if a > b (mod 256)
|
||||||
|
|
@ -440,21 +435,15 @@ static boolean Processackpak(void)
|
||||||
}
|
}
|
||||||
return goodpacket;
|
return goodpacket;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// send special packet with only ack on it
|
// send special packet with only ack on it
|
||||||
void Net_SendAcks(INT32 node)
|
void Net_SendAcks(INT32 node)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)node;
|
|
||||||
#else
|
|
||||||
netbuffer->packettype = PT_NOTHING;
|
netbuffer->packettype = PT_NOTHING;
|
||||||
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
||||||
HSendPacket(node, false, 0, MAXACKTOSEND);
|
HSendPacket(node, false, 0, MAXACKTOSEND);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void GotAcks(void)
|
static void GotAcks(void)
|
||||||
{
|
{
|
||||||
INT32 i, j;
|
INT32 i, j;
|
||||||
|
|
@ -477,7 +466,6 @@ static void GotAcks(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void Net_ConnectionTimeout(INT32 node)
|
void Net_ConnectionTimeout(INT32 node)
|
||||||
{
|
{
|
||||||
|
|
@ -503,7 +491,6 @@ void Net_ConnectionTimeout(INT32 node)
|
||||||
// Resend the data if needed
|
// Resend the data if needed
|
||||||
void Net_AckTicker(void)
|
void Net_AckTicker(void)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAXACKPACKETS; i++)
|
for (i = 0; i < MAXACKPACKETS; i++)
|
||||||
|
|
@ -550,16 +537,12 @@ void Net_AckTicker(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove last packet received ack before resending the ackreturn
|
// Remove last packet received ack before resending the ackreturn
|
||||||
// (the higher layer doesn't have room, or something else ....)
|
// (the higher layer doesn't have room, or something else ....)
|
||||||
void Net_UnAcknowledgePacket(INT32 node)
|
void Net_UnAcknowledgePacket(INT32 node)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)node;
|
|
||||||
#else
|
|
||||||
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
|
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
|
||||||
DEBFILE(va("UnAcknowledge node %d\n", node));
|
DEBFILE(va("UnAcknowledge node %d\n", node));
|
||||||
if (!node)
|
if (!node)
|
||||||
|
|
@ -591,10 +574,8 @@ void Net_UnAcknowledgePacket(INT32 node)
|
||||||
if (!nodes[node].firstacktosend)
|
if (!nodes[node].firstacktosend)
|
||||||
nodes[node].firstacktosend = 1;
|
nodes[node].firstacktosend = 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
/** Checks if all acks have been received
|
/** Checks if all acks have been received
|
||||||
*
|
*
|
||||||
* \return True if all acks have been received
|
* \return True if all acks have been received
|
||||||
|
|
@ -610,7 +591,6 @@ static boolean Net_AllAcksReceived(void)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Waits for all ackreturns
|
/** Waits for all ackreturns
|
||||||
*
|
*
|
||||||
|
|
@ -619,9 +599,6 @@ static boolean Net_AllAcksReceived(void)
|
||||||
*/
|
*/
|
||||||
void Net_WaitAllAckReceived(UINT32 timeout)
|
void Net_WaitAllAckReceived(UINT32 timeout)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)timeout;
|
|
||||||
#else
|
|
||||||
tic_t tictac = I_GetTime();
|
tic_t tictac = I_GetTime();
|
||||||
timeout = tictac + timeout*NEWTICRATE;
|
timeout = tictac + timeout*NEWTICRATE;
|
||||||
|
|
||||||
|
|
@ -637,7 +614,6 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
||||||
HGetPacket();
|
HGetPacket();
|
||||||
Net_AckTicker();
|
Net_AckTicker();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void InitNode(netnode_t *node)
|
static void InitNode(netnode_t *node)
|
||||||
|
|
@ -653,10 +629,8 @@ static void InitAck(void)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
for (i = 0; i < MAXACKPACKETS; i++)
|
for (i = 0; i < MAXACKPACKETS; i++)
|
||||||
ackpak[i].acknum = 0;
|
ackpak[i].acknum = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0; i < MAXNETNODES; i++)
|
for (i = 0; i < MAXNETNODES; i++)
|
||||||
InitNode(&nodes[i]);
|
InitNode(&nodes[i]);
|
||||||
|
|
@ -669,9 +643,6 @@ static void InitAck(void)
|
||||||
*/
|
*/
|
||||||
void Net_AbortPacketType(UINT8 packettype)
|
void Net_AbortPacketType(UINT8 packettype)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)packettype;
|
|
||||||
#else
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
for (i = 0; i < MAXACKPACKETS; i++)
|
for (i = 0; i < MAXACKPACKETS; i++)
|
||||||
if (ackpak[i].acknum && (ackpak[i].pak.data.packettype == packettype
|
if (ackpak[i].acknum && (ackpak[i].pak.data.packettype == packettype
|
||||||
|
|
@ -679,7 +650,6 @@ void Net_AbortPacketType(UINT8 packettype)
|
||||||
{
|
{
|
||||||
ackpak[i].acknum = 0;
|
ackpak[i].acknum = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
|
@ -689,9 +659,6 @@ void Net_AbortPacketType(UINT8 packettype)
|
||||||
// remove a node, clear all ack from this node and reset askret
|
// remove a node, clear all ack from this node and reset askret
|
||||||
void Net_CloseConnection(INT32 node)
|
void Net_CloseConnection(INT32 node)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)node;
|
|
||||||
#else
|
|
||||||
INT32 i;
|
INT32 i;
|
||||||
boolean forceclose = (node & FORCECLOSE) != 0;
|
boolean forceclose = (node & FORCECLOSE) != 0;
|
||||||
|
|
||||||
|
|
@ -736,10 +703,8 @@ void Net_CloseConnection(INT32 node)
|
||||||
if (server)
|
if (server)
|
||||||
SV_AbortLuaFileTransfer(node);
|
SV_AbortLuaFileTransfer(node);
|
||||||
I_NetFreeNodenum(node);
|
I_NetFreeNodenum(node);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
//
|
//
|
||||||
// Checksum
|
// Checksum
|
||||||
//
|
//
|
||||||
|
|
@ -755,7 +720,6 @@ static UINT32 NetbufferChecksum(void)
|
||||||
|
|
||||||
return LONG(c);
|
return LONG(c);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUGFILE
|
#ifdef DEBUGFILE
|
||||||
|
|
||||||
|
|
@ -1025,14 +989,12 @@ void Command_Droprate(void)
|
||||||
packetdroprate = droprate;
|
packetdroprate = droprate;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static boolean ShouldDropPacket(void)
|
static boolean ShouldDropPacket(void)
|
||||||
{
|
{
|
||||||
return (packetdropquantity[netbuffer->packettype])
|
return (packetdropquantity[netbuffer->packettype])
|
||||||
|| (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100;
|
|| (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// HSendPacket
|
// HSendPacket
|
||||||
|
|
@ -1067,11 +1029,6 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||||
if (!netgame)
|
if (!netgame)
|
||||||
I_Error("Tried to transmit to another node");
|
I_Error("Tried to transmit to another node");
|
||||||
|
|
||||||
#ifdef NONET
|
|
||||||
(void)node;
|
|
||||||
(void)reliable;
|
|
||||||
(void)acknum;
|
|
||||||
#else
|
|
||||||
// do this before GetFreeAcknum because this function backups
|
// do this before GetFreeAcknum because this function backups
|
||||||
// the current packet
|
// the current packet
|
||||||
doomcom->remotenode = (INT16)node;
|
doomcom->remotenode = (INT16)node;
|
||||||
|
|
@ -1132,8 +1089,6 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // ndef NONET
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1167,8 +1122,6 @@ boolean HGetPacket(void)
|
||||||
if (!netgame)
|
if (!netgame)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
//nodejustjoined = I_NetGet();
|
//nodejustjoined = I_NetGet();
|
||||||
|
|
@ -1228,7 +1181,6 @@ boolean HGetPacket(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // ndef NONET
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,8 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum,
|
||||||
size_t packetlength);
|
size_t packetlength);
|
||||||
boolean HGetPacket(void);
|
boolean HGetPacket(void);
|
||||||
void D_SetDoomcom(void);
|
void D_SetDoomcom(void);
|
||||||
#ifndef NONET
|
|
||||||
void D_SaveBan(void);
|
void D_SaveBan(void);
|
||||||
void D_LoadBan(boolean warning);
|
void D_LoadBan(boolean warning);
|
||||||
#endif
|
|
||||||
boolean D_CheckNetGame(void);
|
boolean D_CheckNetGame(void);
|
||||||
void D_CloseConnection(void);
|
void D_CloseConnection(void);
|
||||||
void Net_UnAcknowledgePacket(INT32 node);
|
void Net_UnAcknowledgePacket(INT32 node);
|
||||||
|
|
|
||||||
|
|
@ -810,14 +810,12 @@ void D_RegisterServerCommands(void)
|
||||||
CV_RegisterVar(&cv_noticedownload);
|
CV_RegisterVar(&cv_noticedownload);
|
||||||
CV_RegisterVar(&cv_downloadspeed);
|
CV_RegisterVar(&cv_downloadspeed);
|
||||||
CV_RegisterVar(&cv_httpsource);
|
CV_RegisterVar(&cv_httpsource);
|
||||||
#ifndef NONET
|
|
||||||
CV_RegisterVar(&cv_allownewplayer);
|
CV_RegisterVar(&cv_allownewplayer);
|
||||||
#ifdef VANILLAJOINNEXTROUND
|
#ifdef VANILLAJOINNEXTROUND
|
||||||
CV_RegisterVar(&cv_joinnextround);
|
CV_RegisterVar(&cv_joinnextround);
|
||||||
#endif
|
#endif
|
||||||
CV_RegisterVar(&cv_showjoinaddress);
|
CV_RegisterVar(&cv_showjoinaddress);
|
||||||
CV_RegisterVar(&cv_blamecfail);
|
CV_RegisterVar(&cv_blamecfail);
|
||||||
#endif
|
|
||||||
|
|
||||||
COM_AddCommand("ping", Command_Ping_f);
|
COM_AddCommand("ping", Command_Ping_f);
|
||||||
CV_RegisterVar(&cv_nettimeout);
|
CV_RegisterVar(&cv_nettimeout);
|
||||||
|
|
|
||||||
|
|
@ -115,14 +115,12 @@ typedef struct
|
||||||
} pauseddownload_t;
|
} pauseddownload_t;
|
||||||
static pauseddownload_t *pauseddownload = NULL;
|
static pauseddownload_t *pauseddownload = NULL;
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// for cl loading screen
|
// for cl loading screen
|
||||||
INT32 lastfilenum = -1;
|
INT32 lastfilenum = -1;
|
||||||
INT32 downloadcompletednum = 0;
|
INT32 downloadcompletednum = 0;
|
||||||
UINT32 downloadcompletedsize = 0;
|
UINT32 downloadcompletedsize = 0;
|
||||||
INT32 totalfilesrequestednum = 0;
|
INT32 totalfilesrequestednum = 0;
|
||||||
UINT32 totalfilesrequestedsize = 0;
|
UINT32 totalfilesrequestedsize = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
static CURL *http_handle;
|
static CURL *http_handle;
|
||||||
|
|
@ -254,9 +252,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
||||||
|
|
||||||
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
lastfilenum = -1;
|
lastfilenum = -1;
|
||||||
#endif
|
|
||||||
|
|
||||||
fileneedednum = 1;
|
fileneedednum = 1;
|
||||||
fileneeded[0].status = FS_REQUESTED;
|
fileneeded[0].status = FS_REQUESTED;
|
||||||
|
|
@ -1534,10 +1530,8 @@ void PT_FileFragment(void)
|
||||||
HSendPacket(servernode, true, 0, 0);
|
HSendPacket(servernode, true, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
downloadcompletednum++;
|
downloadcompletednum++;
|
||||||
downloadcompletedsize += file->totalsize;
|
downloadcompletedsize += file->totalsize;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Already received
|
else // Already received
|
||||||
|
|
@ -1571,9 +1565,7 @@ void PT_FileFragment(void)
|
||||||
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
lastfilenum = filenum;
|
lastfilenum = filenum;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Checks if a node is downloading a file
|
/** \brief Checks if a node is downloading a file
|
||||||
|
|
|
||||||
|
|
@ -66,13 +66,11 @@ extern fileneeded_t fileneeded[MAX_WADFILES];
|
||||||
#define DOWNLOADDIR_PART "downloads"
|
#define DOWNLOADDIR_PART "downloads"
|
||||||
extern char downloaddir[];
|
extern char downloaddir[];
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
extern INT32 lastfilenum;
|
extern INT32 lastfilenum;
|
||||||
extern INT32 downloadcompletednum;
|
extern INT32 downloadcompletednum;
|
||||||
extern UINT32 downloadcompletedsize;
|
extern UINT32 downloadcompletedsize;
|
||||||
extern INT32 totalfilesrequestednum;
|
extern INT32 totalfilesrequestednum;
|
||||||
extern UINT32 totalfilesrequestedsize;
|
extern UINT32 totalfilesrequestedsize;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
extern boolean curl_failedwebdownload;
|
extern boolean curl_failedwebdownload;
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
#define NONET
|
|
||||||
#if !defined (HWRENDER) && !defined (NOHW)
|
#if !defined (HWRENDER) && !defined (NOHW)
|
||||||
#define HWRENDER
|
#define HWRENDER
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -553,13 +552,13 @@ extern int compuncommitted;
|
||||||
#define USER_VOLUME_SCALE 2
|
#define USER_VOLUME_SCALE 2
|
||||||
#define MAX_VOLUME ( 100 * VOLUME_DIVIDER / USER_VOLUME_SCALE )
|
#define MAX_VOLUME ( 100 * VOLUME_DIVIDER / USER_VOLUME_SCALE )
|
||||||
|
|
||||||
#if defined (HAVE_CURL) && ! defined (NONET)
|
#ifdef HAVE_CURL
|
||||||
#define MASTERSERVER
|
#define MASTERSERVER
|
||||||
#else
|
#else
|
||||||
#undef UPDATE_ALERT
|
#undef UPDATE_ALERT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_CURL) && ! defined (NONET)
|
#ifdef HAVE_CURL
|
||||||
#define MASTERSERVER
|
#define MASTERSERVER
|
||||||
#else
|
#else
|
||||||
#undef UPDATE_ALERT
|
#undef UPDATE_ALERT
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,6 @@ static huddrawlist_h luahuddrawlist_scores;
|
||||||
// HEADS UP INIT
|
// HEADS UP INIT
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// just after
|
// just after
|
||||||
static void Command_Say_f(void);
|
static void Command_Say_f(void);
|
||||||
static void Command_Sayto_f(void);
|
static void Command_Sayto_f(void);
|
||||||
|
|
@ -178,7 +177,6 @@ static void Command_Sayteam_f(void);
|
||||||
static void Command_CSay_f(void);
|
static void Command_CSay_f(void);
|
||||||
static void Command_Shout(void);
|
static void Command_Shout(void);
|
||||||
static void Got_Saycmd(UINT8 **p, INT32 playernum);
|
static void Got_Saycmd(UINT8 **p, INT32 playernum);
|
||||||
#endif
|
|
||||||
|
|
||||||
void HU_LoadGraphics(void)
|
void HU_LoadGraphics(void)
|
||||||
{
|
{
|
||||||
|
|
@ -220,14 +218,12 @@ void HU_Init(void)
|
||||||
{
|
{
|
||||||
font_t font;
|
font_t font;
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
COM_AddCommand("say", Command_Say_f);
|
COM_AddCommand("say", Command_Say_f);
|
||||||
COM_AddCommand("sayto", Command_Sayto_f);
|
COM_AddCommand("sayto", Command_Sayto_f);
|
||||||
COM_AddCommand("sayteam", Command_Sayteam_f);
|
COM_AddCommand("sayteam", Command_Sayteam_f);
|
||||||
COM_AddCommand("csay", Command_CSay_f);
|
COM_AddCommand("csay", Command_CSay_f);
|
||||||
COM_AddCommand("shout", Command_Shout);
|
COM_AddCommand("shout", Command_Shout);
|
||||||
RegisterNetXCmd(XD_SAY, Got_Saycmd);
|
RegisterNetXCmd(XD_SAY, Got_Saycmd);
|
||||||
#endif
|
|
||||||
|
|
||||||
// only allocate if not present, to save us a lot of headache
|
// only allocate if not present, to save us a lot of headache
|
||||||
if (missingpat == NULL)
|
if (missingpat == NULL)
|
||||||
|
|
@ -389,7 +385,6 @@ void HU_Start(void)
|
||||||
// EXECUTION
|
// EXECUTION
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
// EVERY CHANGE IN THIS SCRIPT IS LOL XD! BY VINCYTM
|
// EVERY CHANGE IN THIS SCRIPT IS LOL XD! BY VINCYTM
|
||||||
|
|
||||||
|
|
@ -438,11 +433,9 @@ static void HU_removeChatText_Log(void)
|
||||||
}
|
}
|
||||||
chat_nummsg_log--; // lost 1 msg.
|
chat_nummsg_log--; // lost 1 msg.
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void HU_AddChatText(const char *text, boolean playsound)
|
void HU_AddChatText(const char *text, boolean playsound)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
if (playsound && cv_consolechat.value != 2) // Don't play the sound if we're using hidden chat.
|
if (playsound && cv_consolechat.value != 2) // Don't play the sound if we're using hidden chat.
|
||||||
S_StartSound(NULL, sfx_radio);
|
S_StartSound(NULL, sfx_radio);
|
||||||
// reguardless of our preferences, put all of this in the chat buffer in case we decide to change from oldchat mid-game.
|
// reguardless of our preferences, put all of this in the chat buffer in case we decide to change from oldchat mid-game.
|
||||||
|
|
@ -464,13 +457,8 @@ void HU_AddChatText(const char *text, boolean playsound)
|
||||||
CONS_Printf("%s\n", text);
|
CONS_Printf("%s\n", text);
|
||||||
else // if we aren't, still save the message to log.txt
|
else // if we aren't, still save the message to log.txt
|
||||||
CON_LogMessage(va("%s\n", text));
|
CON_LogMessage(va("%s\n", text));
|
||||||
#else
|
|
||||||
(void)playsound;
|
|
||||||
CONS_Printf("%s\n", text);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
/** Runs a say command, sending an ::XD_SAY message.
|
/** Runs a say command, sending an ::XD_SAY message.
|
||||||
* A say command consists of a signed 8-bit integer for the target, an
|
* A say command consists of a signed 8-bit integer for the target, an
|
||||||
|
|
@ -997,8 +985,6 @@ static inline boolean HU_keyInChatString(char *s, char ch)
|
||||||
return true; // ate the key
|
return true; // ate the key
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
static void HU_TickSongCredits(void)
|
static void HU_TickSongCredits(void)
|
||||||
|
|
@ -1110,8 +1096,6 @@ void HU_Ticker(void)
|
||||||
HU_TickSongCredits();
|
HU_TickSongCredits();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
static boolean teamtalk = false;
|
static boolean teamtalk = false;
|
||||||
static boolean justscrolleddown;
|
static boolean justscrolleddown;
|
||||||
static boolean justscrolledup;
|
static boolean justscrolledup;
|
||||||
|
|
@ -1222,7 +1206,6 @@ static void HU_sendChatMessage(void)
|
||||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void HU_clearChatChars(void)
|
void HU_clearChatChars(void)
|
||||||
{
|
{
|
||||||
|
|
@ -1263,7 +1246,6 @@ boolean HU_Responder(event_t *ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
if (!chat_on)
|
if (!chat_on)
|
||||||
{
|
{
|
||||||
// enter chat mode
|
// enter chat mode
|
||||||
|
|
@ -1405,7 +1387,6 @@ boolean HU_Responder(event_t *ev)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1414,8 +1395,6 @@ boolean HU_Responder(event_t *ev)
|
||||||
// HEADS UP DRAWING
|
// HEADS UP DRAWING
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
// Precompile a wordwrapped string to any given width.
|
// Precompile a wordwrapped string to any given width.
|
||||||
// This is a muuuch better method than V_WORDWRAP.
|
// This is a muuuch better method than V_WORDWRAP.
|
||||||
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
|
// again stolen and modified a bit from video.c, don't mind me, will need to rearrange this one day.
|
||||||
|
|
@ -2016,7 +1995,6 @@ static void HU_DrawChat_Old(void)
|
||||||
if (hu_tick < 4)
|
if (hu_tick < 4)
|
||||||
V_DrawCharacter(HU_INPUTX + c, y, '_' | cv_constextsize.value |V_NOSCALESTART|t, true);
|
V_DrawCharacter(HU_INPUTX + c, y, '_' | cv_constextsize.value |V_NOSCALESTART|t, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void HU_DrawCEcho(void)
|
static void HU_DrawCEcho(void)
|
||||||
{
|
{
|
||||||
|
|
@ -2142,7 +2120,6 @@ void HU_Drawer(void)
|
||||||
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
|
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
|
||||||
V_DrawVhsEffect(demo.rewinding);
|
V_DrawVhsEffect(demo.rewinding);
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
// draw chat string plus cursor
|
// draw chat string plus cursor
|
||||||
if (chat_on)
|
if (chat_on)
|
||||||
{
|
{
|
||||||
|
|
@ -2159,7 +2136,6 @@ void HU_Drawer(void)
|
||||||
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
|
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
|
||||||
HU_drawMiniChat(); // draw messages in a cool fashion.
|
HU_drawMiniChat(); // draw messages in a cool fashion.
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cechotimer)
|
if (cechotimer)
|
||||||
HU_DrawCEcho();
|
HU_DrawCEcho();
|
||||||
|
|
|
||||||
232
src/i_tcp.c
232
src/i_tcp.c
|
|
@ -38,36 +38,29 @@
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
#if defined (NOMD5) && !defined (NONET)
|
#ifdef USE_WINSOCK1
|
||||||
//#define NONET
|
#include <winsock.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NONET
|
|
||||||
#undef HAVE_MINIUPNPC
|
|
||||||
#else
|
#else
|
||||||
#ifdef USE_WINSOCK1
|
#ifndef USE_WINSOCK
|
||||||
#include <winsock.h>
|
#include <arpa/inet.h>
|
||||||
#else
|
#ifdef __APPLE_CC__
|
||||||
#ifndef USE_WINSOCK
|
#ifndef _BSD_SOCKLEN_T_
|
||||||
#include <arpa/inet.h>
|
#define _BSD_SOCKLEN_T_
|
||||||
#ifdef __APPLE_CC__
|
#endif //_BSD_SOCKLEN_T_
|
||||||
#ifndef _BSD_SOCKLEN_T_
|
#endif //__APPLE_CC__
|
||||||
#define _BSD_SOCKLEN_T_
|
#include <sys/socket.h>
|
||||||
#endif //_BSD_SOCKLEN_T_
|
#include <netinet/in.h>
|
||||||
#endif //__APPLE_CC__
|
#include <netdb.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/ioctl.h>
|
||||||
#include <netinet/in.h>
|
#endif //normal BSD API
|
||||||
#include <netdb.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif //normal BSD API
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif // UNIXCOMMON
|
#endif // UNIXCOMMON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
// some undefined under win32
|
// some undefined under win32
|
||||||
|
|
@ -115,36 +108,34 @@
|
||||||
#endif
|
#endif
|
||||||
#endif // USE_WINSOCK
|
#endif // USE_WINSOCK
|
||||||
|
|
||||||
#ifdef __DJGPP__
|
#ifdef __DJGPP__
|
||||||
#ifdef WATTCP // Alam_GBC: Wattcp may need this
|
#ifdef WATTCP // Alam_GBC: Wattcp may need this
|
||||||
#include <tcp.h>
|
#include <tcp.h>
|
||||||
#define strerror strerror_s
|
#define strerror strerror_s
|
||||||
#else // wattcp
|
#else // wattcp
|
||||||
#include <lsck/lsck.h>
|
#include <lsck/lsck.h>
|
||||||
#endif // libsocket
|
#endif // libsocket
|
||||||
#endif // djgpp
|
#endif // djgpp
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
struct sockaddr any;
|
struct sockaddr any;
|
||||||
struct sockaddr_in ip4;
|
struct sockaddr_in ip4;
|
||||||
#ifdef HAVE_IPV6
|
#ifdef HAVE_IPV6
|
||||||
struct sockaddr_in6 ip6;
|
struct sockaddr_in6 ip6;
|
||||||
|
#endif
|
||||||
|
} mysockaddr_t;
|
||||||
|
|
||||||
|
#ifdef HAVE_MINIUPNPC
|
||||||
|
#ifdef STATIC_MINIUPNPC
|
||||||
|
#define STATICLIB
|
||||||
#endif
|
#endif
|
||||||
} mysockaddr_t;
|
#include "miniupnpc/miniwget.h"
|
||||||
|
#include "miniupnpc/miniupnpc.h"
|
||||||
#ifdef HAVE_MINIUPNPC
|
#include "miniupnpc/upnpcommands.h"
|
||||||
#ifdef STATIC_MINIUPNPC
|
#undef STATICLIB
|
||||||
#define STATICLIB
|
static UINT8 UPNP_support = TRUE;
|
||||||
#endif
|
#endif // HAVE_MINIUPNC
|
||||||
#include "miniupnpc/miniwget.h"
|
|
||||||
#include "miniupnpc/miniupnpc.h"
|
|
||||||
#include "miniupnpc/upnpcommands.h"
|
|
||||||
#undef STATICLIB
|
|
||||||
static UINT8 UPNP_support = TRUE;
|
|
||||||
#endif // HAVE_MINIUPNC
|
|
||||||
|
|
||||||
#endif // !NONET
|
|
||||||
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "i_time.h"
|
#include "i_time.h"
|
||||||
|
|
@ -179,7 +170,7 @@
|
||||||
|
|
||||||
#define DEFAULTPORT "5029"
|
#define DEFAULTPORT "5029"
|
||||||
|
|
||||||
#if defined (USE_WINSOCK) && !defined (NONET)
|
#ifdef USE_WINSOCK
|
||||||
typedef SOCKET SOCKET_TYPE;
|
typedef SOCKET SOCKET_TYPE;
|
||||||
#define ERRSOCKET (SOCKET_ERROR)
|
#define ERRSOCKET (SOCKET_ERROR)
|
||||||
#else
|
#else
|
||||||
|
|
@ -191,33 +182,31 @@
|
||||||
#define ERRSOCKET (-1)
|
#define ERRSOCKET (-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NONET
|
// define socklen_t in DOS/Windows if it is not already defined
|
||||||
// define socklen_t in DOS/Windows if it is not already defined
|
#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1)
|
||||||
#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1)
|
typedef int socklen_t;
|
||||||
typedef int socklen_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
mysockaddr_t address;
|
|
||||||
UINT8 mask;
|
|
||||||
char *username;
|
|
||||||
char *reason;
|
|
||||||
time_t timestamp;
|
|
||||||
} banned_t;
|
|
||||||
|
|
||||||
static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET};
|
|
||||||
static size_t mysocketses = 0;
|
|
||||||
static int myfamily[MAXNETNODES+1] = {0};
|
|
||||||
static SOCKET_TYPE nodesocket[MAXNETNODES+1] = {ERRSOCKET};
|
|
||||||
static mysockaddr_t clientaddress[MAXNETNODES+1];
|
|
||||||
static mysockaddr_t broadcastaddress[MAXNETNODES+1];
|
|
||||||
static size_t broadcastaddresses = 0;
|
|
||||||
static boolean nodeconnected[MAXNETNODES+1];
|
|
||||||
static banned_t *banned;
|
|
||||||
static const INT32 hole_punch_magic = MSBF_LONG (0x52eb11);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
mysockaddr_t address;
|
||||||
|
UINT8 mask;
|
||||||
|
char *username;
|
||||||
|
char *reason;
|
||||||
|
time_t timestamp;
|
||||||
|
} banned_t;
|
||||||
|
|
||||||
|
static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET};
|
||||||
|
static size_t mysocketses = 0;
|
||||||
|
static int myfamily[MAXNETNODES+1] = {0};
|
||||||
|
static SOCKET_TYPE nodesocket[MAXNETNODES+1] = {ERRSOCKET};
|
||||||
|
static mysockaddr_t clientaddress[MAXNETNODES+1];
|
||||||
|
static mysockaddr_t broadcastaddress[MAXNETNODES+1];
|
||||||
|
static size_t broadcastaddresses = 0;
|
||||||
|
static boolean nodeconnected[MAXNETNODES+1];
|
||||||
|
static banned_t *banned;
|
||||||
|
static const INT32 hole_punch_magic = MSBF_LONG (0x52eb11);
|
||||||
|
|
||||||
static size_t numbans = 0;
|
static size_t numbans = 0;
|
||||||
static size_t banned_size = 0;
|
static size_t banned_size = 0;
|
||||||
|
|
||||||
|
|
@ -227,8 +216,6 @@ static boolean init_tcp_driver = false;
|
||||||
static const char *serverport_name = DEFAULTPORT;
|
static const char *serverport_name = DEFAULTPORT;
|
||||||
static const char *clientport_name;/* any port */
|
static const char *clientport_name;/* any port */
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
#ifdef WATTCP
|
#ifdef WATTCP
|
||||||
static void wattcp_outch(char s)
|
static void wattcp_outch(char s)
|
||||||
{
|
{
|
||||||
|
|
@ -427,83 +414,54 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
||||||
#endif
|
#endif
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *SOCK_GetNodeAddress(INT32 node)
|
static const char *SOCK_GetNodeAddress(INT32 node)
|
||||||
{
|
{
|
||||||
if (node == 0)
|
if (node == 0)
|
||||||
return "self";
|
return "self";
|
||||||
#ifdef NONET
|
|
||||||
return NULL;
|
|
||||||
#else
|
|
||||||
if (!nodeconnected[node])
|
if (!nodeconnected[node])
|
||||||
return NULL;
|
return NULL;
|
||||||
return SOCK_AddrToStr(&clientaddress[node]);
|
return SOCK_AddrToStr(&clientaddress[node]);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *SOCK_GetBanAddress(size_t ban)
|
static const char *SOCK_GetBanAddress(size_t ban)
|
||||||
{
|
{
|
||||||
if (ban >= numbans)
|
if (ban >= numbans)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef NONET
|
|
||||||
return NULL;
|
|
||||||
#else
|
|
||||||
return SOCK_AddrToStr(&banned[ban].address);
|
return SOCK_AddrToStr(&banned[ban].address);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *SOCK_GetBanMask(size_t ban)
|
static const char *SOCK_GetBanMask(size_t ban)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)ban;
|
|
||||||
#else
|
|
||||||
static char s[16]; //255.255.255.255 netmask? no, just CDIR for only
|
static char s[16]; //255.255.255.255 netmask? no, just CDIR for only
|
||||||
if (ban >= numbans)
|
if (ban >= numbans)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (sprintf(s,"%d",banned[ban].mask) > 0)
|
if (sprintf(s,"%d",banned[ban].mask) > 0)
|
||||||
return s;
|
return s;
|
||||||
#endif
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *SOCK_GetBanUsername(size_t ban)
|
static const char *SOCK_GetBanUsername(size_t ban)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)ban;
|
|
||||||
return NULL;
|
|
||||||
#else
|
|
||||||
if (ban >= numbans)
|
if (ban >= numbans)
|
||||||
return NULL;
|
return NULL;
|
||||||
return banned[ban].username;
|
return banned[ban].username;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *SOCK_GetBanReason(size_t ban)
|
static const char *SOCK_GetBanReason(size_t ban)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)ban;
|
|
||||||
return NULL;
|
|
||||||
#else
|
|
||||||
if (ban >= numbans)
|
if (ban >= numbans)
|
||||||
return NULL;
|
return NULL;
|
||||||
return banned[ban].reason;
|
return banned[ban].reason;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static time_t SOCK_GetUnbanTime(size_t ban)
|
static time_t SOCK_GetUnbanTime(size_t ban)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)ban;
|
|
||||||
return NO_BAN_TIME;
|
|
||||||
#else
|
|
||||||
if (ban >= numbans)
|
if (ban >= numbans)
|
||||||
return NO_BAN_TIME;
|
return NO_BAN_TIME;
|
||||||
return banned[ban].timestamp;
|
return banned[ban].timestamp;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||||
{
|
{
|
||||||
UINT32 bitmask = INADDR_NONE;
|
UINT32 bitmask = INADDR_NONE;
|
||||||
|
|
@ -607,9 +565,7 @@ void Command_Numnodes(void)
|
||||||
connected, ingame);
|
connected, ingame);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static boolean hole_punch(ssize_t c)
|
static boolean hole_punch(ssize_t c)
|
||||||
{
|
{
|
||||||
if (c == 10 && holepunchpacket->magic == hole_punch_magic)
|
if (c == 10 && holepunchpacket->magic == hole_punch_magic)
|
||||||
|
|
@ -731,10 +687,8 @@ static boolean SOCK_Get(void)
|
||||||
doomcom->remotenode = -1; // no packet
|
doomcom->remotenode = -1; // no packet
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// check if we can send (do not go over the buffer)
|
// check if we can send (do not go over the buffer)
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
static fd_set masterset;
|
static fd_set masterset;
|
||||||
|
|
||||||
|
|
@ -784,9 +738,7 @@ static boolean SOCK_CanGet(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||||
{
|
{
|
||||||
socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
|
socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
|
||||||
|
|
@ -857,9 +809,7 @@ static void SOCK_Send(void)
|
||||||
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
#undef ALLOWEDERROR
|
#undef ALLOWEDERROR
|
||||||
|
|
||||||
static void SOCK_FreeNodenum(INT32 numnode)
|
static void SOCK_FreeNodenum(INT32 numnode)
|
||||||
|
|
@ -876,12 +826,10 @@ static void SOCK_FreeNodenum(INT32 numnode)
|
||||||
// put invalid address
|
// put invalid address
|
||||||
memset(&clientaddress[numnode], 0, sizeof (clientaddress[numnode]));
|
memset(&clientaddress[numnode], 0, sizeof (clientaddress[numnode]));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// UDPsocket
|
// UDPsocket
|
||||||
//
|
//
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
// allocate a socket
|
// allocate a socket
|
||||||
static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen)
|
static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen)
|
||||||
|
|
@ -1206,12 +1154,10 @@ static boolean UDP_Socket(void)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
boolean I_InitTcpDriver(void)
|
boolean I_InitTcpDriver(void)
|
||||||
{
|
{
|
||||||
boolean tcp_was_up = init_tcp_driver;
|
boolean tcp_was_up = init_tcp_driver;
|
||||||
#ifndef NONET
|
|
||||||
if (!init_tcp_driver)
|
if (!init_tcp_driver)
|
||||||
{
|
{
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
|
|
@ -1320,7 +1266,6 @@ boolean I_InitTcpDriver(void)
|
||||||
init_tcp_driver = true;
|
init_tcp_driver = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (!tcp_was_up && init_tcp_driver)
|
if (!tcp_was_up && init_tcp_driver)
|
||||||
{
|
{
|
||||||
I_AddExitFunc(I_ShutdownTcpDriver);
|
I_AddExitFunc(I_ShutdownTcpDriver);
|
||||||
|
|
@ -1334,7 +1279,6 @@ boolean I_InitTcpDriver(void)
|
||||||
return init_tcp_driver;
|
return init_tcp_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void SOCK_CloseSocket(void)
|
static void SOCK_CloseSocket(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
@ -1351,11 +1295,9 @@ static void SOCK_CloseSocket(void)
|
||||||
mysockets[i] = ERRSOCKET;
|
mysockets[i] = ERRSOCKET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void I_ShutdownTcpDriver(void)
|
void I_ShutdownTcpDriver(void)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
SOCK_CloseSocket();
|
SOCK_CloseSocket();
|
||||||
|
|
||||||
CONS_Printf("I_ShutdownTcpDriver: ");
|
CONS_Printf("I_ShutdownTcpDriver: ");
|
||||||
|
|
@ -1373,10 +1315,8 @@ void I_ShutdownTcpDriver(void)
|
||||||
#endif // __DJGPP__
|
#endif // __DJGPP__
|
||||||
CONS_Printf("shut down\n");
|
CONS_Printf("shut down\n");
|
||||||
init_tcp_driver = false;
|
init_tcp_driver = false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
||||||
{
|
{
|
||||||
struct my_addrinfo *ai = NULL, *runp, hints;
|
struct my_addrinfo *ai = NULL, *runp, hints;
|
||||||
|
|
@ -1489,11 +1429,9 @@ static void SOCK_RegisterHolePunch(void)
|
||||||
{
|
{
|
||||||
rendezvous(4);
|
rendezvous(4);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static boolean SOCK_OpenSocket(void)
|
static boolean SOCK_OpenSocket(void)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
memset(clientaddress, 0, sizeof (clientaddress));
|
memset(clientaddress, 0, sizeof (clientaddress));
|
||||||
|
|
@ -1520,9 +1458,6 @@ static boolean SOCK_OpenSocket(void)
|
||||||
// build the socket but close it first
|
// build the socket but close it first
|
||||||
SOCK_CloseSocket();
|
SOCK_CloseSocket();
|
||||||
return UDP_Socket();
|
return UDP_Socket();
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddBannedIndex(void)
|
static void AddBannedIndex(void)
|
||||||
|
|
@ -1557,11 +1492,6 @@ static boolean SOCK_Ban(INT32 node)
|
||||||
if (node > MAXNETNODES)
|
if (node > MAXNETNODES)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef NONET
|
|
||||||
(void)ban;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
|
|
||||||
ban = numbans;
|
ban = numbans;
|
||||||
AddBannedIndex();
|
AddBannedIndex();
|
||||||
|
|
||||||
|
|
@ -1581,15 +1511,10 @@ static boolean SOCK_Ban(INT32 node)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean SOCK_SetBanUsername(const char *username)
|
static boolean SOCK_SetBanUsername(const char *username)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)username;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
if (username == NULL || strlen(username) == 0)
|
if (username == NULL || strlen(username) == 0)
|
||||||
{
|
{
|
||||||
username = "Direct IP ban";
|
username = "Direct IP ban";
|
||||||
|
|
@ -1603,15 +1528,10 @@ static boolean SOCK_SetBanUsername(const char *username)
|
||||||
|
|
||||||
banned[numbans - 1].username = Z_StrDup(username);
|
banned[numbans - 1].username = Z_StrDup(username);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean SOCK_SetBanReason(const char *reason)
|
static boolean SOCK_SetBanReason(const char *reason)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)reason;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
if (reason == NULL || strlen(reason) == 0)
|
if (reason == NULL || strlen(reason) == 0)
|
||||||
{
|
{
|
||||||
reason = "No reason given";
|
reason = "No reason given";
|
||||||
|
|
@ -1625,27 +1545,16 @@ static boolean SOCK_SetBanReason(const char *reason)
|
||||||
|
|
||||||
banned[numbans - 1].reason = Z_StrDup(reason);
|
banned[numbans - 1].reason = Z_StrDup(reason);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean SOCK_SetUnbanTime(time_t timestamp)
|
static boolean SOCK_SetUnbanTime(time_t timestamp)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)reason;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
banned[numbans - 1].timestamp = timestamp;
|
banned[numbans - 1].timestamp = timestamp;
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
||||||
{
|
{
|
||||||
#ifdef NONET
|
|
||||||
(void)address;
|
|
||||||
(void)mask;
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
struct my_addrinfo *ai, *runp, hints;
|
struct my_addrinfo *ai, *runp, hints;
|
||||||
int gaie;
|
int gaie;
|
||||||
|
|
||||||
|
|
@ -1706,7 +1615,6 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
||||||
I_freeaddrinfo(ai);
|
I_freeaddrinfo(ai);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SOCK_ClearBans(void)
|
static void SOCK_ClearBans(void)
|
||||||
|
|
|
||||||
67
src/m_menu.c
67
src/m_menu.c
|
|
@ -107,10 +107,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||||
#define SLIDER_WIDTH (8*SLIDER_RANGE+6)
|
#define SLIDER_WIDTH (8*SLIDER_RANGE+6)
|
||||||
#define SERVERS_PER_PAGE 11
|
#define SERVERS_PER_PAGE 11
|
||||||
|
|
||||||
#if defined (NONET)
|
|
||||||
#define NOMENUHOST
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
QUITMSG = 0,
|
QUITMSG = 0,
|
||||||
|
|
@ -170,9 +166,7 @@ levellist_mode_t levellistmode = LLM_CREATESERVER;
|
||||||
UINT8 maplistoption = 0;
|
UINT8 maplistoption = 0;
|
||||||
|
|
||||||
static char joystickInfo[8][29];
|
static char joystickInfo[8][29];
|
||||||
#ifndef NONET
|
|
||||||
static UINT32 serverlistpage;
|
static UINT32 serverlistpage;
|
||||||
#endif
|
|
||||||
|
|
||||||
//static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games.
|
//static saveinfo_t savegameinfo[MAXSAVEGAMES]; // Extra info about the save games.
|
||||||
|
|
||||||
|
|
@ -198,9 +192,7 @@ static INT32 vidm_column_size;
|
||||||
|
|
||||||
static void M_StopMessage(INT32 choice);
|
static void M_StopMessage(INT32 choice);
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void M_HandleServerPage(INT32 choice);
|
static void M_HandleServerPage(INT32 choice);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Prototyping is fun, innit?
|
// Prototyping is fun, innit?
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
@ -277,13 +269,11 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef;
|
||||||
//static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef;
|
//static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef;
|
||||||
|
|
||||||
// Multiplayer
|
// Multiplayer
|
||||||
#ifndef NONET
|
|
||||||
static void M_StartServerMenu(INT32 choice);
|
static void M_StartServerMenu(INT32 choice);
|
||||||
static void M_ConnectMenu(INT32 choice);
|
static void M_ConnectMenu(INT32 choice);
|
||||||
static void M_ConnectMenuModChecks(INT32 choice);
|
static void M_ConnectMenuModChecks(INT32 choice);
|
||||||
static void M_Refresh(INT32 choice);
|
static void M_Refresh(INT32 choice);
|
||||||
static void M_Connect(INT32 choice);
|
static void M_Connect(INT32 choice);
|
||||||
#endif
|
|
||||||
static void M_StartOfflineServerMenu(INT32 choice);
|
static void M_StartOfflineServerMenu(INT32 choice);
|
||||||
static void M_StartServer(INT32 choice);
|
static void M_StartServer(INT32 choice);
|
||||||
static void M_SetupMultiPlayer(INT32 choice);
|
static void M_SetupMultiPlayer(INT32 choice);
|
||||||
|
|
@ -329,9 +319,7 @@ menu_t OP_DiscordOptionsDef;
|
||||||
#endif
|
#endif
|
||||||
menu_t OP_HUDOptionsDef, OP_ChatOptionsDef;
|
menu_t OP_HUDOptionsDef, OP_ChatOptionsDef;
|
||||||
menu_t OP_GameOptionsDef, OP_ServerOptionsDef;
|
menu_t OP_GameOptionsDef, OP_ServerOptionsDef;
|
||||||
#ifndef NONET
|
|
||||||
menu_t OP_AdvServerOptionsDef;
|
menu_t OP_AdvServerOptionsDef;
|
||||||
#endif
|
|
||||||
//menu_t OP_NetgameOptionsDef, OP_GametypeOptionsDef;
|
//menu_t OP_NetgameOptionsDef, OP_GametypeOptionsDef;
|
||||||
menu_t OP_MonitorToggleDef;
|
menu_t OP_MonitorToggleDef;
|
||||||
static void M_ScreenshotOptions(INT32 choice);
|
static void M_ScreenshotOptions(INT32 choice);
|
||||||
|
|
@ -387,16 +375,12 @@ static void M_DrawHUDOptions(void);
|
||||||
static void M_DrawVideoMode(void);
|
static void M_DrawVideoMode(void);
|
||||||
static void M_DrawMonitorToggles(void);
|
static void M_DrawMonitorToggles(void);
|
||||||
static void M_DrawMPMainMenu(void);
|
static void M_DrawMPMainMenu(void);
|
||||||
#ifndef NONET
|
|
||||||
static void M_DrawConnectMenu(void);
|
static void M_DrawConnectMenu(void);
|
||||||
#endif
|
|
||||||
static void M_DrawJoystick(void);
|
static void M_DrawJoystick(void);
|
||||||
static void M_DrawSetupMultiPlayerMenu(void);
|
static void M_DrawSetupMultiPlayerMenu(void);
|
||||||
|
|
||||||
// Handling functions
|
// Handling functions
|
||||||
#ifndef NONET
|
|
||||||
static boolean M_CancelConnect(void);
|
static boolean M_CancelConnect(void);
|
||||||
#endif
|
|
||||||
static boolean M_ExitPandorasBox(void);
|
static boolean M_ExitPandorasBox(void);
|
||||||
static boolean M_QuitMultiPlayerMenu(void);
|
static boolean M_QuitMultiPlayerMenu(void);
|
||||||
static void M_HandleAddons(INT32 choice);
|
static void M_HandleAddons(INT32 choice);
|
||||||
|
|
@ -404,9 +388,7 @@ static void M_HandleSoundTest(INT32 choice);
|
||||||
static void M_HandleImageDef(INT32 choice);
|
static void M_HandleImageDef(INT32 choice);
|
||||||
//static void M_HandleLoadSave(INT32 choice);
|
//static void M_HandleLoadSave(INT32 choice);
|
||||||
static void M_HandleLevelStats(INT32 choice);
|
static void M_HandleLevelStats(INT32 choice);
|
||||||
#ifndef NONET
|
|
||||||
static void M_HandleConnectIP(INT32 choice);
|
static void M_HandleConnectIP(INT32 choice);
|
||||||
#endif
|
|
||||||
static void M_HandleSetupMultiPlayer(INT32 choice);
|
static void M_HandleSetupMultiPlayer(INT32 choice);
|
||||||
static void M_HandleVideoMode(INT32 choice);
|
static void M_HandleVideoMode(INT32 choice);
|
||||||
static void M_HandleMonitorToggles(INT32 choice);
|
static void M_HandleMonitorToggles(INT32 choice);
|
||||||
|
|
@ -1014,27 +996,16 @@ static menuitem_t MP_MainMenu[] =
|
||||||
{IT_STRING|IT_KEYHANDLER,NULL, "Player setup...", {.routine = M_SetupMultiHandler}, 18},
|
{IT_STRING|IT_KEYHANDLER,NULL, "Player setup...", {.routine = M_SetupMultiHandler}, 18},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Host a game", {NULL}, 100-24},
|
{IT_HEADER, NULL, "Host a game", {NULL}, 100-24},
|
||||||
#ifndef NOMENUHOST
|
|
||||||
{IT_STRING|IT_CALL, NULL, "Internet/LAN...", {.routine = M_StartServerMenu}, 110-24},
|
{IT_STRING|IT_CALL, NULL, "Internet/LAN...", {.routine = M_StartServerMenu}, 110-24},
|
||||||
#else
|
|
||||||
{IT_GRAYEDOUT, NULL, "Internet/LAN...", {NULL}, 110-24},
|
|
||||||
#endif
|
|
||||||
{IT_STRING|IT_CALL, NULL, "Offline...", {.routine = M_StartOfflineServerMenu}, 118-24},
|
{IT_STRING|IT_CALL, NULL, "Offline...", {.routine = M_StartOfflineServerMenu}, 118-24},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Join a game", {NULL}, 132-24},
|
{IT_HEADER, NULL, "Join a game", {NULL}, 132-24},
|
||||||
#ifndef NONET
|
|
||||||
{IT_STRING|IT_CALL, NULL, "Internet server browser...",{.routine = M_ConnectMenuModChecks}, 142-24},
|
{IT_STRING|IT_CALL, NULL, "Internet server browser...",{.routine = M_ConnectMenuModChecks}, 142-24},
|
||||||
{IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", {.routine = M_HandleConnectIP}, 150-24},
|
{IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", {.routine = M_HandleConnectIP}, 150-24},
|
||||||
#else
|
|
||||||
{IT_GRAYEDOUT, NULL, "Internet server browser...", {NULL}, 142-24},
|
|
||||||
{IT_GRAYEDOUT, NULL, "Specify IPv4 address:", {NULL}, 150-24},
|
|
||||||
#endif
|
|
||||||
//{IT_HEADER, NULL, "Player setup", NULL, 80},
|
//{IT_HEADER, NULL, "Player setup", NULL, 80},
|
||||||
//{IT_STRING|IT_CALL, NULL, "Name, character, color...", M_SetupMultiPlayer, 90},
|
//{IT_STRING|IT_CALL, NULL, "Name, character, color...", M_SetupMultiPlayer, 90},
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
static menuitem_t MP_ServerMenu[] =
|
static menuitem_t MP_ServerMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING|IT_CVAR, NULL, "Max. Player Count", {.cvar = &cv_maxplayers}, 10},
|
{IT_STRING|IT_CVAR, NULL, "Max. Player Count", {.cvar = &cv_maxplayers}, 10},
|
||||||
|
|
@ -1047,8 +1018,6 @@ static menuitem_t MP_ServerMenu[] =
|
||||||
{IT_WHITESTRING|IT_CALL, NULL, "Start", {.routine = M_StartServer}, 130},
|
{IT_WHITESTRING|IT_CALL, NULL, "Start", {.routine = M_StartServer}, 130},
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Separated offline and normal servers.
|
// Separated offline and normal servers.
|
||||||
static menuitem_t MP_OfflineServerMenu[] =
|
static menuitem_t MP_OfflineServerMenu[] =
|
||||||
{
|
{
|
||||||
|
|
@ -1066,7 +1035,6 @@ static menuitem_t MP_PlayerSetupMenu[] =
|
||||||
{IT_KEYHANDLER | IT_STRING, NULL, "Color", {.routine = M_HandleSetupMultiPlayer}, 152},
|
{IT_KEYHANDLER | IT_STRING, NULL, "Color", {.routine = M_HandleSetupMultiPlayer}, 152},
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static menuitem_t MP_ConnectMenu[] =
|
static menuitem_t MP_ConnectMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING | IT_CVAR, NULL, "Sort By", {.cvar = &cv_serversort}, 4},
|
{IT_STRING | IT_CVAR, NULL, "Sort By", {.cvar = &cv_serversort}, 4},
|
||||||
|
|
@ -1093,7 +1061,6 @@ enum
|
||||||
mp_connect_refresh,
|
mp_connect_refresh,
|
||||||
FIRSTSERVERLINE
|
FIRSTSERVERLINE
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Options and most (?) of its submenus
|
// Options and most (?) of its submenus
|
||||||
|
|
@ -1502,17 +1469,14 @@ static menuitem_t OP_GameOptionsMenu[] =
|
||||||
|
|
||||||
static menuitem_t OP_ServerOptionsMenu[] =
|
static menuitem_t OP_ServerOptionsMenu[] =
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
{IT_STRING | IT_CVAR | IT_CV_STRING,
|
{IT_STRING | IT_CVAR | IT_CV_STRING,
|
||||||
NULL, "Server Name", {.cvar = &cv_servername}, 10},
|
NULL, "Server Name", {.cvar = &cv_servername}, 10},
|
||||||
#endif
|
|
||||||
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", {.cvar = &cv_inttime}, 40},
|
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", {.cvar = &cv_inttime}, 40},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Map Progression", {.cvar = &cv_advancemap}, 50},
|
{IT_STRING | IT_CVAR, NULL, "Map Progression", {.cvar = &cv_advancemap}, 50},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Voting Timer", {.cvar = &cv_votetime}, 60},
|
{IT_STRING | IT_CVAR, NULL, "Voting Timer", {.cvar = &cv_votetime}, 60},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Voting Rule Changes", {.cvar = &cv_kartvoterulechanges}, 70},
|
{IT_STRING | IT_CVAR, NULL, "Voting Rule Changes", {.cvar = &cv_kartvoterulechanges}, 70},
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", {.cvar = &cv_maxplayers}, 90},
|
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", {.cvar = &cv_maxplayers}, 90},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Allow Players to Join", {.cvar = &cv_allownewplayer}, 100},
|
{IT_STRING | IT_CVAR, NULL, "Allow Players to Join", {.cvar = &cv_allownewplayer}, 100},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Allow Addon Downloading", {.cvar = &cv_downloading}, 110},
|
{IT_STRING | IT_CVAR, NULL, "Allow Addon Downloading", {.cvar = &cv_downloading}, 110},
|
||||||
|
|
@ -1520,10 +1484,8 @@ static menuitem_t OP_ServerOptionsMenu[] =
|
||||||
{IT_STRING | IT_CVAR, NULL, "Mute All Chat", {.cvar = &cv_mute}, 130},
|
{IT_STRING | IT_CVAR, NULL, "Mute All Chat", {.cvar = &cv_mute}, 130},
|
||||||
|
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Advanced Options...", {.submenu = &OP_AdvServerOptionsDef}, 150},
|
{IT_SUBMENU|IT_STRING, NULL, "Advanced Options...", {.submenu = &OP_AdvServerOptionsDef}, 150},
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static menuitem_t OP_AdvServerOptionsMenu[] =
|
static menuitem_t OP_AdvServerOptionsMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING | IT_CVAR | IT_CV_STRING,
|
{IT_STRING | IT_CVAR | IT_CV_STRING,
|
||||||
|
|
@ -1542,7 +1504,6 @@ static menuitem_t OP_AdvServerOptionsMenu[] =
|
||||||
{IT_STRING | IT_CVAR, NULL, "Log resyncs", {.cvar = &cv_blamecfail}, 140},
|
{IT_STRING | IT_CVAR, NULL, "Log resyncs", {.cvar = &cv_blamecfail}, 140},
|
||||||
{IT_STRING | IT_CVAR, NULL, "Log file transfers", {.cvar = &cv_noticedownload}, 150},
|
{IT_STRING | IT_CVAR, NULL, "Log file transfers", {.cvar = &cv_noticedownload}, 150},
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
/*static menuitem_t OP_NetgameOptionsMenu[] =
|
/*static menuitem_t OP_NetgameOptionsMenu[] =
|
||||||
{
|
{
|
||||||
|
|
@ -1949,16 +1910,11 @@ menu_t MP_MainDef =
|
||||||
M_DrawMPMainMenu,
|
M_DrawMPMainMenu,
|
||||||
42, 30,
|
42, 30,
|
||||||
0,
|
0,
|
||||||
#ifndef NONET
|
|
||||||
M_CancelConnect
|
M_CancelConnect
|
||||||
#else
|
|
||||||
NULL
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
menu_t MP_OfflineServerDef = MAPICONMENUSTYLE("M_MULTI", MP_OfflineServerMenu, &MP_MainDef);
|
menu_t MP_OfflineServerDef = MAPICONMENUSTYLE("M_MULTI", MP_OfflineServerMenu, &MP_MainDef);
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
menu_t MP_ServerDef = MAPICONMENUSTYLE("M_MULTI", MP_ServerMenu, &MP_MainDef);
|
menu_t MP_ServerDef = MAPICONMENUSTYLE("M_MULTI", MP_ServerMenu, &MP_MainDef);
|
||||||
|
|
||||||
menu_t MP_ConnectDef =
|
menu_t MP_ConnectDef =
|
||||||
|
|
@ -1973,7 +1929,7 @@ menu_t MP_ConnectDef =
|
||||||
0,
|
0,
|
||||||
M_CancelConnect
|
M_CancelConnect
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
menu_t MP_PlayerSetupDef =
|
menu_t MP_PlayerSetupDef =
|
||||||
{
|
{
|
||||||
MN_NONE,
|
MN_NONE,
|
||||||
|
|
@ -2076,9 +2032,7 @@ menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_HUD", OP_ChatOptionsMenu
|
||||||
|
|
||||||
menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30);
|
menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30);
|
||||||
menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 30);
|
menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 30);
|
||||||
#ifndef NONET
|
|
||||||
menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30);
|
menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30);
|
||||||
#endif
|
|
||||||
|
|
||||||
//menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30);
|
//menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30);
|
||||||
//menu_t OP_GametypeOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_GametypeOptionsMenu, &OP_ServerOptionsDef, 30, 30);
|
//menu_t OP_GametypeOptionsDef = DEFAULTMENUSTYLE(MN_NONE, "M_SERVER", OP_GametypeOptionsMenu, &OP_ServerOptionsDef, 30, 30);
|
||||||
|
|
@ -2467,14 +2421,12 @@ static void M_ChangeCvar(INT32 choice)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
if (cv == &cv_nettimeout || cv == &cv_jointimeout)
|
if (cv == &cv_nettimeout || cv == &cv_jointimeout)
|
||||||
choice *= (TICRATE/7);
|
choice *= (TICRATE/7);
|
||||||
else if (cv == &cv_maxsend)
|
else if (cv == &cv_maxsend)
|
||||||
choice *= 512;
|
choice *= 512;
|
||||||
else if (cv == &cv_maxping)
|
else if (cv == &cv_maxping)
|
||||||
choice *= 50;
|
choice *= 50;
|
||||||
#endif
|
|
||||||
CV_AddValue(cv,choice);
|
CV_AddValue(cv,choice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3620,9 +3572,7 @@ void M_Init(void)
|
||||||
PlayerMenu[i].alphaKey = 0;
|
PlayerMenu[i].alphaKey = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
CV_RegisterVar(&cv_serversort);
|
CV_RegisterVar(&cv_serversort);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_InitCharacterTables(void)
|
void M_InitCharacterTables(void)
|
||||||
|
|
@ -8561,7 +8511,6 @@ Fetch_servers_thread (int *id)
|
||||||
|
|
||||||
#define S_LINEY(n) currentMenu->y + SERVERHEADERHEIGHT + (n * SERVERLINEHEIGHT)
|
#define S_LINEY(n) currentMenu->y + SERVERHEADERHEIGHT + (n * SERVERLINEHEIGHT)
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static UINT32 localservercount;
|
static UINT32 localservercount;
|
||||||
|
|
||||||
static void M_HandleServerPage(INT32 choice)
|
static void M_HandleServerPage(INT32 choice)
|
||||||
|
|
@ -8786,11 +8735,9 @@ static int ServerListEntryComparator_modified(const void *entry1, const void *en
|
||||||
// Default to strcmp.
|
// Default to strcmp.
|
||||||
return strcmp(sa->info.servername, sb->info.servername);
|
return strcmp(sa->info.servername, sb->info.servername);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void M_SortServerList(void)
|
void M_SortServerList(void)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
switch(cv_serversort.value)
|
switch(cv_serversort.value)
|
||||||
{
|
{
|
||||||
case 0: // Ping.
|
case 0: // Ping.
|
||||||
|
|
@ -8812,10 +8759,8 @@ void M_SortServerList(void)
|
||||||
qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_gametypename);
|
qs22j(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_gametypename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
static void M_CheckMODVersion(int id)
|
static void M_CheckMODVersion(int id)
|
||||||
{
|
{
|
||||||
|
|
@ -8908,7 +8853,6 @@ static void M_ConnectMenuModChecks(INT32 choice)
|
||||||
|
|
||||||
M_ConnectMenu(-1);
|
M_ConnectMenu(-1);
|
||||||
}
|
}
|
||||||
#endif //NONET
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Start Server Menu
|
// Start Server Menu
|
||||||
|
|
@ -9114,7 +9058,6 @@ static void M_StartOfflineServerMenu(INT32 choice)
|
||||||
M_SetupNextMenu(&MP_OfflineServerDef);
|
M_SetupNextMenu(&MP_OfflineServerDef);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void M_StartServerMenu(INT32 choice)
|
static void M_StartServerMenu(INT32 choice)
|
||||||
{
|
{
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
@ -9129,7 +9072,6 @@ static void M_StartServerMenu(INT32 choice)
|
||||||
// ==============
|
// ==============
|
||||||
|
|
||||||
static char setupm_ip[28];
|
static char setupm_ip[28];
|
||||||
#endif
|
|
||||||
static UINT8 setupm_pselect = 1;
|
static UINT8 setupm_pselect = 1;
|
||||||
|
|
||||||
// Draw the funky Connect IP menu. Tails 11-19-2002
|
// Draw the funky Connect IP menu. Tails 11-19-2002
|
||||||
|
|
@ -9142,20 +9084,17 @@ static void M_DrawMPMainMenu(void)
|
||||||
// use generic drawer for cursor, items and title
|
// use generic drawer for cursor, items and title
|
||||||
M_DrawGenericMenu();
|
M_DrawGenericMenu();
|
||||||
|
|
||||||
#ifndef NOMENUHOST
|
|
||||||
#if MAXPLAYERS != 16
|
#if MAXPLAYERS != 16
|
||||||
Update the maxplayers label...
|
Update the maxplayers label...
|
||||||
#endif
|
#endif
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[4].alphaKey,
|
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[4].alphaKey,
|
||||||
((itemOn == 4) ? highlightflags : 0), "(2-16 players)");
|
((itemOn == 4) ? highlightflags : 0), "(2-16 players)");
|
||||||
#endif
|
|
||||||
|
|
||||||
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[5].alphaKey,
|
V_DrawRightAlignedString(BASEVIDWIDTH-x, y+MP_MainMenu[5].alphaKey,
|
||||||
((itemOn == 5) ? highlightflags : 0),
|
((itemOn == 5) ? highlightflags : 0),
|
||||||
"(2-4 players)"
|
"(2-4 players)"
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
y += MP_MainMenu[8].alphaKey;
|
y += MP_MainMenu[8].alphaKey;
|
||||||
|
|
||||||
V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 159);
|
V_DrawFill(x+5, y+4+5, /*16*8 + 6,*/ BASEVIDWIDTH - 2*(x+5), 8+6, 159);
|
||||||
|
|
@ -9167,7 +9106,6 @@ Update the maxplayers label...
|
||||||
if (itemOn == 8
|
if (itemOn == 8
|
||||||
&& skullAnimCounter < 4) //blink cursor
|
&& skullAnimCounter < 4) //blink cursor
|
||||||
V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_ALLOWLOWERCASE),y+12,'_',false);
|
V_DrawCharacter(x+8+V_StringWidth(setupm_ip, V_ALLOWLOWERCASE),y+12,'_',false);
|
||||||
#endif
|
|
||||||
|
|
||||||
// character bar, ripped off the color bar :V
|
// character bar, ripped off the color bar :V
|
||||||
{
|
{
|
||||||
|
|
@ -9291,8 +9229,6 @@ static void M_SetupMultiHandler(INT32 choice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
|
|
||||||
// Tails 11-19-2002
|
// Tails 11-19-2002
|
||||||
static void M_ConnectIP(INT32 choice)
|
static void M_ConnectIP(INT32 choice)
|
||||||
{
|
{
|
||||||
|
|
@ -9392,7 +9328,6 @@ static void M_HandleConnectIP(INT32 choice)
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //!NONET
|
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
// MULTIPLAYER PLAYER SETUP
|
// MULTIPLAYER PLAYER SETUP
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,7 @@ static I_cond MSCond;
|
||||||
# define Unlock_state()
|
# define Unlock_state()
|
||||||
#endif/*HAVE_THREADS*/
|
#endif/*HAVE_THREADS*/
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
static void Command_Listserv_f(void);
|
static void Command_Listserv_f(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif/*MASTERSERVER*/
|
#endif/*MASTERSERVER*/
|
||||||
|
|
||||||
|
|
@ -93,7 +91,6 @@ UINT16 current_port = 0;
|
||||||
*/
|
*/
|
||||||
void AddMServCommands(void)
|
void AddMServCommands(void)
|
||||||
{
|
{
|
||||||
#ifndef NONET
|
|
||||||
CV_RegisterVar(&cv_masterserver);
|
CV_RegisterVar(&cv_masterserver);
|
||||||
CV_RegisterVar(&cv_masterserver_update_rate);
|
CV_RegisterVar(&cv_masterserver_update_rate);
|
||||||
CV_RegisterVar(&cv_masterserver_timeout);
|
CV_RegisterVar(&cv_masterserver_timeout);
|
||||||
|
|
@ -107,7 +104,6 @@ void AddMServCommands(void)
|
||||||
COM_AddCommand("listserv", Command_Listserv_f);
|
COM_AddCommand("listserv", Command_Listserv_f);
|
||||||
COM_AddCommand("masterserver_update", Update_parameters); // allows people to updates manually in case you were delisted by accident
|
COM_AddCommand("masterserver_update", Update_parameters); // allows people to updates manually in case you were delisted by accident
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
|
|
@ -176,7 +172,6 @@ char *GetMODVersion(int id)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NONET
|
|
||||||
/** Gets a list of game servers. Called from console.
|
/** Gets a list of game servers. Called from console.
|
||||||
*/
|
*/
|
||||||
static void Command_Listserv_f(void)
|
static void Command_Listserv_f(void)
|
||||||
|
|
@ -187,7 +182,6 @@ static void Command_Listserv_f(void)
|
||||||
HMS_list_servers();
|
HMS_list_servers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Finish_registration (void)
|
Finish_registration (void)
|
||||||
|
|
|
||||||
|
|
@ -1984,9 +1984,7 @@ void I_Quit(void)
|
||||||
SDLforceUngrabMouse();
|
SDLforceUngrabMouse();
|
||||||
quiting = SDL_FALSE;
|
quiting = SDL_FALSE;
|
||||||
M_SaveConfig(NULL); //save game config, cvars..
|
M_SaveConfig(NULL); //save game config, cvars..
|
||||||
#ifndef NONET
|
|
||||||
D_SaveBan(); // save the ban list
|
D_SaveBan(); // save the ban list
|
||||||
#endif
|
|
||||||
|
|
||||||
// Make sure you lose points for ALT-F4
|
// Make sure you lose points for ALT-F4
|
||||||
if (Playing())
|
if (Playing())
|
||||||
|
|
@ -2118,9 +2116,7 @@ void I_Error(const char *error, ...)
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
M_SaveConfig(NULL); // save game config, cvars..
|
M_SaveConfig(NULL); // save game config, cvars..
|
||||||
#ifndef NONET
|
|
||||||
D_SaveBan(); // save the ban list
|
D_SaveBan(); // save the ban list
|
||||||
#endif
|
|
||||||
G_SaveGameData(); // Tails 12-08-2002
|
G_SaveGameData(); // Tails 12-08-2002
|
||||||
|
|
||||||
// Shutdown. Here might be other errors.
|
// Shutdown. Here might be other errors.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue