Fixed problems with snapshot system

Fixed problems with snapshot system

diff --git a/src/engine/client/cl_console.cpp b/src/engine/client/cl_console.cpp
index 67d06fa..4ba7c3c 100644
--- a/src/engine/client/cl_console.cpp
+++ b/src/engine/client/cl_console.cpp
@@ -910,7 +910,7 @@ void Con_DrawNotify( void )
         }
         text = con.text + ( i % con.totallines ) * con.linewidth;
         
-        if( cl.snap.ps.pm_type != PM_INTERMISSION && cls.keyCatchers & ( KEYCATCH_UI | KEYCATCH_CGAME ) )
+        if( cl.snapServer.ps.pm_type != PM_INTERMISSION && cls.keyCatchers & ( KEYCATCH_UI | KEYCATCH_CGAME ) )
         {
             continue;
         }
diff --git a/src/engine/client/cl_input.cpp b/src/engine/client/cl_input.cpp
index 2dd5256..6b3034e 100644
--- a/src/engine/client/cl_input.cpp
+++ b/src/engine/client/cl_input.cpp
@@ -594,7 +594,7 @@ void IN_ButtonUp( void )
 
 
 /*void IN_CenterView (void) {
-	cl.viewangles[PITCH] = -SHORT2ANGLE(cl.snap.ps.delta_angles[PITCH]);
+	cl.viewangles[PITCH] = -SHORT2ANGLE(cl.snapServer.ps.delta_angles[PITCH]);
 }*/
 
 
@@ -719,7 +719,7 @@ void CL_KeyMove( usercmd_t* cmd )
     forward -= movespeed * CL_KeyState( &kb[KB_BACK] );
     
     // fretn - moved this to bg_pmove.c
-    //if (!(cl.snap.ps.persistant[PERS_HWEAPON_USE]))
+    //if (!(cl.snapServer.ps.persistant[PERS_HWEAPON_USE]))
     //{
     cmd->forwardmove = ClampChar( forward );
     cmd->rightmove = ClampChar( side );
@@ -984,11 +984,11 @@ void CL_MouseMove( usercmd_t* cmd )
             my = cl_sensitivity->value * ( my + ( ( my < 0 ) ? -power[1] : power[1] ) * cl_mouseAccelOffset->value );
             
             /*	NERVE - SMF - this has moved to CG_CalcFov to fix zoomed-in/out transition movement bug
-            	if ( cl.snap.ps.stats[STAT_ZOOMED_VIEW] ) {
-            		if(cl.snap.ps.weapon == WP_SNIPERRIFLE) {
+            	if ( cl.snapServer.ps.stats[STAT_ZOOMED_VIEW] ) {
+            		if(cl.snapServer.ps.weapon == WP_SNIPERRIFLE) {
             			accelSensitivity *= 0.1;
             		}
-            		else if(cl.snap.ps.weapon == WP_SNOOPERSCOPE) {
+            		else if(cl.snapServer.ps.weapon == WP_SNOOPERSCOPE) {
             			accelSensitivity *= 0.2;
             		}
             	}
@@ -1001,7 +1001,7 @@ void CL_MouseMove( usercmd_t* cmd )
 // Ridah, experimenting with a slow tracking gun
 #if 0
     // Rafael - mg42
-    if( cl.snap.ps.persistant[PERS_HWEAPON_USE] )
+    if( cl.snapServer.ps.persistant[PERS_HWEAPON_USE] )
     {
         mx *= 2.5;				//(accelSensitivity * 0.1);
         my *= 2;				//(accelSensitivity * 0.075);
@@ -1390,7 +1390,7 @@ void CL_WritePacket( void )
         }
         
         // begin a client move command
-        if( cl_nodelta->integer || !cl.snap.valid || clc.demowaiting || clc.serverMessageSequence != cl.snap.messageNum )
+        if( cl_nodelta->integer || !cl.snapServer.valid || clc.demowaiting || clc.serverMessageSequence != cl.snapServer.messageNum )
         {
             MSG_WriteByte( &buf, clc_moveNoDelta );
         }
diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp
index 1b93ab4..03ccfcd 100644
--- a/src/engine/client/cl_main.cpp
+++ b/src/engine/client/cl_main.cpp
@@ -1206,6 +1206,10 @@ void CL_Disconnect( bool showMainMenu )
         CL_WritePacket();
     }
 #endif
+    
+    // Remove pure paks
+    fileSystem->PureServerSetLoadedPaks( "", "" );
+    
     CL_ClearState();
     
     // wipe the client connection
@@ -1216,6 +1220,8 @@ void CL_Disconnect( bool showMainMenu )
         CL_ClearStaticDownload();
     }
     
+    cls.state = CA_DISCONNECTED;
+    
     // allow cheats locally
     //cvarSystem->Set( "sv_cheats", "1" );
     
@@ -2114,19 +2120,6 @@ void CL_DownloadsComplete( void )
 #endif
     valueType*    fn;
     
-    if( cls.state < CA_CONNECTING )
-    {
-        //	a download has completed outside of a game
-        return;
-    }
-    
-    if( cls.state == CA_ACTIVE )
-    {
-        //	a download has completed while the game is playing
-        //	inform the client that its download is complete
-        cmdBufferSystem->ExecuteText( EXEC_INSERT, "donedl" );
-        return;
-    }
     
     // DHM - Nerve :: Auto-update (not finished yet)
     if( autoupdateStarted )
@@ -2406,11 +2399,14 @@ void CL_CheckForResend( void )
         case CA_CONNECTING:
             if( clc.connectPacketCount == 1 )
             {
-                cls.authorizeAuthCookie = ( ( rand() << 16 ) ^ rand() ) ^ Com_Milliseconds();
-                
+                cls.authorizeAuthCookie = rand();
             }
             
-            CL_RequestAuthorization();
+            // requesting a challenge .. IPv6 users always get in as authorize server supports no ipv6.
+            if( clc.serverAddress.type == NA_IP )
+            {
+                CL_RequestAuthorization();
+            }
             
             Com_sprintf( data, sizeof( data ), "getchallenge %d %s %s %i", clc.challenge, GAMENAME_FOR_MASTER, cl_guid->string, cls.authorizeAuthCookie );
             networkChainSystem->OutOfBandPrint( NS_CLIENT, clc.serverAddress, "%s", data );
@@ -2421,18 +2417,18 @@ void CL_CheckForResend( void )
             port = cvarSystem->VariableValue( "net_qport" );
             
             Q_strncpyz( info, cvarSystem->InfoString( CVAR_USERINFO ), sizeof( info ) );
-            Info_SetValueForKey( info, "protocol", va( "%i", com_protocol->integer ) );
+            Info_SetValueForKey( info, "protocol", va( "%i", ETPROTOCOL_VERSION ) );
             Info_SetValueForKey( info, "qport", va( "%i", port ) );
             Info_SetValueForKey( info, "challenge", va( "%i", clc.challenge ) );
             
             ::strcpy( data, "connect " );
-            data[8] = '\"';
+            data[8] = '"';
             
-            for( i = 0; i < ::strlen( info ); i++ )
+            for( i = 0; i < strlen( info ); i++ )
             {
                 data[9 + i] = info[i];	// + (clc.challenge)&0x3;
             }
-            data[9 + i] = '\"';
+            data[9 + i] = '"';
             data[10 + i] = 0;
             
             networkChainSystem->OutOfBandData( NS_CLIENT, clc.serverAddress, ( uchar8* )&data[0], i + 10 );
@@ -3131,7 +3127,7 @@ void CL_Frame( sint msec )
         return;
     }
     
-    if( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI ) && !com_sv_running->integer && clc.demoplaying )
+    if( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI ) && !com_sv_running->integer && clc.demoplaying && uivm )
     {
         // if disconnected, bring up the menu
         soundSystem->StopAllSounds();
diff --git a/src/engine/client/client.h b/src/engine/client/client.h
index cc05c57..2008d3c 100644
--- a/src/engine/client/client.h
+++ b/src/engine/client/client.h
@@ -105,7 +105,7 @@ typedef struct
     
     // to disconnect, preventing debugging breaks from
     // causing immediate disconnects on continue
-    clSnapshot_t    snap;														// latest received from server
+    clSnapshot_t    snapServer;														// latest received from server
     sint             serverTime;													// may be paused during play
     sint             oldServerTime;												// to prevent time from flowing bakcwards
     sint             oldFrameServerTime;											// to check tournament restarts
diff --git a/src/engine/client/clientGUI.cpp b/src/engine/client/clientGUI.cpp
index 400695f..0bbf138 100644
--- a/src/engine/client/clientGUI.cpp
+++ b/src/engine/client/clientGUI.cpp
@@ -77,7 +77,7 @@ void idClientGUISystemLocal::GetClientState( uiClientState_t* state )
     Q_strncpyz( state->servername, cls.servername, sizeof( state->servername ) );
     Q_strncpyz( state->updateInfoString, cls.updateInfoString, sizeof( state->updateInfoString ) );
     Q_strncpyz( state->messageString, clc.serverMessage, sizeof( state->messageString ) );
-    state->clientNum = cl.snap.ps.clientNum;
+    state->clientNum = cl.snapServer.ps.clientNum;
 }
 
 /*

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

GitHub
sha: f6e0eef0

© GrangerHub. All rights reserved. Tremulous © Darklegion Development. Granger by err-overflow and MoP licensed CC-BY-SA-2.5