mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-10 16:52:16 +00:00
Merge branch 'kill-nonet' into 'master'
Kill last of NONET, DJGPP (DOS), WATTCP (also DOS?), _WINDOWS (DirectDraw) See merge request KartKrew/Kart!704
This commit is contained in:
commit
ff629a4c78
28 changed files with 110 additions and 584 deletions
|
|
@ -64,7 +64,6 @@
|
|||
#
|
||||
# Netplay incompatible
|
||||
# --------------------
|
||||
# NONET=1 - Disable online capability.
|
||||
# NOMD5=1 - Disable MD5 checksum (validation tool).
|
||||
# NOPOSTPROCESSING=1 - ?
|
||||
# MOBJCONSISTANCY=1 - ??
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
PANDORA\
|
||||
HAIKU\
|
||||
DUMMY\
|
||||
DJGPPDOS\
|
||||
SOLARIS\
|
||||
MACOSX\
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
passthru_opts+=\
|
||||
NONET NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
|
||||
NO_IPV6 NOHW NOMD5 NOPOSTPROCESSING\
|
||||
MOBJCONSISTANCY PACKETDROP ZDEBUG\
|
||||
HAVE_MINIUPNPC\
|
||||
HAVE_DISCORDRPC TESTERS HOSTTESTERS DEVELOP
|
||||
|
|
@ -48,13 +48,11 @@ sources+=apng.c
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef NOCURL
|
||||
CURLCONFIG?=curl-config
|
||||
$(eval $(call Configure,CURL,$(CURLCONFIG)))
|
||||
opts+=-DHAVE_CURL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_MINIUPNPC
|
||||
libs+=-lminiupnpc
|
||||
|
|
|
|||
|
|
@ -40,12 +40,10 @@ ifndef MINGW64
|
|||
libs+=-Wl,--large-address-aware
|
||||
endif
|
||||
|
||||
ifndef NONET
|
||||
ifndef MINGW64 # miniupnc is broken with MINGW64
|
||||
opts+=-I../libs -DSTATIC_MINIUPNPC
|
||||
libs+=-L../libs/miniupnpc/mingw$(32) -lws2_32 -liphlpapi
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef NO_DISCORDRPC
|
||||
HAVE_DISCORDRPC=1
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@
|
|||
#include "filesrch.h"
|
||||
#include "m_misc.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "win32/win_main.h"
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
|
@ -1550,13 +1546,6 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...)
|
|||
//
|
||||
void CONS_Error(const char *msg)
|
||||
{
|
||||
#if defined(RPC_NO_WINDOWS_H) && defined(_WINDOWS)
|
||||
if (!graphics_started)
|
||||
{
|
||||
MessageBoxA(vid.WndParent, msg, "Dr. Robotnik's Ring Racers Warning", MB_OK);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
CONS_Printf("\x82%s", msg); // write error msg in different colour
|
||||
CONS_Printf(M_GetText("Press ENTER to continue\n"));
|
||||
|
||||
|
|
|
|||
|
|
@ -58,11 +58,9 @@
|
|||
#include "doomstat.h"
|
||||
#include "s_sound.h" // sfx_syfail
|
||||
|
||||
#ifndef NONET
|
||||
// cl loading screen
|
||||
#include "v_video.h"
|
||||
#include "f_finale.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
|
|
@ -557,8 +555,6 @@ char http_source[MAX_MIRROR_LENGTH];
|
|||
|
||||
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
//
|
||||
// CL_DrawConnectionStatus
|
||||
//
|
||||
|
|
@ -772,8 +768,6 @@ static inline void CL_DrawConnectionStatus(void)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static boolean CL_AskFileList(INT32 firstfile)
|
||||
{
|
||||
netbuffer->packettype = PT_TELLFILESNEEDED;
|
||||
|
|
@ -1116,7 +1110,6 @@ static boolean SV_SendServerConfig(INT32 node)
|
|||
return waspacketsent;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
#define SAVEGAMESIZE (768*1024)
|
||||
|
||||
static boolean SV_ResendingSavegameToAnyone(void)
|
||||
|
|
@ -1344,9 +1337,7 @@ static void CL_ReloadReceivedSavegame(void)
|
|||
|
||||
CONS_Printf(M_GetText("Game state reloaded\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static void SendAskInfo(INT32 node)
|
||||
{
|
||||
tic_t asktime;
|
||||
|
|
@ -1485,11 +1476,8 @@ void CL_UpdateServerList (void)
|
|||
SendAskInfo(BROADCASTADDR);
|
||||
}
|
||||
|
||||
#endif // ifndef NONET
|
||||
|
||||
static void M_ConfirmConnect(event_t *ev)
|
||||
{
|
||||
#ifndef NONET
|
||||
if (ev->type == ev_keydown)
|
||||
{
|
||||
if (G_PlayerInputDown(0, gc_a, 1))
|
||||
|
|
@ -1521,9 +1509,6 @@ static void M_ConfirmConnect(event_t *ev)
|
|||
M_ClearMenus(true);
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)ev;
|
||||
#endif
|
||||
}
|
||||
|
||||
static boolean CL_FinishedFileList(void)
|
||||
|
|
@ -1610,28 +1595,22 @@ static boolean CL_FinishedFileList(void)
|
|||
if (!curl_failedwebdownload)
|
||||
#endif
|
||||
{
|
||||
#ifndef NONET
|
||||
downloadcompletednum = 0;
|
||||
downloadcompletedsize = 0;
|
||||
totalfilesrequestednum = 0;
|
||||
totalfilesrequestedsize = 0;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_MD5SUMBAD)
|
||||
{
|
||||
#ifndef NONET
|
||||
totalfilesrequestednum++;
|
||||
totalfilesrequestedsize += fileneeded[i].totalsize;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
if (totalfilesrequestedsize>>20 >= 10)
|
||||
downloadsize = Z_StrDup(va("%uM",totalfilesrequestedsize>>20));
|
||||
else
|
||||
downloadsize = Z_StrDup(va("%uK",totalfilesrequestedsize>>10));
|
||||
#endif
|
||||
|
||||
if (serverisfull)
|
||||
M_StartMessage(va(M_GetText(
|
||||
|
|
@ -1675,7 +1654,6 @@ static boolean CL_FinishedFileList(void)
|
|||
*/
|
||||
static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||
{
|
||||
#ifndef NONET
|
||||
INT32 i;
|
||||
|
||||
// serverlist is updated by GetPacket function
|
||||
|
|
@ -1737,11 +1715,6 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
|||
SendAskInfo(servernode);
|
||||
*asksent = I_GetTime() + NEWTICRATE;
|
||||
}
|
||||
#else
|
||||
(void)asksent;
|
||||
// No netgames, so we skip this state.
|
||||
cl_mode = CL_ASKJOIN;
|
||||
#endif // ifndef NONET/else
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1761,10 +1734,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||
boolean waitmore;
|
||||
INT32 i;
|
||||
|
||||
#ifdef NONET
|
||||
(void)tmpsave;
|
||||
#endif
|
||||
|
||||
switch (cl_mode)
|
||||
{
|
||||
case CL_SEARCHING:
|
||||
|
|
@ -1950,7 +1919,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||
//FileSendTicker();
|
||||
*oldtic = I_GetTime();
|
||||
|
||||
#ifndef NONET
|
||||
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
|
||||
{
|
||||
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_DOWNLOADSAVEGAME)
|
||||
|
|
@ -1972,10 +1940,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||
S_UpdateSounds();
|
||||
S_UpdateClosedCaptions();
|
||||
}
|
||||
#else
|
||||
CON_Drawer();
|
||||
I_UpdateNoVsync();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1995,22 +1959,18 @@ static void CL_ConnectToServer(void)
|
|||
{
|
||||
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
|
||||
tic_t oldtic;
|
||||
#ifndef NONET
|
||||
tic_t asksent;
|
||||
char tmpsave[256];
|
||||
|
||||
sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home);
|
||||
|
||||
lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
cl_mode = CL_SEARCHING;
|
||||
|
||||
#ifndef NONET
|
||||
// Don't get a corrupt savegame error because tmpsave already exists
|
||||
if (FIL_FileExists(tmpsave) && unlink(tmpsave) == -1)
|
||||
I_Error("Can't delete %s\n", tmpsave);
|
||||
#endif
|
||||
|
||||
if (netgame)
|
||||
{
|
||||
|
|
@ -2040,7 +2000,6 @@ static void CL_ConnectToServer(void)
|
|||
|
||||
pnumnodes = 1;
|
||||
oldtic = 0;
|
||||
#ifndef NONET
|
||||
asksent = 0;
|
||||
firstconnectattempttime = I_GetTime();
|
||||
|
||||
|
|
@ -2059,16 +2018,11 @@ static void CL_ConnectToServer(void)
|
|||
serverlist[i].info.version, serverlist[i].info.subversion));
|
||||
}
|
||||
SL_ClearServerList(servernode);
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
// If the connection was aborted for some reason, leave
|
||||
#ifndef NONET
|
||||
if (!CL_ServerConnectionTicker(tmpsave, &oldtic, &asksent))
|
||||
#else
|
||||
if (!CL_ServerConnectionTicker((char*)NULL, &oldtic, (tic_t *)NULL))
|
||||
#endif
|
||||
return;
|
||||
|
||||
if (server)
|
||||
|
|
@ -2081,10 +2035,8 @@ static void CL_ConnectToServer(void)
|
|||
}
|
||||
while (!(cl_mode == CL_CONNECTED && (client || (server && nodewaited <= pnumnodes))));
|
||||
|
||||
#ifndef NONET
|
||||
if (netgame)
|
||||
F_StartWaitingPlayers();
|
||||
#endif
|
||||
DEBFILE(va("Synchronisation Finished\n"));
|
||||
|
||||
displayplayers[0] = consoleplayer;
|
||||
|
|
@ -2100,7 +2052,6 @@ static void CL_ConnectToServer(void)
|
|||
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static void Command_ShowBan(void) //Print out ban list
|
||||
{
|
||||
size_t i;
|
||||
|
|
@ -2495,7 +2446,6 @@ static void Command_connect(void)
|
|||
M_ClearMenus(true);
|
||||
CL_ConnectToServer();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ResetNode(INT32 node);
|
||||
|
||||
|
|
@ -2619,10 +2569,8 @@ void CL_Reset(void)
|
|||
fileneedednum = 0;
|
||||
memset(fileneeded, 0, sizeof(fileneeded));
|
||||
|
||||
#ifndef NONET
|
||||
totalfilesrequestednum = 0;
|
||||
totalfilesrequestedsize = 0;
|
||||
#endif
|
||||
firstconnectattempttime = 0;
|
||||
serverisfull = false;
|
||||
connectiontimeout = (tic_t)cv_nettimeout.value; //reset this temporary hack
|
||||
|
|
@ -2637,7 +2585,6 @@ void CL_Reset(void)
|
|||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static void Command_GetPlayerNum(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
|
@ -2899,7 +2846,6 @@ static void Command_Kick(void)
|
|||
else
|
||||
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
|
|
@ -3317,7 +3263,6 @@ void D_ClientServerInit(void)
|
|||
DEBFILE(va("- - -== Ring Racers v%d.%d "VERSIONSTRING" debugfile ==- - -\n",
|
||||
VERSION, SUBVERSION));
|
||||
|
||||
#ifndef NONET
|
||||
COM_AddCommand("getplayernum", Command_GetPlayerNum);
|
||||
COM_AddCommand("kick", Command_Kick);
|
||||
COM_AddCommand("ban", Command_Ban);
|
||||
|
|
@ -3338,19 +3283,16 @@ void D_ClientServerInit(void)
|
|||
#endif
|
||||
#ifdef _DEBUG
|
||||
COM_AddCommand("numnodes", Command_Numnodes);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
RegisterNetXCmd(XD_KICK, Got_KickCmd);
|
||||
RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer);
|
||||
RegisterNetXCmd(XD_REMOVEPLAYER, Got_RemovePlayer);
|
||||
RegisterNetXCmd(XD_ADDBOT, Got_AddBot);
|
||||
#ifndef NONET
|
||||
#ifdef DUMPCONSISTENCY
|
||||
CV_RegisterVar(&cv_dumpconsistency);
|
||||
#endif
|
||||
D_LoadBan(false);
|
||||
#endif
|
||||
|
||||
gametic = 0;
|
||||
localgametic = 0;
|
||||
|
|
@ -4048,9 +3990,7 @@ static void HandleConnect(SINT8 node)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef NONET
|
||||
boolean newnode = false;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < netbuffer->u.clientcfg.localplayers - playerpernode[node]; i++)
|
||||
{
|
||||
|
|
@ -4067,9 +4007,7 @@ static void HandleConnect(SINT8 node)
|
|||
if (!nodeingame[node])
|
||||
{
|
||||
gamestate_t backupstate = gamestate;
|
||||
#ifndef NONET
|
||||
newnode = true;
|
||||
#endif
|
||||
|
||||
SV_AddNode(node);
|
||||
|
||||
|
|
@ -4091,7 +4029,6 @@ static void HandleConnect(SINT8 node)
|
|||
G_SetGamestate(backupstate);
|
||||
DEBFILE("new node joined\n");
|
||||
}
|
||||
#ifndef NONET
|
||||
if (nodewaiting[node])
|
||||
{
|
||||
if (node && newnode)
|
||||
|
|
@ -4103,7 +4040,6 @@ static void HandleConnect(SINT8 node)
|
|||
joindelay += cv_joindelay.value * TICRATE;
|
||||
player_joining = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4137,7 +4073,6 @@ static void HandleTimeout(SINT8 node)
|
|||
M_StartMessage(M_GetText("Server Timeout\n\nPress Esc\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
/** Called when a PT_SERVERINFO packet is received
|
||||
*
|
||||
* \param node The packet sender
|
||||
|
|
@ -4162,7 +4097,6 @@ static void HandleServerInfo(SINT8 node)
|
|||
|
||||
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void PT_WillResendGamestate(void)
|
||||
{
|
||||
|
|
@ -4378,23 +4312,15 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
|||
playernode[(UINT8)serverplayer] = servernode;
|
||||
|
||||
if (netgame)
|
||||
#ifndef NONET
|
||||
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));
|
||||
|
||||
#ifndef NONET
|
||||
/// \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?
|
||||
/// 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
|
||||
/// At almost any gamestate there could be joiners... So just always send gamestate?
|
||||
cl_mode = ((server) ? CL_CONNECTED : CL_DOWNLOADSAVEGAME);
|
||||
#else
|
||||
cl_mode = CL_CONNECTED;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -4965,13 +4891,11 @@ static void GetPackets(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
if (netbuffer->packettype == PT_SERVERINFO)
|
||||
{
|
||||
HandleServerInfo(node);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (netbuffer->packettype == PT_PLAYERINFO)
|
||||
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
||||
|
|
|
|||
|
|
@ -496,11 +496,9 @@ boolean TryRunTics(tic_t realtic);
|
|||
/*boolean AddLmpExtradata(UINT8 **demo_p, INT32 playernum);
|
||||
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum);*/
|
||||
|
||||
#ifndef NONET
|
||||
// translate a playername in a player number return -1 if not found and
|
||||
// print a error message in the console
|
||||
SINT8 nametonum(const char *name);
|
||||
#endif
|
||||
|
||||
extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
|
|
|||
11
src/d_main.c
11
src/d_main.c
|
|
@ -86,10 +86,6 @@
|
|||
#include "hardware/hw_main.h" // 3D View Rendering
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "win32/win_main.h" // I_DoStartupMouse
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
|
@ -715,11 +711,6 @@ void D_SRB2Loop(void)
|
|||
|
||||
// Pushing of + parameters is now done back in D_SRB2Main, not here.
|
||||
|
||||
#ifdef _WINDOWS
|
||||
CONS_Printf("I_StartupMouse()...\n");
|
||||
I_DoStartupMouse();
|
||||
#endif
|
||||
|
||||
I_UpdateTime(cv_timescale.value);
|
||||
oldentertics = I_GetTime();
|
||||
|
||||
|
|
@ -1257,9 +1248,7 @@ void D_SRB2Main(void)
|
|||
#endif
|
||||
|
||||
// for dedicated server
|
||||
#if !defined (_WINDOWS) //already check in win_main.c
|
||||
dedicated = M_CheckParm("-dedicated") != 0;
|
||||
#endif
|
||||
|
||||
if (devparm)
|
||||
CONS_Printf(M_GetText("Development mode ON.\n"));
|
||||
|
|
|
|||
48
src/d_net.c
48
src/d_net.c
|
|
@ -148,7 +148,6 @@ boolean Net_GetNetStat(void)
|
|||
#define URGENTFREESLOTNUM 10
|
||||
#define ACKTOSENDTIMEOUT (TICRATE/11)
|
||||
|
||||
#ifndef NONET
|
||||
typedef struct
|
||||
{
|
||||
UINT8 acknum;
|
||||
|
|
@ -162,7 +161,6 @@ typedef struct
|
|||
doomdata_t data;
|
||||
} pak;
|
||||
} ackpak_t;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
@ -170,10 +168,8 @@ typedef enum
|
|||
NF_TIMEOUT = 2, // Flag is set when the node got a timeout
|
||||
} node_flags_t;
|
||||
|
||||
#ifndef NONET
|
||||
// Table of packets that were not acknowleged can be resent (the sender window)
|
||||
static ackpak_t ackpak[MAXACKPACKETS];
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -201,7 +197,6 @@ typedef struct
|
|||
static node_t nodes[MAXNETNODES];
|
||||
#define NODETIMEOUT 14
|
||||
|
||||
#ifndef NONET
|
||||
// return <0 if a < b (mod 256)
|
||||
// 0 if a = n (mod 256)
|
||||
// >0 if a > b (mod 256)
|
||||
|
|
@ -436,21 +431,15 @@ static boolean Processackpak(void)
|
|||
}
|
||||
return goodpacket;
|
||||
}
|
||||
#endif
|
||||
|
||||
// send special packet with only ack on it
|
||||
void Net_SendAcks(INT32 node)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
netbuffer->packettype = PT_NOTHING;
|
||||
M_Memcpy(netbuffer->u.textcmd, nodes[node].acktosend, MAXACKTOSEND);
|
||||
HSendPacket(node, false, 0, MAXACKTOSEND);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static void GotAcks(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
|
|
@ -473,7 +462,6 @@ static void GotAcks(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Net_ConnectionTimeout(INT32 node)
|
||||
{
|
||||
|
|
@ -499,7 +487,6 @@ void Net_ConnectionTimeout(INT32 node)
|
|||
// Resend the data if needed
|
||||
void Net_AckTicker(void)
|
||||
{
|
||||
#ifndef NONET
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
|
|
@ -546,16 +533,12 @@ void Net_AckTicker(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Remove last packet received ack before resending the ackreturn
|
||||
// (the higher layer doesn't have room, or something else ....)
|
||||
void Net_UnAcknowledgePacket(INT32 node)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
INT32 hm1 = (nodes[node].acktosend_head-1+MAXACKTOSEND) % MAXACKTOSEND;
|
||||
DEBFILE(va("UnAcknowledge node %d\n", node));
|
||||
if (!node)
|
||||
|
|
@ -587,10 +570,8 @@ void Net_UnAcknowledgePacket(INT32 node)
|
|||
if (!nodes[node].firstacktosend)
|
||||
nodes[node].firstacktosend = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
/** Checks if all acks have been received
|
||||
*
|
||||
* \return True if all acks have been received
|
||||
|
|
@ -606,7 +587,6 @@ static boolean Net_AllAcksReceived(void)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Waits for all ackreturns
|
||||
*
|
||||
|
|
@ -615,9 +595,6 @@ static boolean Net_AllAcksReceived(void)
|
|||
*/
|
||||
void Net_WaitAllAckReceived(UINT32 timeout)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)timeout;
|
||||
#else
|
||||
tic_t tictac = I_GetTime();
|
||||
timeout = tictac + timeout*NEWTICRATE;
|
||||
|
||||
|
|
@ -633,7 +610,6 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
|||
HGetPacket();
|
||||
Net_AckTicker();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void InitNode(node_t *node)
|
||||
|
|
@ -649,10 +625,8 @@ static void InitAck(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
#ifndef NONET
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
ackpak[i].acknum = 0;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
InitNode(&nodes[i]);
|
||||
|
|
@ -665,9 +639,6 @@ static void InitAck(void)
|
|||
*/
|
||||
void Net_AbortPacketType(UINT8 packettype)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)packettype;
|
||||
#else
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXACKPACKETS; i++)
|
||||
if (ackpak[i].acknum && (ackpak[i].pak.data.packettype == packettype
|
||||
|
|
@ -675,7 +646,6 @@ void Net_AbortPacketType(UINT8 packettype)
|
|||
{
|
||||
ackpak[i].acknum = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
|
@ -685,9 +655,6 @@ void Net_AbortPacketType(UINT8 packettype)
|
|||
// remove a node, clear all ack from this node and reset askret
|
||||
void Net_CloseConnection(INT32 node)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)node;
|
||||
#else
|
||||
INT32 i;
|
||||
boolean forceclose = (node & FORCECLOSE) != 0;
|
||||
|
||||
|
|
@ -732,10 +699,8 @@ void Net_CloseConnection(INT32 node)
|
|||
if (server)
|
||||
SV_AbortLuaFileTransfer(node);
|
||||
I_NetFreeNodenum(node);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
//
|
||||
// Checksum
|
||||
//
|
||||
|
|
@ -751,7 +716,6 @@ static UINT32 NetbufferChecksum(void)
|
|||
|
||||
return LONG(c);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
|
||||
|
|
@ -1012,14 +976,12 @@ void Command_Droprate(void)
|
|||
packetdroprate = droprate;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static boolean ShouldDropPacket(void)
|
||||
{
|
||||
return (packetdropquantity[netbuffer->packettype])
|
||||
|| (packetdroprate != 0 && rand() < (RAND_MAX * (packetdroprate / 100.f))) || packetdroprate == 100;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// HSendPacket
|
||||
|
|
@ -1054,11 +1016,6 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
|||
if (!netgame)
|
||||
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
|
||||
// the current packet
|
||||
doomcom->remotenode = (INT16)node;
|
||||
|
|
@ -1119,8 +1076,6 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // ndef NONET
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1154,8 +1109,6 @@ boolean HGetPacket(void)
|
|||
if (!netgame)
|
||||
return false;
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
while(true)
|
||||
{
|
||||
//nodejustjoined = I_NetGet();
|
||||
|
|
@ -1215,7 +1168,6 @@ boolean HGetPacket(void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif // ndef NONET
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,8 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum,
|
|||
size_t packetlength);
|
||||
boolean HGetPacket(void);
|
||||
void D_SetDoomcom(void);
|
||||
#ifndef NONET
|
||||
void D_SaveBan(void);
|
||||
void D_LoadBan(boolean warning);
|
||||
#endif
|
||||
boolean D_CheckNetGame(void);
|
||||
void D_CloseConnection(void);
|
||||
void Net_UnAcknowledgePacket(INT32 node);
|
||||
|
|
|
|||
|
|
@ -809,14 +809,12 @@ void D_RegisterServerCommands(void)
|
|||
CV_RegisterVar(&cv_noticedownload);
|
||||
CV_RegisterVar(&cv_downloadspeed);
|
||||
CV_RegisterVar(&cv_httpsource);
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_allownewplayer);
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
CV_RegisterVar(&cv_joinnextround);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_showjoinaddress);
|
||||
CV_RegisterVar(&cv_blamecfail);
|
||||
#endif
|
||||
|
||||
COM_AddCommand("ping", Command_Ping_f);
|
||||
CV_RegisterVar(&cv_nettimeout);
|
||||
|
|
@ -4711,8 +4709,6 @@ static void Command_Version_f(void)
|
|||
// Base library
|
||||
#if defined( HAVE_SDL)
|
||||
CONS_Printf("SDL ");
|
||||
#elif defined(_WINDOWS)
|
||||
CONS_Printf("DD ");
|
||||
#endif
|
||||
|
||||
// OS
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
#if defined (_WIN32) || defined (__DJGPP__)
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#else
|
||||
|
|
@ -30,10 +30,6 @@
|
|||
#elif defined (_WIN32)
|
||||
#include <sys/utime.h>
|
||||
#endif
|
||||
#ifdef __DJGPP__
|
||||
#include <dir.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include "curl/curl.h"
|
||||
|
|
@ -116,14 +112,12 @@ typedef struct
|
|||
} pauseddownload_t;
|
||||
static pauseddownload_t *pauseddownload = NULL;
|
||||
|
||||
#ifndef NONET
|
||||
// for cl loading screen
|
||||
INT32 lastfilenum = -1;
|
||||
INT32 downloadcompletednum = 0;
|
||||
UINT32 downloadcompletedsize = 0;
|
||||
INT32 totalfilesrequestednum = 0;
|
||||
UINT32 totalfilesrequestedsize = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
static CURL *http_handle;
|
||||
|
|
@ -253,9 +247,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
|||
|
||||
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||
{
|
||||
#ifndef NONET
|
||||
lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
|
|
@ -1435,10 +1427,8 @@ void PT_FileFragment(void)
|
|||
HSendPacket(servernode, true, 0, 0);
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += file->totalsize;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else // Already received
|
||||
|
|
@ -1472,9 +1462,7 @@ void PT_FileFragment(void)
|
|||
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
lastfilenum = filenum;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \brief Checks if a node is downloading a file
|
||||
|
|
|
|||
|
|
@ -60,13 +60,11 @@ extern INT32 fileneedednum;
|
|||
extern fileneeded_t fileneeded[MAX_WADFILES];
|
||||
extern char downloaddir[512];
|
||||
|
||||
#ifndef NONET
|
||||
extern INT32 lastfilenum;
|
||||
extern INT32 downloadcompletednum;
|
||||
extern UINT32 downloadcompletedsize;
|
||||
extern INT32 totalfilesrequestednum;
|
||||
extern UINT32 totalfilesrequestedsize;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
extern boolean curl_failedwebdownload;
|
||||
|
|
|
|||
|
|
@ -55,13 +55,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define NONET
|
||||
#if !defined (HWRENDER) && !defined (NOHW)
|
||||
#define HWRENDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define ASMCALL __cdecl
|
||||
#else
|
||||
|
|
@ -100,7 +93,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined (_WIN32) || defined (__DJGPP__)
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -692,13 +685,13 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
#define USER_VOLUME_SCALE 2
|
||||
#define MAX_VOLUME ( 100 * VOLUME_DIVIDER / USER_VOLUME_SCALE )
|
||||
|
||||
#if defined (HAVE_CURL) && ! defined (NONET)
|
||||
#ifdef HAVE_CURL
|
||||
#define MASTERSERVER
|
||||
#else
|
||||
#undef UPDATE_ALERT
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_CURL) && ! defined (NONET)
|
||||
#ifdef HAVE_CURL
|
||||
#define MASTERSERVER
|
||||
#else
|
||||
#undef UPDATE_ALERT
|
||||
|
|
|
|||
|
|
@ -54,17 +54,6 @@ typedef long ssize_t;
|
|||
#define PDWORD_PTR PDWORD
|
||||
#endif
|
||||
#endif
|
||||
#elif defined (__DJGPP__)
|
||||
#define UINT8 unsigned char
|
||||
#define SINT8 signed char
|
||||
|
||||
#define UINT16 unsigned short int
|
||||
#define INT16 signed short int
|
||||
|
||||
#define INT32 signed long
|
||||
#define UINT32 unsigned long
|
||||
#define INT64 signed long long
|
||||
#define UINT64 unsigned long long
|
||||
#else
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -20,18 +20,10 @@
|
|||
// __declspec(dllexport) <return->type> (WINAPI *<function-name>) (<arguments>);
|
||||
|
||||
#ifdef _CREATE_DLL_
|
||||
#ifdef _WINDOWS
|
||||
#ifdef __cplusplus
|
||||
#define EXPORT extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#define EXPORT extern "C"
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#define EXPORT extern "C"
|
||||
#else
|
||||
#define EXPORT
|
||||
#endif
|
||||
#define EXPORT
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#define HWRAPI(fn) WINAPI fn
|
||||
|
|
@ -56,9 +48,7 @@
|
|||
|
||||
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
||||
#elif defined (__CYGWIN__)
|
||||
#ifdef __CYGWIN__
|
||||
void _init() __attribute__((constructor));
|
||||
void _fini() __attribute__((destructor));
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ EXPORT boolean HWRAPI(Init) (void);
|
|||
#ifndef HAVE_SDL
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
#ifdef _WINDOWS
|
||||
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
||||
#endif
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
|
|
@ -104,9 +101,6 @@ struct hwdriver_s
|
|||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
#ifdef _WINDOWS
|
||||
GetModeList pfnGetModeList;
|
||||
#endif
|
||||
#ifndef HAVE_SDL
|
||||
Shutdown pfnShutdown;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ static huddrawlist_h luahuddrawlist_scores;
|
|||
// HEADS UP INIT
|
||||
//======================================================================
|
||||
|
||||
#ifndef NONET
|
||||
// just after
|
||||
static void Command_Say_f(void);
|
||||
static void Command_Sayto_f(void);
|
||||
|
|
@ -176,7 +175,6 @@ static void Command_Sayteam_f(void);
|
|||
static void Command_CSay_f(void);
|
||||
static void Command_Shout(void);
|
||||
static void Got_Saycmd(UINT8 **p, INT32 playernum);
|
||||
#endif
|
||||
|
||||
void HU_LoadGraphics(void)
|
||||
{
|
||||
|
|
@ -216,14 +214,12 @@ void HU_Init(void)
|
|||
{
|
||||
font_t font;
|
||||
|
||||
#ifndef NONET
|
||||
COM_AddCommand("say", Command_Say_f);
|
||||
COM_AddCommand("sayto", Command_Sayto_f);
|
||||
COM_AddCommand("sayteam", Command_Sayteam_f);
|
||||
COM_AddCommand("csay", Command_CSay_f);
|
||||
COM_AddCommand("shout", Command_Shout);
|
||||
RegisterNetXCmd(XD_SAY, Got_Saycmd);
|
||||
#endif
|
||||
|
||||
// only allocate if not present, to save us a lot of headache
|
||||
if (missingpat == NULL)
|
||||
|
|
@ -395,7 +391,6 @@ void HU_Start(void)
|
|||
// EXECUTION
|
||||
//======================================================================
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
// EVERY CHANGE IN THIS SCRIPT IS LOL XD! BY VINCYTM
|
||||
|
||||
|
|
@ -444,11 +439,9 @@ static void HU_removeChatText_Log(void)
|
|||
}
|
||||
chat_nummsg_log--; // lost 1 msg.
|
||||
}
|
||||
#endif
|
||||
|
||||
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.
|
||||
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.
|
||||
|
|
@ -470,13 +463,8 @@ void HU_AddChatText(const char *text, boolean playsound)
|
|||
CONS_Printf("%s\n", text);
|
||||
else // if we aren't, still save the message to log.txt
|
||||
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.
|
||||
* A say command consists of a signed 8-bit integer for the target, an
|
||||
|
|
@ -993,8 +981,6 @@ static inline boolean HU_keyInChatString(char *s, char ch)
|
|||
return true; // ate the key
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
//
|
||||
static void HU_TickSongCredits(void)
|
||||
|
|
@ -1109,8 +1095,6 @@ void HU_Ticker(void)
|
|||
HU_TickSongCredits();
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
static boolean teamtalk = false;
|
||||
|
||||
// Clear spaces so we don't end up with messages only made out of emptiness
|
||||
|
|
@ -1243,7 +1227,6 @@ static void HU_queueChatChar(INT32 c)
|
|||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void HU_clearChatChars(void)
|
||||
{
|
||||
|
|
@ -1256,12 +1239,10 @@ void HU_clearChatChars(void)
|
|||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static boolean justscrolleddown;
|
||||
static boolean justscrolledup;
|
||||
static INT16 typelines = 1; // number of drawfill lines we need when drawing the chat. it's some weird hack and might be one frame off but I'm lazy to make another loop.
|
||||
// It's up here since it has to be reset when we open the chat.
|
||||
#endif
|
||||
|
||||
//
|
||||
// Returns true if key eaten
|
||||
|
|
@ -1301,7 +1282,6 @@ boolean HU_Responder(event_t *ev)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
if (!chat_on)
|
||||
{
|
||||
// enter chat mode
|
||||
|
|
@ -1439,7 +1419,6 @@ boolean HU_Responder(event_t *ev)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1448,8 +1427,6 @@ boolean HU_Responder(event_t *ev)
|
|||
// HEADS UP DRAWING
|
||||
//======================================================================
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
// Precompile a wordwrapped string to any given width.
|
||||
// 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.
|
||||
|
|
@ -2050,7 +2027,6 @@ static void HU_DrawChat_Old(void)
|
|||
if (hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX + c, y, '_' | cv_constextsize.value |V_NOSCALESTART|t, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void HU_DrawCEcho(void)
|
||||
{
|
||||
|
|
@ -2177,7 +2153,6 @@ void HU_Drawer(void)
|
|||
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
|
||||
V_DrawVhsEffect(demo.rewinding);
|
||||
|
||||
#ifndef NONET
|
||||
// draw chat string plus cursor
|
||||
if (chat_on)
|
||||
{
|
||||
|
|
@ -2194,7 +2169,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)
|
||||
HU_drawMiniChat(); // draw messages in a cool fashion.
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cechotimer)
|
||||
HU_DrawCEcho();
|
||||
|
|
|
|||
|
|
@ -20,10 +20,6 @@
|
|||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#elif !defined (__DJGPP__)
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "i_addrinfo.h"
|
||||
|
|
|
|||
389
src/i_tcp.c
389
src/i_tcp.c
|
|
@ -38,105 +38,87 @@
|
|||
|
||||
#include "doomdef.h"
|
||||
|
||||
#if defined (NOMD5) && !defined (NONET)
|
||||
//#define NONET
|
||||
#ifdef USE_WINSOCK1
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#ifndef USE_WINSOCK
|
||||
#include <arpa/inet.h>
|
||||
#ifdef __APPLE_CC__
|
||||
#ifndef _BSD_SOCKLEN_T_
|
||||
#define _BSD_SOCKLEN_T_
|
||||
#endif //_BSD_SOCKLEN_T_
|
||||
#endif //__APPLE_CC__
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif //normal BSD API
|
||||
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/time.h>
|
||||
#endif // UNIXCOMMON
|
||||
#endif
|
||||
|
||||
#ifdef NONET
|
||||
#undef HAVE_MINIUPNPC
|
||||
#else
|
||||
#ifdef USE_WINSOCK1
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#ifndef USE_WINSOCK
|
||||
#include <arpa/inet.h>
|
||||
#ifdef __APPLE_CC__
|
||||
#ifndef _BSD_SOCKLEN_T_
|
||||
#define _BSD_SOCKLEN_T_
|
||||
#endif //_BSD_SOCKLEN_T_
|
||||
#endif //__APPLE_CC__
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif //normal BSD API
|
||||
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/time.h>
|
||||
#endif // UNIXCOMMON
|
||||
#ifdef USE_WINSOCK
|
||||
// some undefined under win32
|
||||
#undef errno
|
||||
//#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right?
|
||||
#define errno h_errno // some very strange things happen when not using h_error?!?
|
||||
#ifdef EWOULDBLOCK
|
||||
#undef EWOULDBLOCK
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
// some undefined under win32
|
||||
#undef errno
|
||||
//#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right?
|
||||
#define errno h_errno // some very strange things happen when not using h_error?!?
|
||||
#ifdef EWOULDBLOCK
|
||||
#undef EWOULDBLOCK
|
||||
#endif
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#ifdef EMSGSIZE
|
||||
#undef EMSGSIZE
|
||||
#endif
|
||||
#define EMSGSIZE WSAEMSGSIZE
|
||||
#ifdef ECONNREFUSED
|
||||
#undef ECONNREFUSED
|
||||
#endif
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#ifdef ETIMEDOUT
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#ifndef IOC_VENDOR
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#endif
|
||||
#ifndef _WSAIOW
|
||||
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
||||
#endif
|
||||
#ifndef SIO_UDP_CONNRESET
|
||||
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
|
||||
#endif
|
||||
#ifndef AI_ADDRCONFIG
|
||||
#define AI_ADDRCONFIG 0x00000400
|
||||
#endif
|
||||
#ifndef STATUS_INVALID_PARAMETER
|
||||
#define STATUS_INVALID_PARAMETER 0xC000000D
|
||||
#endif
|
||||
#endif // USE_WINSOCK
|
||||
|
||||
#ifdef __DJGPP__
|
||||
#ifdef WATTCP // Alam_GBC: Wattcp may need this
|
||||
#include <tcp.h>
|
||||
#define strerror strerror_s
|
||||
#else // wattcp
|
||||
#include <lsck/lsck.h>
|
||||
#endif // libsocket
|
||||
#endif // djgpp
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct sockaddr any;
|
||||
struct sockaddr_in ip4;
|
||||
#ifdef HAVE_IPV6
|
||||
struct sockaddr_in6 ip6;
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#ifdef EMSGSIZE
|
||||
#undef EMSGSIZE
|
||||
#endif
|
||||
} mysockaddr_t;
|
||||
#define EMSGSIZE WSAEMSGSIZE
|
||||
#ifdef ECONNREFUSED
|
||||
#undef ECONNREFUSED
|
||||
#endif
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#ifdef ETIMEDOUT
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#ifndef IOC_VENDOR
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#endif
|
||||
#ifndef _WSAIOW
|
||||
#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
|
||||
#endif
|
||||
#ifndef SIO_UDP_CONNRESET
|
||||
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
|
||||
#endif
|
||||
#ifndef AI_ADDRCONFIG
|
||||
#define AI_ADDRCONFIG 0x00000400
|
||||
#endif
|
||||
#ifndef STATUS_INVALID_PARAMETER
|
||||
#define STATUS_INVALID_PARAMETER 0xC000000D
|
||||
#endif
|
||||
#endif // USE_WINSOCK
|
||||
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
#ifdef STATIC_MINIUPNPC
|
||||
#define STATICLIB
|
||||
#endif
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
#undef STATICLIB
|
||||
static UINT8 UPNP_support = TRUE;
|
||||
#endif // HAVE_MINIUPNC
|
||||
typedef union
|
||||
{
|
||||
struct sockaddr any;
|
||||
struct sockaddr_in ip4;
|
||||
#ifdef HAVE_IPV6
|
||||
struct sockaddr_in6 ip6;
|
||||
#endif
|
||||
} mysockaddr_t;
|
||||
|
||||
#endif // !NONET
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
#ifdef STATIC_MINIUPNPC
|
||||
#define STATICLIB
|
||||
#endif
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
#undef STATICLIB
|
||||
static UINT8 UPNP_support = TRUE;
|
||||
#endif // HAVE_MINIUPNC
|
||||
|
||||
#include "i_system.h"
|
||||
#include "i_time.h"
|
||||
|
|
@ -151,7 +133,7 @@
|
|||
#include "doomstat.h"
|
||||
|
||||
// win32 or djgpp
|
||||
#if defined (USE_WINSOCK) || defined (__DJGPP__)
|
||||
#ifdef USE_WINSOCK
|
||||
// winsock stuff (in winsock a socket is not a file)
|
||||
#define ioctl ioctlsocket
|
||||
#define close closesocket
|
||||
|
|
@ -159,19 +141,11 @@
|
|||
|
||||
#include "i_addrinfo.h"
|
||||
|
||||
#ifdef __DJGPP__
|
||||
|
||||
#ifdef WATTCP
|
||||
#define SELECTTEST
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define SELECTTEST
|
||||
#endif
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
#if defined (USE_WINSOCK) && !defined (NONET)
|
||||
#ifdef USE_WINSOCK
|
||||
typedef SOCKET SOCKET_TYPE;
|
||||
#define ERRSOCKET (SOCKET_ERROR)
|
||||
#else
|
||||
|
|
@ -183,33 +157,31 @@
|
|||
#define ERRSOCKET (-1)
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
// define socklen_t in DOS/Windows if it is not already defined
|
||||
#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1)
|
||||
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);
|
||||
// define socklen_t in Windows if it is not already defined
|
||||
#ifdef USE_WINSOCK1
|
||||
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);
|
||||
|
||||
static size_t numbans = 0;
|
||||
static size_t banned_size = 0;
|
||||
|
||||
|
|
@ -219,20 +191,6 @@ static boolean init_tcp_driver = false;
|
|||
static const char *serverport_name = DEFAULTPORT;
|
||||
static const char *clientport_name;/* any port */
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
#ifdef WATTCP
|
||||
static void wattcp_outch(char s)
|
||||
{
|
||||
static char old = '\0';
|
||||
char pr[2] = {s,0};
|
||||
if (s == old && old == ' ') return;
|
||||
else old = s;
|
||||
if (s == '\r') CONS_Printf("\n");
|
||||
else if (s != '\n') CONS_Printf(pr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
// stupid microsoft makes things complicated
|
||||
static char *get_WSAErrorStr(int e)
|
||||
|
|
@ -419,83 +377,54 @@ static const char *SOCK_AddrToStr(mysockaddr_t *sk)
|
|||
#endif
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *SOCK_GetNodeAddress(INT32 node)
|
||||
{
|
||||
if (node == 0)
|
||||
return "self";
|
||||
#ifdef NONET
|
||||
return NULL;
|
||||
#else
|
||||
if (!nodeconnected[node])
|
||||
return NULL;
|
||||
return SOCK_AddrToStr(&clientaddress[node]);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *SOCK_GetBanAddress(size_t ban)
|
||||
{
|
||||
if (ban >= numbans)
|
||||
return NULL;
|
||||
#ifdef NONET
|
||||
return NULL;
|
||||
#else
|
||||
return SOCK_AddrToStr(&banned[ban].address);
|
||||
#endif
|
||||
}
|
||||
|
||||
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
|
||||
if (ban >= numbans)
|
||||
return NULL;
|
||||
if (sprintf(s,"%d",banned[ban].mask) > 0)
|
||||
return s;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *SOCK_GetBanUsername(size_t ban)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)ban;
|
||||
return NULL;
|
||||
#else
|
||||
if (ban >= numbans)
|
||||
return NULL;
|
||||
return banned[ban].username;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char *SOCK_GetBanReason(size_t ban)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)ban;
|
||||
return NULL;
|
||||
#else
|
||||
if (ban >= numbans)
|
||||
return NULL;
|
||||
return banned[ban].reason;
|
||||
#endif
|
||||
}
|
||||
|
||||
static time_t SOCK_GetUnbanTime(size_t ban)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)ban;
|
||||
return NO_BAN_TIME;
|
||||
#else
|
||||
if (ban >= numbans)
|
||||
return NO_BAN_TIME;
|
||||
return banned[ban].timestamp;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static boolean SOCK_cmpaddr(mysockaddr_t *a, mysockaddr_t *b, UINT8 mask)
|
||||
{
|
||||
UINT32 bitmask = INADDR_NONE;
|
||||
|
|
@ -599,9 +528,7 @@ void Command_Numnodes(void)
|
|||
connected, ingame);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static boolean hole_punch(ssize_t c)
|
||||
{
|
||||
if (c == 10 && holepunchpacket->magic == hole_punch_magic)
|
||||
|
|
@ -723,10 +650,8 @@ static boolean SOCK_Get(void)
|
|||
doomcom->remotenode = -1; // no packet
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// check if we can send (do not go over the buffer)
|
||||
#ifndef NONET
|
||||
|
||||
static fd_set masterset;
|
||||
|
||||
|
|
@ -776,9 +701,7 @@ static boolean SOCK_CanGet(void)
|
|||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||
{
|
||||
socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in);
|
||||
|
|
@ -841,9 +764,7 @@ static void SOCK_Send(void)
|
|||
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_FreeNodenum(INT32 numnode)
|
||||
{
|
||||
// can't disconnect from self :)
|
||||
|
|
@ -858,12 +779,10 @@ static void SOCK_FreeNodenum(INT32 numnode)
|
|||
// put invalid address
|
||||
memset(&clientaddress[numnode], 0, sizeof (clientaddress[numnode]));
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// UDPsocket
|
||||
//
|
||||
#ifndef NONET
|
||||
|
||||
// allocate a socket
|
||||
static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen)
|
||||
|
|
@ -872,11 +791,7 @@ static SOCKET_TYPE UDP_Bind(int family, struct sockaddr *addr, socklen_t addrlen
|
|||
int opt;
|
||||
socklen_t opts;
|
||||
#ifdef FIONBIO
|
||||
#ifdef WATTCP
|
||||
char trueval = true;
|
||||
#else
|
||||
unsigned long trueval = true;
|
||||
#endif
|
||||
#endif
|
||||
mysockaddr_t straddr;
|
||||
struct sockaddr_in sin;
|
||||
|
|
@ -1188,12 +1103,10 @@ static boolean UDP_Socket(void)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
boolean I_InitTcpDriver(void)
|
||||
{
|
||||
boolean tcp_was_up = init_tcp_driver;
|
||||
#ifndef NONET
|
||||
if (!init_tcp_driver)
|
||||
{
|
||||
#ifdef USE_WINSOCK
|
||||
|
|
@ -1246,63 +1159,8 @@ boolean I_InitTcpDriver(void)
|
|||
CONS_Debug(DBG_NETPLAY, "WinSock description: %s\n",WSAData.szDescription);
|
||||
CONS_Debug(DBG_NETPLAY, "WinSock System Status: %s\n",WSAData.szSystemStatus);
|
||||
#endif
|
||||
#ifdef __DJGPP__
|
||||
#ifdef WATTCP // Alam_GBC: survive bootp, dhcp, rarp and wattcp/pktdrv from failing to load
|
||||
survive_eth = 1; // would be needed to not exit if pkt_eth_init() fails
|
||||
survive_bootp = 1; // ditto for BOOTP
|
||||
survive_dhcp = 1; // ditto for DHCP/RARP
|
||||
survive_rarp = 1;
|
||||
//_watt_do_exit = false;
|
||||
//_watt_handle_cbreak = false;
|
||||
//_watt_no_config = true;
|
||||
_outch = wattcp_outch;
|
||||
init_misc();
|
||||
//#ifdef DEBUGFILE
|
||||
dbug_init();
|
||||
//#endif
|
||||
switch (sock_init())
|
||||
{
|
||||
case 0:
|
||||
init_tcp_driver = true;
|
||||
break;
|
||||
case 3:
|
||||
CONS_Debug(DBG_NETPLAY, "No packet driver detected\n");
|
||||
break;
|
||||
case 4:
|
||||
CONS_Debug(DBG_NETPLAY, "Error while talking to packet driver\n");
|
||||
break;
|
||||
case 5:
|
||||
CONS_Debug(DBG_NETPLAY, "BOOTP failed\n");
|
||||
break;
|
||||
case 6:
|
||||
CONS_Debug(DBG_NETPLAY, "DHCP failed\n");
|
||||
break;
|
||||
case 7:
|
||||
CONS_Debug(DBG_NETPLAY, "RARP failed\n");
|
||||
break;
|
||||
case 8:
|
||||
CONS_Debug(DBG_NETPLAY, "TCP/IP failed\n");
|
||||
break;
|
||||
case 9:
|
||||
CONS_Debug(DBG_NETPLAY, "PPPoE login/discovery failed\n");
|
||||
break;
|
||||
default:
|
||||
CONS_Debug(DBG_NETPLAY, "Unknown error with TCP/IP stack\n");
|
||||
break;
|
||||
}
|
||||
hires_timer(0);
|
||||
#else // wattcp
|
||||
if (__lsck_init())
|
||||
init_tcp_driver = true;
|
||||
else
|
||||
CONS_Debug(DBG_NETPLAY, "No TCP/IP driver detected\n");
|
||||
#endif // libsocket
|
||||
#endif // __DJGPP__
|
||||
#ifndef __DJGPP__
|
||||
init_tcp_driver = true;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!tcp_was_up && init_tcp_driver)
|
||||
{
|
||||
I_AddExitFunc(I_ShutdownTcpDriver);
|
||||
|
|
@ -1316,7 +1174,6 @@ boolean I_InitTcpDriver(void)
|
|||
return init_tcp_driver;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_CloseSocket(void)
|
||||
{
|
||||
size_t i;
|
||||
|
|
@ -1325,19 +1182,15 @@ static void SOCK_CloseSocket(void)
|
|||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET
|
||||
&& FD_ISSET(mysockets[i], &masterset))
|
||||
{
|
||||
#if !defined (__DJGPP__) || defined (WATTCP)
|
||||
FD_CLR(mysockets[i], &masterset);
|
||||
close(mysockets[i]);
|
||||
#endif
|
||||
}
|
||||
mysockets[i] = ERRSOCKET;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void I_ShutdownTcpDriver(void)
|
||||
{
|
||||
#ifndef NONET
|
||||
SOCK_CloseSocket();
|
||||
|
||||
CONS_Printf("I_ShutdownTcpDriver: ");
|
||||
|
|
@ -1345,20 +1198,10 @@ void I_ShutdownTcpDriver(void)
|
|||
WS_addrinfocleanup();
|
||||
WSACleanup();
|
||||
#endif
|
||||
#ifdef __DJGPP__
|
||||
#ifdef WATTCP // wattcp
|
||||
//_outch = NULL;
|
||||
sock_exit();
|
||||
#else
|
||||
__lsck_uninit();
|
||||
#endif // libsocket
|
||||
#endif // __DJGPP__
|
||||
CONS_Printf("shut down\n");
|
||||
init_tcp_driver = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
static boolean SOCK_GetAddr(struct sockaddr_in *sin, const char *address, const char *port, boolean test)
|
||||
{
|
||||
struct my_addrinfo *ai = NULL, *runp, hints;
|
||||
|
|
@ -1471,11 +1314,9 @@ static void SOCK_RegisterHolePunch(void)
|
|||
{
|
||||
rendezvous(4);
|
||||
}
|
||||
#endif
|
||||
|
||||
static boolean SOCK_OpenSocket(void)
|
||||
{
|
||||
#ifndef NONET
|
||||
size_t i;
|
||||
|
||||
memset(clientaddress, 0, sizeof (clientaddress));
|
||||
|
|
@ -1502,9 +1343,6 @@ static boolean SOCK_OpenSocket(void)
|
|||
// build the socket but close it first
|
||||
SOCK_CloseSocket();
|
||||
return UDP_Socket();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void AddBannedIndex(void)
|
||||
|
|
@ -1539,11 +1377,6 @@ static boolean SOCK_Ban(INT32 node)
|
|||
if (node > MAXNETNODES)
|
||||
return false;
|
||||
|
||||
#ifdef NONET
|
||||
(void)ban;
|
||||
return false;
|
||||
#else
|
||||
|
||||
ban = numbans;
|
||||
AddBannedIndex();
|
||||
|
||||
|
|
@ -1563,15 +1396,10 @@ static boolean SOCK_Ban(INT32 node)
|
|||
#endif
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static boolean SOCK_SetBanUsername(const char *username)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)username;
|
||||
return false;
|
||||
#else
|
||||
if (username == NULL || strlen(username) == 0)
|
||||
{
|
||||
username = "Direct IP ban";
|
||||
|
|
@ -1585,15 +1413,10 @@ static boolean SOCK_SetBanUsername(const char *username)
|
|||
|
||||
banned[numbans - 1].username = Z_StrDup(username);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static boolean SOCK_SetBanReason(const char *reason)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)reason;
|
||||
return false;
|
||||
#else
|
||||
if (reason == NULL || strlen(reason) == 0)
|
||||
{
|
||||
reason = "No reason given";
|
||||
|
|
@ -1607,27 +1430,16 @@ static boolean SOCK_SetBanReason(const char *reason)
|
|||
|
||||
banned[numbans - 1].reason = Z_StrDup(reason);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static boolean SOCK_SetUnbanTime(time_t timestamp)
|
||||
{
|
||||
#ifdef NONET
|
||||
(void)reason;
|
||||
return false;
|
||||
#else
|
||||
banned[numbans - 1].timestamp = timestamp;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
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;
|
||||
int gaie;
|
||||
|
||||
|
|
@ -1688,7 +1500,6 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask)
|
|||
I_freeaddrinfo(ai);
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void SOCK_ClearBans(void)
|
||||
|
|
|
|||
|
|
@ -358,10 +358,8 @@ extern menu_t OPTIONS_GameplayItemsDef;
|
|||
extern menuitem_t OPTIONS_Server[];
|
||||
extern menu_t OPTIONS_ServerDef;
|
||||
|
||||
#ifndef NONET
|
||||
extern menuitem_t OPTIONS_ServerAdvanced[];
|
||||
extern menu_t OPTIONS_ServerAdvancedDef;
|
||||
#endif
|
||||
|
||||
extern menuitem_t OPTIONS_Data[];
|
||||
extern menu_t OPTIONS_DataDef;
|
||||
|
|
|
|||
|
|
@ -1142,7 +1142,6 @@ menuitem_t OPTIONS_Server[] =
|
|||
{IT_STRING | IT_CVAR, "Vote Mode Change", "Set how often voting proposes a different gamemode.",
|
||||
NULL, {.cvar = &cv_kartvoterulechanges}, 0, 0},
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
{IT_SPACE | IT_NOTHING, NULL, NULL,
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
|
@ -1171,7 +1170,6 @@ menuitem_t OPTIONS_Server[] =
|
|||
{IT_STRING | IT_SUBMENU, "Advanced...", "Advanced options. Be careful when messing with these!",
|
||||
NULL, {.submenu = &OPTIONS_ServerAdvancedDef}, 0, 0},
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
menu_t OPTIONS_ServerDef = {
|
||||
|
|
@ -1189,7 +1187,6 @@ menu_t OPTIONS_ServerDef = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
#ifndef NONET
|
||||
menuitem_t OPTIONS_ServerAdvanced[] =
|
||||
{
|
||||
|
||||
|
|
@ -1247,7 +1244,6 @@ menu_t OPTIONS_ServerAdvancedDef = {
|
|||
NULL,
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
// data options menu -- see dopt_e
|
||||
menuitem_t OPTIONS_Data[] =
|
||||
|
|
|
|||
|
|
@ -662,14 +662,12 @@ static void M_ChangeCvar(INT32 choice)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef NONET
|
||||
if (cv == &cv_nettimeout || cv == &cv_jointimeout)
|
||||
choice *= (TICRATE/7);
|
||||
else if (cv == &cv_maxsend)
|
||||
choice *= 512;
|
||||
else if (cv == &cv_maxping)
|
||||
choice *= 50;
|
||||
#endif
|
||||
|
||||
CV_AddValue(cv, choice);
|
||||
}
|
||||
|
|
@ -1700,9 +1698,7 @@ void M_Init(void)
|
|||
CV_RegisterVar(&cv_menujam_update);
|
||||
CV_RegisterVar(&cv_menujam);
|
||||
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_serversort);
|
||||
#endif
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
|
@ -4100,7 +4096,6 @@ void M_RefreshServers(INT32 choice)
|
|||
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
#ifdef UPDATE_ALERT
|
||||
static void M_CheckMODVersion(int id)
|
||||
{
|
||||
|
|
@ -4225,8 +4220,6 @@ void M_ServerListFillDebug(void)
|
|||
|
||||
#endif // SERVERLISTDEBUG
|
||||
|
||||
#endif //NONET
|
||||
|
||||
// Ascending order, not descending.
|
||||
// The casts are safe as long as the caller doesn't do anything stupid.
|
||||
#define SERVER_LIST_ENTRY_COMPARATOR(key) \
|
||||
|
|
@ -4266,7 +4259,6 @@ static int ServerListEntryComparator_gametypename(const void *entry1, const void
|
|||
|
||||
void M_SortServerList(void)
|
||||
{
|
||||
#ifndef NONET
|
||||
switch(cv_serversort.value)
|
||||
{
|
||||
case 0: // Ping.
|
||||
|
|
@ -4288,7 +4280,6 @@ void M_SortServerList(void)
|
|||
qsort(serverlist, serverlistcount, sizeof(serverelem_t), ServerListEntryComparator_gametypename);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4588,16 +4579,8 @@ void M_VideoModeMenu(INT32 choice)
|
|||
optionsmenu.vidm_selected = 0;
|
||||
nummodes = VID_NumModes();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
// clean that later: skip windowed mode 0, video modes menu only shows FULL SCREEN modes
|
||||
if (nummodes <= NUMSPECIALMODES)
|
||||
i = 0; // unless we have nothing
|
||||
else
|
||||
i = NUMSPECIALMODES;
|
||||
#else
|
||||
// DOS does not skip mode 0, because mode 0 is ALWAYS present
|
||||
i = 0;
|
||||
#endif
|
||||
for (; i < nummodes && optionsmenu.vidm_nummodes < MAXMODEDESCS; i++)
|
||||
{
|
||||
desc = VID_GetModeName(i);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
|
|||
value [eax] \
|
||||
modify exact [eax edx]
|
||||
#elif defined (__GNUC__) && defined (__i386__) && !defined (NOASM)
|
||||
// DJGPP, i386 linux, cygwin or mingw
|
||||
// i386 linux, cygwin or mingw
|
||||
FUNCMATH FUNCINLINE static inline fixed_t FixedMul(fixed_t a, fixed_t b) // asm
|
||||
{
|
||||
fixed_t ret;
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ typedef off_t off64_t;
|
|||
#else
|
||||
#define PRIdS "u"
|
||||
#endif
|
||||
#elif defined (DJGPP)
|
||||
#define PRIdS "u"
|
||||
#else
|
||||
#define PRIdS "zu"
|
||||
#endif
|
||||
|
|
@ -904,8 +902,6 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png
|
|||
char interfacetxt[] =
|
||||
#ifdef HAVE_SDL
|
||||
"SDL";
|
||||
#elif defined (_WINDOWS)
|
||||
"DirectX";
|
||||
#else
|
||||
"Unknown";
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,9 +51,7 @@ static I_cond MSCond;
|
|||
# define Unlock_state()
|
||||
#endif/*HAVE_THREADS*/
|
||||
|
||||
#ifndef NONET
|
||||
static void Command_Listserv_f(void);
|
||||
#endif
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
|
|
@ -97,7 +95,6 @@ UINT16 current_port = 0;
|
|||
*/
|
||||
void AddMServCommands(void)
|
||||
{
|
||||
#ifndef NONET
|
||||
CV_RegisterVar(&cv_masterserver);
|
||||
CV_RegisterVar(&cv_masterserver_update_rate);
|
||||
CV_RegisterVar(&cv_masterserver_timeout);
|
||||
|
|
@ -111,7 +108,6 @@ void AddMServCommands(void)
|
|||
COM_AddCommand("listserv", Command_Listserv_f);
|
||||
COM_AddCommand("masterserver_update", Update_parameters); // allows people to updates manually in case you were delisted by accident
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
|
@ -180,7 +176,6 @@ char *GetMODVersion(int id)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
/** Gets a list of game servers. Called from console.
|
||||
*/
|
||||
static void Command_Listserv_f(void)
|
||||
|
|
@ -191,7 +186,6 @@ static void Command_Listserv_f(void)
|
|||
HMS_list_servers();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
Finish_registration (void)
|
||||
|
|
|
|||
|
|
@ -62,15 +62,7 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname);
|
|||
|
||||
static boolean S_CheckQueue(void);
|
||||
|
||||
#if defined (_WINDOWS) && !defined (SURROUND) //&& defined (_X86_)
|
||||
#define SURROUND
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
consvar_t cv_samplerate = CVAR_INIT ("samplerate", "44100", 0, CV_Unsigned, NULL); //Alam: For easy hacking?
|
||||
#else
|
||||
consvar_t cv_samplerate = CVAR_INIT ("samplerate", "22050", 0, CV_Unsigned, NULL); //Alam: For easy hacking?
|
||||
#endif
|
||||
|
||||
// stereo reverse
|
||||
consvar_t stereoreverse = CVAR_INIT ("stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL);
|
||||
|
|
@ -993,11 +985,9 @@ void S_SetSfxVolume(INT32 volume)
|
|||
|
||||
void S_ClearSfx(void)
|
||||
{
|
||||
#ifndef DJGPPDOS
|
||||
size_t i;
|
||||
for (i = 1; i < NUMSFX; i++)
|
||||
I_FreeSfx(S_sfx + i);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void S_StopChannel(INT32 cnum)
|
||||
|
|
|
|||
|
|
@ -1733,10 +1733,8 @@ void I_Quit(void)
|
|||
SDLforceUngrabMouse();
|
||||
quiting = SDL_FALSE;
|
||||
M_SaveConfig(NULL); //save game config, cvars..
|
||||
#ifndef NONET
|
||||
D_SaveBan(); // save the ban list
|
||||
M_SaveJoinedIPs();
|
||||
#endif
|
||||
|
||||
// Make sure you lose points for ALT-F4
|
||||
if (Playing())
|
||||
|
|
@ -1856,9 +1854,7 @@ void I_Error(const char *error, ...)
|
|||
// ---
|
||||
|
||||
M_SaveConfig(NULL); // save game config, cvars..
|
||||
#ifndef NONET
|
||||
D_SaveBan(); // save the ban list
|
||||
#endif
|
||||
G_SaveGameData(); // Tails 12-08-2002
|
||||
|
||||
// Shutdown. Here might be other errors.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue