Moved network into C++

Moved network into C++

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42b11c9..83e9541 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -261,7 +261,6 @@ set( QCOMMONLIST_SOURCES
 	${MOUNT_DIR}/qcommon/common.cpp
 	${MOUNT_DIR}/qcommon/msg.cpp
 	${MOUNT_DIR}/qcommon/net_chan.cpp
-	${MOUNT_DIR}/qcommon/net_ip.cpp
 	${MOUNT_DIR}/qcommon/parse.cpp
 )
 
@@ -273,6 +272,7 @@ set( FRAMEWORKS_HEADERS
 	${MOUNT_DIR}/API/CmdDelay_api.h
 	${MOUNT_DIR}/API/MD4_api.h
 	${MOUNT_DIR}/API/MD5_api.h
+	${MOUNT_DIR}/API/Network_api.h
 	${MOUNT_DIR}/framework/FileSystem.h
 	${MOUNT_DIR}/framework/CVarSystem.h
 	${MOUNT_DIR}/framework/CmdSystem.h
@@ -285,6 +285,7 @@ set( FRAMEWORKS_HEADERS
 	${MOUNT_DIR}/framework/Puff.h
 	${MOUNT_DIR}/framework/Unzip.h
 	${MOUNT_DIR}/framework/SurfaceFlags_Tech3.h
+	${MOUNT_DIR}/framework/Network.h
 )
 
 set( FRAMEWORKS_SOURCES
@@ -299,6 +300,7 @@ set( FRAMEWORKS_SOURCES
 	${MOUNT_DIR}/framework/MD5.cpp
 	${MOUNT_DIR}/framework/Puff.cpp
 	${MOUNT_DIR}/framework/Unzip.cpp
+	${MOUNT_DIR}/framework/Network.cpp
 )
 
 set( CLIENTLIST_HEADERS
@@ -308,8 +310,10 @@ set( CLIENTLIST_HEADERS
 	${MOUNT_DIR}/client/clientGame.h
 	${MOUNT_DIR}/client/clientGUI.h
 	${MOUNT_DIR}/client/clientLAN.h
+	${MOUNT_DIR}/client/clientScreen.h
 	${MOUNT_DIR}/client/keycodes.h
 	${MOUNT_DIR}/client/keys.h
+	${MOUNT_DIR}/API/clientScreen_api.h
 	${MOUNT_DIR}/API/clientAVI_api.h
 	${MOUNT_DIR}/API/clientGame_api.h
 	${MOUNT_DIR}/API/clientGUI_api.h
@@ -326,7 +330,7 @@ set( CLIENTLIST_SOURCES
 	${MOUNT_DIR}/client/cl_main.cpp
 	${MOUNT_DIR}/client/cl_net_chan.cpp
 	${MOUNT_DIR}/client/cl_parse.cpp
-	${MOUNT_DIR}/client/cl_scrn.cpp
+	${MOUNT_DIR}/client/clientScreen.cpp
 	${MOUNT_DIR}/client/clientBrowser.cpp
 	${MOUNT_DIR}/client/clientBrowser.h
 	${MOUNT_DIR}/client/clientGUI.h
diff --git a/src/engine/API/Network_api.h b/src/engine/API/Network_api.h
new file mode 100644
index 0000000..13f7e1d
--- /dev/null
+++ b/src/engine/API/Network_api.h
@@ -0,0 +1,66 @@
+////////////////////////////////////////////////////////////////////////////////////////
+// Copyright(C) 2019 - 2020 Dusan Jocic <dusanjocic@msn.com>
+//
+// This file is part of the OpenWolf GPL Source Code.
+// OpenWolf Source Code is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// OpenWolf Source Code is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with OpenWolf Source Code.  If not, see <http://www.gnu.org/licenses/>.
+//
+// In addition, the OpenWolf Source Code is also subject to certain additional terms.
+// You should have received a copy of these additional terms immediately following the
+// terms and conditions of the GNU General Public License which accompanied the
+// OpenWolf Source Code. If not, please request a copy in writing from id Software
+// at the address below.
+//
+// If you have questions concerning this license or the applicable additional terms,
+// you may contact in writing id Software LLC, c/o ZeniMax Media Inc.,
+// Suite 120, Rockville, Maryland 20850 USA.
+//
+// -------------------------------------------------------------------------------------
+// File name:   Network_api.h
+// Created:
+// Compilers:   Visual Studio 2019, gcc 7.3.0
+// Description:
+// -------------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __NETWORK_API_H__
+#define __NETWORK_API_H__
+
+//
+// idNetworkSystem
+//
+class idNetworkSystem
+{
+public:
+    virtual bool StringToAdr( pointer s, netadr_t* a, netadrtype_t family ) = 0;
+    virtual bool CompareBaseAdrMask( netadr_t a, netadr_t b, sint netmask ) = 0;
+    virtual bool CompareBaseAdr( netadr_t a, netadr_t b ) = 0;
+    virtual pointer AdrToString( netadr_t a ) = 0;
+    virtual pointer AdrToStringwPort( netadr_t a ) = 0;
+    virtual bool CompareAdr( netadr_t a, netadr_t b ) = 0;
+    virtual bool IsLocalAddress( netadr_t adr ) = 0;
+    virtual bool GetPacket( netadr_t* net_from, msg_t* net_message ) = 0;
+    virtual void SendPacket( sint length, const void* data, netadr_t to ) = 0;
+    virtual bool IsLANAddress( netadr_t adr ) = 0;
+    virtual void ShowIP( void ) = 0;
+    virtual void JoinMulticast6( void ) = 0;
+    virtual void LeaveMulticast6( void ) = 0;
+    virtual void Init( void ) = 0;
+    virtual void Shutdown( void ) = 0;
+    virtual void Sleep( sint msec ) = 0;
+    virtual void Restart_f( void ) = 0;
+};
+
+extern idNetworkSystem* networkSystem;
+
+#endif //!__THREADS_API_H__
diff --git a/src/engine/API/cgame_api.h b/src/engine/API/cgame_api.h
index 0683079..6dda633 100644
--- a/src/engine/API/cgame_api.h
+++ b/src/engine/API/cgame_api.h
@@ -112,8 +112,10 @@ struct cgameImports_t
     idCmdBufferSystem* cmdBufferSystem;
     idCmdSystem* cmdSystem;
     idSystem* idsystem;
+#ifndef DEDICATED
     idClientGUISystem* idGUISystem;
     idClientScreenSystem* clientScreenSystem;
+#endif
 };
 
 class idCGame
diff --git a/src/engine/API/gui_api.h b/src/engine/API/gui_api.h
index 6b34eab..3fca3d5 100644
--- a/src/engine/API/gui_api.h
+++ b/src/engine/API/gui_api.h
@@ -213,10 +213,12 @@ struct guiImports_t
     idCmdBufferSystem* cmdBufferSystem;
     idCmdSystem* cmdSystem;
     idSystem* idsystem;
+#ifndef DEDICATED
     idCGame* idcgame;
     idClientLANSystem* idLANSystem;
     idClientGUISystem* idGUISystem;
     idClientScreenSystem* clientScreenSystem;
+#endif
 };
 
 //
diff --git a/src/engine/GPURenderer/r_glimp.cpp b/src/engine/GPURenderer/r_glimp.cpp
index abb3d3b..44859a6 100644
--- a/src/engine/GPURenderer/r_glimp.cpp
+++ b/src/engine/GPURenderer/r_glimp.cpp
@@ -1522,6 +1522,7 @@ void GLimp_Shutdown( void )
     
     ::memset( &glConfig, 0, sizeof( glConfig ) );
     ::memset( &glState, 0, sizeof( glState ) );
+    ::memset( &glRefConfig, 0, sizeof( glRefConfig ) );
 }
 
 /*
diff --git a/src/engine/client/cl_input.cpp b/src/engine/client/cl_input.cpp
index 502cd06..2dd5256 100644
--- a/src/engine/client/cl_input.cpp
+++ b/src/engine/client/cl_input.cpp
@@ -1272,7 +1272,7 @@ bool CL_ReadyToSendPacket( void )
     }
     
     // send every frame for LAN
-    if( Net_IsLANAddress( clc.netchan.remoteAddress ) )
+    if( networkSystem->IsLANAddress( clc.netchan.remoteAddress ) )
     {
         return true;
     }
diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp
index 172b169..b245ffc 100644
--- a/src/engine/client/cl_main.cpp
+++ b/src/engine/client/cl_main.cpp
@@ -376,7 +376,7 @@ void CL_Record_f( void )
     
     // ATVI Wolfenstein Misc #479 - changing this to a warning
     // sync 0 doesn't prevent recording, so not forcing it off .. everyone does g_sync 1 ; record ; g_sync 0 ..
-    if( NET_IsLocalAddress( clc.serverAddress ) && !cvarSystem->VariableValue( "g_synchronousClients" ) )
+    if( networkSystem->IsLocalAddress( clc.serverAddress ) && !cvarSystem->VariableValue( "g_synchronousClients" ) )
     {
         Com_Printf( S_COLOR_YELLOW "WARNING: You should set 'g_synchronousClients 1' for smoother demo recording\n" );
     }
@@ -1419,7 +1419,7 @@ void CL_RequestMotd( void )
     }
     
     Com_DPrintf( "%s resolved to %s\n", MASTER_SERVER_NAME,
-                 NET_AdrToStringwPort( cls.updateServer ) );
+                 networkSystem->AdrToStringwPort( cls.updateServer ) );
                  
     info[0] = 0;
     
@@ -1610,7 +1610,7 @@ void CL_Connect_f( void )
         clc.serverAddress.port = BigShort( PORT_SERVER );
     }
     
-    serverString = NET_AdrToStringwPort( clc.serverAddress );

[... diff too long, it was truncated ...]

GitHub
sha: b8083ce5