Moved client parsing in C++

Moved client parsing in C++

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08e4e90..d50edb9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -320,6 +320,7 @@ set( CLIENTLIST_HEADERS
 	${MOUNT_DIR}/API/clientGame_api.h
 	${MOUNT_DIR}/API/clientGUI_api.h
 	${MOUNT_DIR}/API/clientLAN_api.h
+	${MOUNT_DIR}/client/clientParse.h
 )
 
 set( CLIENTLIST_SOURCES
@@ -331,7 +332,7 @@ set( CLIENTLIST_SOURCES
 	${MOUNT_DIR}/client/cl_keys.cpp
 	${MOUNT_DIR}/client/cl_main.cpp
 	${MOUNT_DIR}/client/cl_net_chan.cpp
-	${MOUNT_DIR}/client/cl_parse.cpp
+	${MOUNT_DIR}/client/clientParse.cpp
 	${MOUNT_DIR}/client/clientScreen.cpp
 	${MOUNT_DIR}/client/clientBrowser.cpp
 	${MOUNT_DIR}/client/clientBrowser.h
diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp
index be35fc4..1b93ab4 100644
--- a/src/engine/client/cl_main.cpp
+++ b/src/engine/client/cl_main.cpp
@@ -597,7 +597,8 @@ void CL_ReadDemoMessage( void )
     
     clc.lastPacketTime = cls.realtime;
     buf.readcount = 0;
-    CL_ParseServerMessage( &buf );
+    
+    idClientParseSystemLocal::ParseServerMessage( &buf );
 }
 
 /*
@@ -2918,7 +2919,7 @@ void CL_PacketEvent( netadr_t from, msg_t* msg )
     clc.serverMessageSequence = LittleLong( *( sint* )msg->data );
     
     clc.lastPacketTime = cls.realtime;
-    CL_ParseServerMessage( msg );
+    idClientParseSystemLocal::ParseServerMessage( msg );
     
     //
     // we don't know if it is ok to save a demo message until
diff --git a/src/engine/client/cl_parse.cpp b/src/engine/client/cl_parse.cpp
deleted file mode 100644
index e3bab52..0000000
--- a/src/engine/client/cl_parse.cpp
+++ /dev/null
@@ -1,1074 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////
-// Copyright(C) 1999 - 2010 id Software LLC, a ZeniMax Media company.
-// Copyright(C) 2011 - 2019 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:   cl_parse.cpp
-// Version:     v1.01
-// Created:
-// Compilers:   Visual Studio 2019, gcc 7.3.0
-// Description: parse a message received from the server
-// -------------------------------------------------------------------------------------
-////////////////////////////////////////////////////////////////////////////////////////
-
-#include <framework/precompiled.h>
-
-valueType* svc_strings[256] =
-{
-    "svc_bad",
-    
-    "svc_nop",
-    "svc_gamestate",
-    "svc_configstring",
-    "svc_baseline",
-    "svc_serverCommand",
-    "svc_download",
-    "svc_snapshot",
-    "svc_extension",
-    "svc_EOF"
-};
-
-void SHOWNET( msg_t* msg, valueType* s )
-{
-    if( cl_shownet->integer >= 2 )
-    {
-        Com_Printf( "%3i:%s\n", msg->readcount - 1, s );
-    }
-}
-
-
-/*
-=========================================================================
-
-MESSAGE PARSING
-
-=========================================================================
-*/
-#if 1
-
-sint             entLastVisible[MAX_CLIENTS];
-
-bool isEntVisible( entityState_t* ent )
-{
-    trace_t         tr;
-    vec3_t          start, end, temp;
-    vec3_t          forward, up, right, right2;
-    float32           view_height;
-    
-    VectorCopy( cl.cgameClientLerpOrigin, start );
-    start[2] += ( cl.snap.ps.viewheight - 1 );
-    if( cl.snap.ps.leanf != 0 )
-    {
-        vec3_t          lright, v3ViewAngles;
-        
-        VectorCopy( cl.snap.ps.viewangles, v3ViewAngles );
-        v3ViewAngles[2] += cl.snap.ps.leanf / 2.0f;
-        AngleVectors( v3ViewAngles, nullptr, lright, nullptr );
-        VectorMA( start, cl.snap.ps.leanf, lright, start );
-    }
-    
-    VectorCopy( ent->pos.trBase, end );
-    
-    // Compute vector perpindicular to view to ent
-    VectorSubtract( end, start, forward );
-    VectorNormalizeFast( forward );
-    VectorSet( up, 0, 0, 1 );
-    CrossProduct( forward, up, right );
-    VectorNormalizeFast( right );
-    VectorScale( right, 10, right2 );
-    VectorScale( right, 18, right );
-    
-    // Set viewheight
-    if( ent->animMovetype )
-    {
-        view_height = 16;
-    }
-    else
-    {
-        view_height = 40;
-    }
-    
-    // First, viewpoint to viewpoint
-    end[2] += view_height;
-    collisionModelManager->BoxTrace( &tr, start, end, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    
-    // First-b, viewpoint to top of head
-    end[2] += 16;
-    collisionModelManager->BoxTrace( &tr, start, end, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    end[2] -= 16;
-    
-    // Second, viewpoint to ent's origin
-    end[2] -= view_height;
-    collisionModelManager->BoxTrace( &tr, start, end, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    
-    // Third, to ent's right knee
-    VectorAdd( end, right, temp );
-    temp[2] += 8;
-    collisionModelManager->BoxTrace( &tr, start, temp, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    
-    // Fourth, to ent's right shoulder
-    VectorAdd( end, right2, temp );
-    if( ent->animMovetype )
-    {
-        temp[2] += 28;
-    }
-    else
-    {
-        temp[2] += 52;
-    }
-    collisionModelManager->BoxTrace( &tr, start, temp, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    
-    // Fifth, to ent's left knee
-    VectorScale( right, -1, right );
-    VectorScale( right2, -1, right2 );
-    VectorAdd( end, right2, temp );
-    temp[2] += 2;
-    collisionModelManager->BoxTrace( &tr, start, temp, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    
-    // Sixth, to ent's left shoulder
-    VectorAdd( end, right, temp );
-    if( ent->animMovetype )
-    {
-        temp[2] += 16;
-    }
-    else
-    {
-        temp[2] += 36;
-    }
-    collisionModelManager->BoxTrace( &tr, start, temp, nullptr, nullptr, 0, CONTENTS_SOLID, TT_AABB );
-    if( tr.fraction == 1.f )
-    {
-        return true;
-    }
-    
-    return false;
-}
-
-#endif
-
-/*
-==================
-CL_DeltaEntity
-
-Parses deltas from the given base and adds the resulting entity
-to the current frame
-==================
-*/
-void CL_DeltaEntity( msg_t* msg, clSnapshot_t* frame, sint newnum, entityState_t* old, bool unchanged )
-{
-    entityState_t*  state;
-    
-    // save the parsed entity state into the big circular buffer so

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

GitHub
sha: 086ce8bc