void CL_ReadPackets( void ) { CL_ReadNetMessage(); cl.lerpFrac = CL_LerpPoint(); cl.thirdperson = clgame.dllFuncs.CL_IsThirdPerson(); #if 0 // keep cheat cvars are unchanged if( cl.maxclients > 1 && cls.state == ca_active && host.developer <= 1 ) Cvar_SetCheatState(); #endif // singleplayer never has connection timeout if( NET_IsLocalAddress( cls.netchan.remote_address )) return; // check timeout if( cls.state >= ca_connected && !cls.demoplayback && cls.state != ca_cinematic ) { if( host.realtime - cls.netchan.last_received > cl_timeout->value ) { if( ++cl.timeoutcount > 5 ) // timeoutcount saves debugger { Msg( "\nServer connection timed out.\n" ); CL_Disconnect(); CL_ClearEdicts(); return; } } } else cl.timeoutcount = 0; }
void CLQ2_FixCvarCheats() { if ( !String::Cmp( cl.q2_configstrings[ Q2CS_MAXCLIENTS ], "1" ) || !cl.q2_configstrings[ Q2CS_MAXCLIENTS ][ 0 ] ) { return; // single player can cheat } Cvar_SetCheatState(); }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s; char key[MAX_INFO_KEY]; char value[MAX_INFO_VALUE]; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); s = Info_ValueForKey( systemInfo, "helpUsObi" ); if ( atoi(s) == 0 ) { Cvar_SetCheatState(); } // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } Cvar_Set( key, value ); } extern cvar_t *s_language; if ( ( Q_stricmp( "DEUTSCH", s_language->string ) == 0 )//voice language is German || (sp_language->integer == SP_LANGUAGE_GERMAN )//text language is German || Cvar_VariableIntegerValue("ui_iscensored") == 1 ) { Cvar_Set( "g_dismemberment", "0"); } }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame(void) { const char *info; const char *mapname; int t1, t2; t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO]; mapname = Info_ValueForKey(info, "mapname"); Com_sprintf(cl.mapname, sizeof(cl.mapname), "maps/%s.bsp", mapname); // load the dll cgvm = VM_Create("cgame", CL_CgameSystemCalls, VMI_NATIVE); if (!cgvm) { Com_Error(ERR_DROP, "VM_Create on cgame failed"); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped // bani - added clc.demoplaying, since some mods need this at init time, and drawactiveframe is too late for them VM_Call(cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum, clc.demoplaying, qtrue); // reset any CVAR_CHEAT cvars registered by cgame if (!clc.demoplaying && !cl_connectedToCheatServer) { Cvar_SetCheatState(); } // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf("CL_InitCGame: %5.2f seconds\n", (t2 - t1) / 1000.0); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify(); // update the memory usage file CL_UpdateLevelHunkUsage(); }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; vmInterpret_t interpret; t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_cgame" ); } cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret ); if ( !cgvm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_DPrintf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify (); CL_WriteClientLog( va("`~=-----------------=~`\n MAP: %s \n`~=-----------------=~`\n", mapname ) ); }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s; char key[MAX_INFO_KEY]; char value[MAX_INFO_VALUE]; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); s = Info_ValueForKey( systemInfo, "helpUsObi" ); cl_connectedToCheatServer = atoi( s ); if ( !cl_connectedToCheatServer ) { Cvar_SetCheatState(); } // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } Cvar_Set( key, value ); } //if ( Cvar_VariableIntegerValue("ui_iscensored") == 1 ) //{ // Cvar_Set( "g_dismemberment", "0"); //} }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; qboolean gameSet; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // NOTE TTimo: // when the serverId changes, any further messages we send to the server will use this new serverId // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } s = Info_ValueForKey( systemInfo, "sv_cheats" ); if ( atoi(s) == 0 ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } // ehw! if ( !Q_stricmp( key, "fs_game" ) ) { gameSet = qtrue; } Cvar_Set( key, value ); } // if game folder should not be set and it is set at the client side if ( !gameSet && *Cvar_VariableString("fs_game") ) { Cvar_Set( "fs_game", "" ); } cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); }
void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode //OJKFIXME: pure servers CL_BindCGame(); cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped CGVM_Init( clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re->EndRegistration(); // make sure everything is paged in // if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify (); #ifdef _DONETPROFILE_ ClReadProf().Reset(); #endif }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; qboolean gameSet; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } s = Info_ValueForKey( systemInfo, "sv_cheats" ); if ( atoi(s) == 0 ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } // ehw! if ( !Q_stricmp( key, "fs_game" ) ) { gameSet = qtrue; } Cvar_Set( key, value ); } // if game folder should not be set and it is set at the client side if ( !gameSet && *Cvar_VariableString("fs_game") ) { Cvar_Set( "fs_game", "" ); } cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); }
/* ================= CL_Precache_f The server will send this command right before allowing the client into the server ================= */ void CL_Precache_f( void ) { int spawncount; spawncount = Q_atoi( Cmd_Argv( 1 )); CL_PrepSound(); CL_PrepVideo(); Cvar_SetCheatState( false ); BF_WriteByte( &cls.netchan.message, clc_stringcmd ); BF_WriteString( &cls.netchan.message, va( "begin %i\n", spawncount )); }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // NOTE TTimo: // when the serverId changes, any further messages we send to the server will use this new serverId // show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); memset( &entLastVisible, 0, sizeof( entLastVisible ) ); // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } s = Info_ValueForKey( systemInfo, "sv_cheats" ); if ( atoi( s ) == 0 ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } Cvar_Set( key, value ); } cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); }
// The player's clipping box goes from (-16 -16 -24) to (16 16 32) from // the entity origin, so any view position inside that will be valid void VQH_RenderView() { if ( GGameType & GAME_QuakeWorld ) { cl.qh_simangles[ ROLL ] = 0; // FIXME @@@ } if ( cls.state != CA_ACTIVE || ( !( GGameType & ( GAME_QuakeWorld | GAME_HexenWorld ) ) && clc.qh_signon != SIGNONS ) ) { return; } if ( GGameType & ( GAME_QuakeWorld | GAME_HexenWorld ) && !cl.qh_validsequence ) { return; } VQH_CalcRefdef(); // don't allow cheats in multiplayer if ( GGameType & ( GAME_QuakeWorld | GAME_HexenWorld ) || cl.qh_maxclients > 1 ) { Cvar_SetCheatState(); if ( GGameType & GAME_QuakeWorld && !String::Atoi( Info_ValueForKey( cl.qh_serverinfo, "watervis" ) ) ) { Cvar_Set( "r_wateralpha", "1" ); } } if ( GGameType & ( GAME_QuakeWorld | GAME_HexenWorld ) ) { VQH_DropPunchAngle(); } if ( cl.qh_intermission ) { // intermission / finale rendering VQH_CalcIntermissionRefdef(); } else if ( GGameType & GAME_QuakeWorld ) { qwframe_t* view_frame = &cl.qw_frames[ clc.netchan.incomingSequence & UPDATE_MASK_QW ]; qwplayer_state_t* view_message = &view_frame->playerstate[ cl.playernum ]; VQH_CalcRefdef( view_message, NULL ); } else if ( GGameType & GAME_HexenWorld ) { hwframe_t* view_frame = &cl.hw_frames[ clc.netchan.incomingSequence & UPDATE_MASK_HW ]; hwplayer_state_t* view_message = &view_frame->playerstate[ cl.playernum ]; VQH_CalcRefdef( NULL, view_message ); } else { if ( !cl.qh_paused /* && (sv.maxclients > 1 || in_keyCatchers == 0) */ ) { VQH_CalcRefdef( NULL, NULL ); } } VQH_RenderScene(); VQH_DrawCrosshair(); }
void CL_InitCGame( void ) { const char *info; const char *mapname; //int t1, t2; //t1 = Sys_Milliseconds(); // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); cls.state = CA_LOADING; // init for this gamestate VM_Call( CG_INIT, clc.serverCommandSequence ); // reset any CVAR_CHEAT cvars registered by cgame if ( !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; //t2 = Sys_Milliseconds(); //Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in // if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify (); }
void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_ui" ); } uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v == UI_OLD_API_VERSION) { // Com_Printf(S_COLOR_YELLOW "WARNING: loading old Quake III Arena User Interface version %d\n", v ); // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); } else if (v != UI_API_VERSION) { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } else { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) ); } // reset any CVAR_CHEAT cvars registered by ui if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; qboolean gameSet; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // NOTE TTimo: // when the serverId changes, any further messages we send to the server will use this new serverId // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); #ifdef USE_VOIP s = Info_ValueForKey( systemInfo, "sv_voipProtocol" ); clc.voipEnabled = !Q_stricmp(s, "opus"); #endif // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } s = Info_ValueForKey( systemInfo, "sv_cheats" ); cl_connectedToCheatServer = atoi( s ); if ( !cl_connectedToCheatServer ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } // ehw! if (!Q_stricmp(key, "fs_game")) { char filename[MAX_QPATH]; char *title; if ( gameSet ) continue; if(FS_CheckDirTraversal(value)) { Com_Printf(S_COLOR_YELLOW "WARNING: Server sent invalid fs_game value %s\n", value); continue; } // create game title file if does not exist title = Info_ValueForKey( systemInfo, "sv_gameTitle" ); Com_sprintf( filename, sizeof ( filename ), "%s/description.txt", value ); if ( ( cl_allowDownload->integer & DLF_ENABLE ) && *title && !FS_SV_RW_FileExists( filename ) ) { fileHandle_t f = FS_SV_FOpenFileWrite( filename ); FS_Write( s, strlen( title ), f ); FS_FCloseFile( f ); } gameSet = qtrue; } Cvar_Server_Set(key, value); } // game folder must be set if ( !gameSet ) { Com_Error( ERR_DROP, "fs_game not set on server" ); } }
void CL_SystemInfoChanged() { const char *s, *t; // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } const char* systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // when the serverId changes, any further messages we send to the server will use this new serverId // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this new serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); s = Info_ValueForKey( systemInfo, "sv_cheats" ); if ( atoi(s) == 0 ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); qbool gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { char key[BIG_INFO_KEY], value[BIG_INFO_VALUE]; Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } // ehw! if (!Q_stricmp(key, "fs_game")) { if (FS_CheckDirTraversal(value)) { Com_Printf("WARNING: Server sent invalid fs_game value %s\n", value); continue; } gameSet = qtrue; } // servers are only allowed to modify specific sets of cvars int flags = Cvar_Flags(key); if (flags == CVAR_NONEXISTENT) { Cvar_Get( key, value, CVAR_SERVER_CREATED | CVAR_ROM ); } else if (flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED)) { Cvar_Set( key, value ); } } // if game folder should not be set and it is set at the client side if ( !gameSet && *Cvar_VariableString("fs_game") ) { Cvar_Set( "fs_game", "" ); } cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); }
void CL_InitUI( void ) { int v; vmInterpret_t interpret; // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_ui" ); } uivm = VM_Create( "ui", CL_UISystemCalls, interpret ); if ( !uivm ) { Com_Error( ERR_FATAL, "VM_Create on UI failed" ); } // Don't use ui messagemode unless it askes us to Cvar_Set( "ui_useMessagemode", "0" ); // sanity check v = VM_Call( uivm, UI_GETAPIVERSION ); if (v == UI_OLD_API_VERSION || v == UI_API_VERSION) { // init for this gamestate VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE)); } else { Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION ); cls.uiStarted = qfalse; } // See who gets control of messagemodes if ( !Cvar_VariableIntegerValue( "ui_useMessagemode" ) ) { // client messagemode commands Cmd_RemoveCommand( "messagemode" ); Cmd_RemoveCommand( "messagemode2" ); Cmd_RemoveCommand( "messagemode3" ); Cmd_RemoveCommand( "messagemode4" ); Cmd_RemoveCommand( "messagemode5" ); Cmd_RemoveCommand( "messagemode6" ); Cmd_RemoveCommand( "prompt" ); Cmd_AddCommand( "messagemode", Con_MessageMode_f ); Cmd_AddCommand( "messagemode2", Con_MessageMode2_f ); Cmd_AddCommand( "messagemode3", Con_MessageMode3_f ); Cmd_AddCommand( "messagemode4", Con_MessageMode4_f ); Cmd_AddCommand( "messagemode5", Con_MessageMode5_f ); Cmd_AddCommand( "messagemode6", Con_MessageMode6_f ); Cmd_AddCommand( "prompt", Con_Prompt_f ); } else { // ui messagemode commands Cmd_RemoveCommand( "messagemode" ); Cmd_RemoveCommand( "messagemode2" ); Cmd_RemoveCommand( "messagemode3" ); Cmd_RemoveCommand( "messagemode4" ); Cmd_RemoveCommand( "messagemode5" ); Cmd_RemoveCommand( "messagemode6" ); Cmd_RemoveCommand( "prompt" ); Cmd_AddCommand( "messagemode", NULL ); Cmd_AddCommand( "messagemode2", NULL ); Cmd_AddCommand( "messagemode3", NULL ); Cmd_AddCommand( "messagemode4", NULL ); Cmd_AddCommand( "messagemode5", NULL ); Cmd_AddCommand( "messagemode6", NULL ); Cmd_AddCommand( "prompt", NULL ); } // reset any CVAR_CHEAT cvars registered by ui if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; vmInterpret_t interpret; #ifdef SMOKINGUNS int l; char *at; char blockThis[255]; char *buf; char **tempBuf; int capacity = 40; #endif t1 = Sys_Milliseconds(); // Load language filter #ifdef SMOKINGUNS if( !badWords ) { numWords = 0; buf = Cvar_VariableString( "cg_filterWords" ); if( strlen( buf ) > 0 ) { l = 0; badWords = Z_Malloc( capacity * sizeof( char* ) ); at = buf; while( ( at = strchr( buf, ',' ) ) ) { if( ( l-1 ) > capacity ) // ( l-1 ) because we want to leave room for the last word { tempBuf = Z_Malloc( ( capacity + 40 ) * sizeof( char** ) ); Com_Memcpy( tempBuf, badWords, capacity * sizeof( char** ) ); Z_Free( badWords ); badWords = tempBuf; capacity += 40; } strncpy( blockThis, buf, ( strchr( buf, ',' ) - buf ) ); blockThis[( strchr( buf, ',' ) - buf )] = '\0'; badWords[l] = strdup( blockThis ); buf = at + 1; ++l; } badWords[l] = strdup( buf ); ++l; numWords = l; } else Com_Printf( "No filter loaded.\n" ); } #endif // put away the console Con_Close(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode if ( cl_connectedToPureServer != 0 ) { // if sv_pure is set we only allow qvms to be loaded interpret = VMI_COMPILED; } else { interpret = Cvar_VariableValue( "vm_cgame" ); } cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret ); if ( !cgvm ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } cls.state = CA_LOADING; // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot cls.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); } // clear anything that got printed Con_ClearNotify (); }
void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[ BIG_INFO_KEY ]; char value[ BIG_INFO_VALUE ]; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // NOTE TTimo: // when the serverId changes, any further messages we send to the server will use this new serverId // show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } #ifdef USE_VOIP s = Info_ValueForKey( systemInfo, "sv_voip" ); clc.voipEnabled = atoi( s ); #endif s = Info_ValueForKey( systemInfo, "sv_cheats" ); sv_cheats = atoi( s ); //bani if ( atoi( s ) == 0 ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { Info_NextPair( &s, key, value ); if ( !key[ 0 ] ) { break; } Cvar_Set( key, value ); } // Arnout: big hack to clear the image cache on a pure change //cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); if ( Cvar_VariableValue( "sv_pure" ) ) { if ( !cl_connectedToPureServer && cls.state <= CA_CONNECTED ) { CL_PurgeCache(); } cl_connectedToPureServer = qtrue; } else { if ( cl_connectedToPureServer && cls.state <= CA_CONNECTED ) { CL_PurgeCache(); } cl_connectedToPureServer = qfalse; } }
/* ==================== CL_InitCGame Should only be called by CL_StartHunkUsers ==================== */ void CL_InitCGame( void ) { const char *info; const char *mapname; int t1, t2; char backup[ MAX_STRING_CHARS ]; t1 = Sys_Milliseconds(); // find the current mapname info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ]; mapname = Info_ValueForKey( info, "mapname" ); Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname ); // load the dll or bytecode VMType interpret = (VMType)Cvar_VariableValue("vm_cgame"); if(cl_connectedToPureServer) { // if sv_pure is set we only allow qvms to be loaded if(interpret != VMI_COMPILED && interpret != VMI_BYTECODE) interpret = VMI_COMPILED; } cls.cgame = VMFactory::createVM(interpret, "cgame", CL_CgameSystemCalls); if ( !cls.cgame ) { Com_Error( ERR_DROP, "VM_Create on cgame failed" ); } clc.state = CA_LOADING; Cvar_VariableStringBuffer( "cl_voipSendTarget", backup, sizeof( backup ) ); Cvar_Set( "cl_voipSendTarget", "" ); // Probe 1.1 or gpp cgame cls.cgInterface = 0; probingCG = true; cls.cgame->Call( CG_VOIP_STRING ); probingCG = false; Cvar_Set( "cl_voipSendTarget", backup ); if ( ( clc.netchan.alternateProtocol == 2 ) != ( cls.cgInterface == 2 ) ) { Com_Error( ERR_DROP, "%s protocol %i, but a cgame module using the %s interface was found", ( clc.demoplaying ? "Demo was recorded using" : "Server uses" ), ( clc.netchan.alternateProtocol == 0 ? PROTOCOL_VERSION : clc.netchan.alternateProtocol == 1 ? 70 : 69 ), ( cls.cgInterface == 2 ? "1.1" : "non-1.1" ) ); } // init for this gamestate // use the lastExecutedServerCommand instead of the serverCommandSequence // otherwise server commands sent just before a gamestate are dropped cls.cgame->Call( CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum ); // reset any CVAR_CHEAT cvars registered by cgame if ( !clc.demoplaying && !cl_connectedToCheatServer ) Cvar_SetCheatState(); // we will send a usercmd this frame, which // will cause the server to send us the first snapshot clc.state = CA_PRIMED; t2 = Sys_Milliseconds(); Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 ); // have the renderer touch all its images, so they are present // on the card even if the driver does deferred loading re.EndRegistration(); // make sure everything is paged in if (!Sys_LowPhysicalMemory()) { Com_TouchMemory(); CL_ProtocolSpecificCommandsInit(); } // clear anything that got printed Con_ClearNotify (); }
/* ================== CL_SystemInfoChanged The systeminfo configstring has been changed, so parse new information out of it. This will happen at every gamestate, and possibly during gameplay. ================== */ void CL_SystemInfoChanged( void ) { char *systemInfo; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; qboolean gameSet; systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ]; // NOTE TTimo: // when the serverId changes, any further messages we send to the server will use this new serverId // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=475 // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) ); #ifdef USE_VOIP s = Info_ValueForKey( systemInfo, "sv_voipProtocol" ); clc.voipEnabled = !Q_stricmp(s, "opus"); #endif // don't set any vars when playing a demo if ( clc.demoplaying ) { return; } s = Info_ValueForKey( systemInfo, "sv_cheats" ); cl_connectedToCheatServer = atoi( s ); if ( !cl_connectedToCheatServer ) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey( systemInfo, "sv_paks" ); t = Info_ValueForKey( systemInfo, "sv_pakNames" ); FS_PureServerSetLoadedPaks( s, t ); s = Info_ValueForKey( systemInfo, "sv_referencedPaks" ); t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" ); FS_PureServerSetReferencedPaks( s, t ); gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while ( s ) { int cvar_flags; Info_NextPair( &s, key, value ); if ( !key[0] ) { break; } // ehw! if (!Q_stricmp(key, "fs_game")) { if(FS_CheckDirTraversal(value)) { Com_Printf(S_COLOR_YELLOW "WARNING: Server sent invalid fs_game value %s\n", value); continue; } gameSet = qtrue; } if((cvar_flags = Cvar_Flags(key)) == CVAR_NONEXISTENT) Cvar_Get(key, value, CVAR_SERVER_CREATED | CVAR_ROM); else { // If this cvar may not be modified by a server discard the value. if(!(cvar_flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED | CVAR_USER_CREATED))) { #ifndef STANDALONE if(Q_stricmp(key, "g_synchronousClients") && Q_stricmp(key, "pmove_fixed") && Q_stricmp(key, "pmove_msec")) #endif { Com_Printf(S_COLOR_YELLOW "WARNING: server is not allowed to set %s=%s\n", key, value); continue; } } Cvar_SetSafe(key, value); } } // if game folder should not be set and it is set at the client side if ( !gameSet && *Cvar_VariableString("fs_game") ) { Cvar_Set( "fs_game", "" ); } cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); }
void CL_SystemInfoChanged(void) { char *systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO]; const char *s, *t; char key[BIG_INFO_KEY]; char value[BIG_INFO_VALUE]; qboolean gameSet; // NOTE: when the serverId changes, any further messages we send to the server will use this new serverId // in some cases, outdated cp commands might get sent with this news serverId cl.serverId = atoi(Info_ValueForKey(systemInfo, "sv_serverid")); memset(&entLastVisible, 0, sizeof(entLastVisible)); // don't set any vars when playing a demo if (clc.demoplaying) { return; } s = Info_ValueForKey(systemInfo, "sv_cheats"); cl_connectedToCheatServer = atoi(s); //bani if (!cl_connectedToCheatServer) { Cvar_SetCheatState(); } // check pure server string s = Info_ValueForKey(systemInfo, "sv_paks"); t = Info_ValueForKey(systemInfo, "sv_pakNames"); FS_PureServerSetLoadedPaks(s, t); s = Info_ValueForKey(systemInfo, "sv_referencedPaks"); t = Info_ValueForKey(systemInfo, "sv_referencedPakNames"); FS_PureServerSetReferencedPaks(s, t); gameSet = qfalse; // scan through all the variables in the systeminfo and locally set cvars to match s = systemInfo; while (s) { int cvar_flags; Info_NextPair(&s, key, value); if (!key[0]) { break; } // ehw! if (!Q_stricmp(key, "fs_game")) { if (FS_CheckDirTraversal(value)) { Com_Printf(S_COLOR_YELLOW "WARNING: Server sent invalid fs_game value %s\n", value); continue; } gameSet = qtrue; } if ((cvar_flags = Cvar_Flags(key)) == CVAR_NONEXISTENT) { Cvar_Get(key, value, CVAR_SERVER_CREATED | CVAR_ROM); } else { // If this cvar may not be modified by a server discard the value. if (!(cvar_flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED | CVAR_USER_CREATED))) { if (Q_stricmp(key, "g_synchronousClients") && Q_stricmp(key, "pmove_fixed") && Q_stricmp(key, "pmove_msec")) { Com_DPrintf(S_COLOR_YELLOW "WARNING: server is not allowed to set %s=%s\n", key, value); continue; } } Cvar_SetSafe(key, value); } } // if game folder should not be set and it is set at the client side if (!gameSet && *Cvar_VariableString("fs_game")) { Cvar_Set("fs_game", ""); } // big hack to clear the image cache on a pure change //cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" ); if (Cvar_VariableValue("sv_pure")) { if (!cl_connectedToPureServer && cls.state <= CA_CONNECTED) { CL_PurgeCache(); } cl_connectedToPureServer = qtrue; } else { if (cl_connectedToPureServer && cls.state <= CA_CONNECTED) { CL_PurgeCache(); } cl_connectedToPureServer = qfalse; } }