您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Con_Close函数代码示例

51自学网 2021-06-01 20:13:02
  C++
这篇教程C++ Con_Close函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Con_Close函数的典型用法代码示例。如果您正苦于以下问题:C++ Con_Close函数的具体用法?C++ Con_Close怎么用?C++ Con_Close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Con_Close函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CL_InitCGame

/*====================CL_InitCGameShould 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();}
开发者ID:Mailaender,项目名称:etlegacy,代码行数:67,


示例2: CL_InitCGame

/*====================CL_InitCGameShould 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 ) );}
开发者ID:ksritharan,项目名称:fsm-trem,代码行数:67,


示例3: CL_MapLoading

/*=====================CL_MapLoadingA local server is starting to load a map, so update thescreen to let the user know about it, then dump all clientmemory on the hunk from cgame, ui, and renderer=====================*/void CL_MapLoading( void ) {	if ( !com_cl_running->integer ) {		return;	}	Con_Close();	cls.keyCatchers = 0;	// if we are already connected to the local host, stay connected	if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) )  {		cls.state = CA_CONNECTED;		// so the connect screen is drawn		memset( cls.updateInfoString, 0, sizeof( cls.updateInfoString ) );//		memset( clc.serverMessage, 0, sizeof( clc.serverMessage ) );		memset( &cl.gameState, 0, sizeof( cl.gameState ) );		clc.lastPacketSentTime = -9999;		SCR_UpdateScreen();	} else {		// clear nextmap so the cinematic shutdown doesn't execute it		Cvar_Set( "nextmap", "" );		CL_Disconnect();		Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) );		cls.state = CA_CHALLENGING;		// so the connect screen is drawn		cls.keyCatchers = 0;		SCR_UpdateScreen();		clc.connectTime = -RETRANSMIT_TIMEOUT;		NET_StringToAdr( cls.servername, &clc.serverAddress);		// we don't need a challenge on the localhost		CL_CheckForResend();	}	CL_FlushMemory();}
开发者ID:Delfin1,项目名称:OpenJK,代码行数:42,


示例4: CL_GetServerCommand

/*===================CL_GetServerCommandSet up argc/argv for the given command===================*/qboolean CL_GetServerCommand( int serverCommandNumber ) {	char	*s;	const char	*cmd;	// if we have irretrievably lost a reliable command, drop the connection	if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS ) {		Com_Error( ERR_DROP, "CL_GetServerCommand: a reliable command was cycled out" );		return qfalse;	}	if ( serverCommandNumber > clc.serverCommandSequence ) {		Com_Error( ERR_DROP, "CL_GetServerCommand: requested a command not received" );		return qfalse;	}	s = clc.serverCommands[ serverCommandNumber & ( MAX_RELIABLE_COMMANDS - 1 ) ];	Com_DPrintf( "serverCommand: %i : %s/n", serverCommandNumber, s );	Cmd_TokenizeString( s );	cmd = Cmd_Argv(0);	if ( !strcmp( cmd, "disconnect" ) ) {		Com_Error (ERR_DISCONNECT,"Server disconnected/n");	}	if ( !strcmp( cmd, "cs" ) ) {		CL_ConfigstringModified();		// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()		Cmd_TokenizeString( s );		return qtrue;	}	// the clientLevelShot command is used during development	// to generate 128*128 screenshots from the intermission	// point of levels for the menu system to use	// we pass it along to the cgame to make apropriate adjustments,	// but we also clear the console and notify lines here	if ( !strcmp( cmd, "clientLevelShot" ) ) {		// don't do it if we aren't running the server locally,		// otherwise malicious remote servers could overwrite		// the existing thumbnails		if ( !com_sv_running->integer ) {			return qfalse;		}		// close the console		Con_Close();		// take a special screenshot next frame		Cbuf_AddText( "wait ; wait ; wait ; wait ; screenshot levelshot/n" );		return qtrue;	}	// we may want to put a "connect to other server" command here	// cgame can now act on the command	return qtrue;}
开发者ID:Delfin1,项目名称:OpenJK,代码行数:64,


示例5: set_active_state

static void set_active_state(void){    cls.state = ca_active;    cl.serverdelta = Q_align(cl.frame.number, CL_FRAMEDIV);    cl.time = cl.servertime = 0; // set time, needed for demos#if USE_FPS    cl.keytime = cl.keyservertime = 0;    cl.keyframe = cl.frame; // initialize keyframe to make sure it's valid#endif    // initialize oldframe so lerping doesn't hurt anything    cl.oldframe.valid = false;    cl.oldframe.ps = cl.frame.ps;#if USE_FPS    cl.oldkeyframe.valid = false;    cl.oldkeyframe.ps = cl.keyframe.ps;#endif    cl.frameflags = 0;    if (cls.netchan) {        cl.initialSeq = cls.netchan->outgoing_sequence;    }    if (cls.demo.playback) {        // init some demo things        CL_FirstDemoFrame();    } else {        // set initial cl.predicted_origin and cl.predicted_angles        VectorScale(cl.frame.ps.pmove.origin, 0.125f, cl.predicted_origin);        VectorScale(cl.frame.ps.pmove.velocity, 0.125f, cl.predicted_velocity);        if (cl.frame.ps.pmove.pm_type < PM_DEAD &&            cls.serverProtocol > PROTOCOL_VERSION_DEFAULT) {            // enhanced servers don't send viewangles            CL_PredictAngles();        } else {            // just use what server provided            VectorCopy(cl.frame.ps.viewangles, cl.predicted_angles);        }    }    SCR_EndLoadingPlaque();     // get rid of loading plaque    SCR_LagClear();    Con_Close(false);           // get rid of connection screen    CL_CheckForPause();    CL_UpdateFrameTimes();    if (!cls.demo.playback) {        EXEC_TRIGGER(cl_beginmapcmd);        Cmd_ExecTrigger("#cl_enterlevel");    }}
开发者ID:AndreyNazarov,项目名称:q2pro,代码行数:55,


示例6: CL_InitCGame

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 ();}
开发者ID:BSzili,项目名称:OpenJK,代码行数:44,


示例7: CL_InitCGame

/*====================CL_InitCGameShould only by called by CL_StartHunkUsers====================*/void CL_InitCGame(){	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[ CS_SERVERINFO ].c_str();	mapname = Info_ValueForKey( info, "mapname" );	Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname );	cls.state = connstate_t::CA_LOADING;	// init for this gamestate	cgvm.CGameInit(clc.serverMessageSequence, clc.clientNum);	// we will send a usercmd this frame, which	// will cause the server to send us the first snapshot	cls.state = connstate_t::CA_PRIMED;	t2 = Sys_Milliseconds();	Log::Debug( "CL_InitCGame: %5.2fs", ( 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();	// Cause any input while loading to be dropped and forget what's pressed	IN_DropInputsForFrame();	CL_ClearKeys();	Key_ClearStates();}
开发者ID:unrealarena,项目名称:unrealarena,代码行数:46,


示例8: demoPlay

qboolean demoPlay( const char *fileName ) {	demo.play.handle = demoPlayOpen( fileName );	if (demo.play.handle) {		demoPlay_t *play = demo.play.handle;		clc.demoplaying = qtrue;		clc.newDemoPlayer = qtrue;		clc.serverMessageSequence = 0;		clc.lastExecutedServerCommand = 0;		Com_Printf("Opened %s, which has %d seconds and %d frames/n", fileName, (play->endTime - play->startTime) / 1000, play->totalFrames );		Con_Close();				// wipe local client state		CL_ClearState();		cls.state = CA_LOADING;		// Pump the loop, this may change gamestate!		Com_EventLoop();		// starting to load a map so we get out of full screen ui mode		Cvar_Set("r_uiFullScreen", "0");		// flush client memory and start loading stuff		// this will also (re)load the UI		// if this is a local client then only the client part of the hunk		// will be cleared, note that this is done after the hunk mark has been set		CL_FlushMemory();		// initialize the CGame		cls.cgameStarted = qtrue;		// Create the gamestate		Com_Memcpy( cl.gameState.stringOffsets, play->frame->string.offsets, sizeof( play->frame->string.offsets ));		Com_Memcpy( cl.gameState.stringData, play->frame->string.data, play->frame->string.used );		cl.gameState.dataCount = play->frame->string.used;		CL_InitCGame();		cls.state = CA_ACTIVE;		return qtrue;	} else {		return qfalse;	}}
开发者ID:mightycow,项目名称:q3mme,代码行数:36,


示例9: CL_Frame

//.........这里部分代码省略.........	// save the msec before checking pause	cls.realFrametime = msec;	// decide the simulation time	cls.frametime = msec;	if(cl_framerate->integer)	{		avgFrametime+=msec;		char mess[256];		if(!(frameCount&0x1f))		{			sprintf(mess,"Frame rate=%f/n/n",1000.0f*(1.0/(avgFrametime/32.0f)));	//		OutputDebugString(mess);			Com_Printf(mess);			avgFrametime=0.0f;		}		frameCount++;	}	cls.frametimeFraction=fractionMsec;	cls.realtime += msec;	cls.realtimeFraction+=fractionMsec;	if (cls.realtimeFraction>=1.0f)	{		if (cl_newClock&&cl_newClock->integer)		{			cls.realtime++;		}		cls.realtimeFraction-=1.0f;	}#ifndef _XBOX	if ( cl_timegraph->integer ) {		SCR_DebugGraph ( cls.realFrametime * 0.25, 0 );	}#endif#ifdef _XBOX	//Check on the hot swappable button states.	CL_UpdateHotSwap();#endif	// see if we need to update any userinfo	CL_CheckUserinfo();	// if we haven't gotten a packet in a long time,	// drop the connection	CL_CheckTimeout();	// send intentions now	CL_SendCmd();	// resend a connection request if necessary	CL_CheckForResend();	// decide on the serverTime to render	CL_SetCGameTime();	if (cl_pano->integer && cls.state == CA_ACTIVE) {	//grab some panoramic shots		int i = 1;		int pref = cl_pano->integer;		int oldnoprint = cl_noprint->integer;		Con_Close();		cl_noprint->integer = 1;	//hide the screen shot msgs		for (; i <= cl_panoNumShots->integer; i++) {			Cvar_SetValue( "pano", i );			SCR_UpdateScreen();// update the screen			Cbuf_ExecuteText( EXEC_NOW, va("screenshot %dpano%02d/n", pref, i) );	//grab this screen		}		Cvar_SetValue( "pano", 0 );	//done		cl_noprint->integer = oldnoprint;	}	if (cl_skippingcin->integer && !cl_endcredits->integer && !com_developer->integer ) {		if (cl_skippingcin->modified){			S_StopSounds();		//kill em all but music				cl_skippingcin->modified=qfalse;			Com_Printf (va(S_COLOR_YELLOW"%s"), SE_GetString("CON_TEXT_SKIPPING"));			SCR_UpdateScreen();		}	} else {		// update the screen		SCR_UpdateScreen();#if defined(_XBOX) && !defined(FINAL_BUILD)		if (D3DPERF_QueryRepeatFrame())			SCR_UpdateScreen();#endif	}	// update audio	S_Update();#ifdef _IMMERSION	FF_Update();#endif // _IMMERSION	// advance local effects for next frame	SCR_RunCinematic();	Con_RunConsole();	cls.framecount++;}
开发者ID:Hasimir,项目名称:jedi-academy-1,代码行数:101,


示例10: CL_InitCGame

/*====================CL_InitCGameShould 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//.........这里部分代码省略.........
开发者ID:Mixone-FinallyHere,项目名称:SmokinGuns,代码行数:101,


示例11: CL_ParseGamestate

/*==================CL_ParseGamestate==================*/void CL_ParseGamestate( msg_t *msg ){	int           i;	entityState_t *es;	int           newnum;	entityState_t nullstate;	int           cmd;	char          *s;	Con_Close();	clc.connectPacketCount = 0;	// wipe local client state	CL_ClearState();	// a gamestate always marks a server command sequence	clc.serverCommandSequence = MSG_ReadLong( msg );	// parse all the configstrings and baselines	cl.gameState.dataCount = 1; // leave a 0 at the beginning for uninitialized configstrings	while ( 1 )	{		cmd = MSG_ReadByte( msg );		if ( cmd == svc_EOF )		{			break;		}		if ( cmd == svc_configstring )		{			int len;			i = MSG_ReadShort( msg );			if ( i < 0 || i >= MAX_CONFIGSTRINGS )			{				Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );			}			s = MSG_ReadBigString( msg );			len = strlen( s );			if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS )			{				Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );			}			// append it to the gameState string buffer			cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;			memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );			cl.gameState.dataCount += len + 1;		}		else if ( cmd == svc_baseline )		{			newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );			if ( newnum < 0 || newnum >= MAX_GENTITIES )			{				Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );			}			memset( &nullstate, 0, sizeof( nullstate ) );			es = &cl.entityBaselines[ newnum ];			MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );		}		else		{			Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );		}	}	clc.clientNum = MSG_ReadLong( msg );	// read the checksum feed	clc.checksumFeed = MSG_ReadLong( msg );	// parse serverId and other cvars	CL_SystemInfoChanged();	// reinitialize the filesystem if the game directory has changed	FS_ConditionalRestart( clc.checksumFeed );	// This used to call CL_StartHunkUsers, but now we enter the download state before loading the	// cgame	CL_InitDownloads();	// make sure the game starts	Cvar_Set( "cl_paused", "0" );}
开发者ID:justhacking,项目名称:Unvanquished,代码行数:96,


示例12: CL_ParseGamestate

/*==================CL_ParseGamestate==================*/void CL_ParseGamestate( msg_t *msg ) {	int				i;	entityState_t	*es;	int				newnum;	entityState_t	nullstate;	int				cmd;	char			*s;	char oldGame[MAX_QPATH];	Con_Close();	clc.connectPacketCount = 0;	// wipe local client state	CL_ClearState();	// a gamestate always marks a server command sequence	clc.serverCommandSequence = MSG_ReadLong( msg );	// parse all the configstrings and baselines	cl.gameState.dataCount = 1;	// leave a 0 at the beginning for uninitialized configstrings	while ( 1 ) {		cmd = MSG_ReadByte( msg );		if ( cmd == svc_EOF ) {			break;		}				if ( cmd == svc_configstring ) {			int		len;			i = MSG_ReadShort( msg );			if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {				Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );			}			s = MSG_ReadBigString( msg );			len = strlen( s );			if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {				Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );			}			// append it to the gameState string buffer			cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;			Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );			cl.gameState.dataCount += len + 1;		} else if ( cmd == svc_baseline ) {			newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );			if ( newnum < 0 || newnum >= MAX_GENTITIES ) {				Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );			}			Com_Memset (&nullstate, 0, sizeof(nullstate));			es = &cl.entityBaselines[ newnum ];			MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );		} else {			Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );		}	}	clc.clientNum = MSG_ReadLong(msg);	// read the checksum feed	clc.checksumFeed = MSG_ReadLong( msg );	// save old gamedir	Cvar_VariableStringBuffer("fs_game", oldGame, sizeof(oldGame));	// parse useful values out of CS_SERVERINFO	CL_ParseServerInfo();	// parse serverId and other cvars	CL_SystemInfoChanged();	// stop recording now so the demo won't have an unnecessary level load at the end.	if(cl_autoRecordDemo->integer && clc.demorecording)		CL_StopRecord_f();		// reinitialize the filesystem if the game directory has changed	if(!cl_oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED))	{		cl_oldGameSet = qtrue;		Q_strncpyz(cl_oldGame, oldGame, sizeof(cl_oldGame));	}	FS_ConditionalRestart(clc.checksumFeed, qfalse);	// This used to call CL_StartHunkUsers, but now we enter the download state before loading the	// cgame	CL_InitDownloads();	// make sure the game starts	Cvar_Set( "cl_paused", "0" );}
开发者ID:darklegion,项目名称:tremulous,代码行数:97,


示例13: CL_ParseGamestate

/*==================CL_ParseGamestate==================*/void CL_ParseGamestate( msg_t *msg ){	int           i;	entityState_t *es;	int           newnum;	entityState_t nullstate;	int           cmd;	Con_Close();	clc.connectPacketCount = 0;	// wipe local client state	CL_ClearState();	// a gamestate always marks a server command sequence	clc.serverCommandSequence = MSG_ReadLong( msg );	// parse all the configstrings and baselines	while ( 1 )	{		cmd = MSG_ReadByte( msg );		if ( cmd == svc_EOF )		{			break;		}		if ( cmd == svc_configstring )		{			i = MSG_ReadShort( msg );			if ( i < 0 || i >= MAX_CONFIGSTRINGS )			{				Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );			}            const char* str = MSG_ReadBigString( msg );            std::string s = str;			cl.gameState[i] = str;		}		else if ( cmd == svc_baseline )		{			newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );			if ( newnum < 0 || newnum >= MAX_GENTITIES )			{				Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );			}			memset( &nullstate, 0, sizeof( nullstate ) );			es = &cl.entityBaselines[ newnum ];			MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );		}		else		{			Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );		}	}	clc.clientNum = MSG_ReadLong( msg );	// read the checksum feed	clc.checksumFeed = MSG_ReadLong( msg );	// parse serverId and other cvars	CL_SystemInfoChanged();	// This used to call CL_StartHunkUsers, but now we enter the download state before loading the	// cgame	CL_InitDownloads();	// make sure the game starts	Cvar_Set( "cl_paused", "0" );}
开发者ID:ffpwserver,项目名称:Unvanquished,代码行数:79,


示例14: Key_Event

/*===================Key_EventCalled by the system between frames for both key up and key down eventsShould NOT be called during an interrupt!===================*/void Key_Event(unsigned key, qboolean down, unsigned time){    char    *kb;    char    cmd[MAX_STRING_CHARS];    if (key >= 256) {        Com_Error(ERR_FATAL, "%s: bad key", __func__);    }    Com_DDDPrintf("%u: %c%s/n", time,                  down ? '+' : '-', Key_KeynumToString(key));    // hack for menu key binding    if (key_wait_cb && down && !key_wait_cb(key_wait_arg, key)) {        return;    }    // update key down and auto-repeat status    if (down) {        if (keydown[key] < 255)            keydown[key]++;    } else {        keydown[key] = 0;    }    // console key is hardcoded, so the user can never unbind it    if (!Key_IsDown(K_SHIFT) && (key == '`' || key == '~')) {        if (keydown[key] == 1) {            Con_ToggleConsole_f();        }        return;    }    // Alt+Enter is hardcoded for all systems    if (Key_IsDown(K_ALT) && key == K_ENTER) {        if (keydown[key] == 1) {            VID_ToggleFullscreen();        }        return;    }    // menu key is hardcoded, so the user can never unbind it    if (key == K_ESCAPE) {        if (!down) {            return;        }        if (cls.key_dest == KEY_GAME &&            cl.frame.ps.stats[STAT_LAYOUTS] &&            cls.demo.playback == qfalse) {            if (keydown[key] == 2) {                // force main menu if escape is held                UI_OpenMenu(UIMENU_GAME);            } else if (keydown[key] == 1) {                // put away help computer / inventory                CL_ClientCommand("putaway");            }            return;        }        // ignore autorepeats        if (keydown[key] > 1) {            return;        }        if (cls.key_dest & KEY_CONSOLE) {            if (cls.state < ca_active && !(cls.key_dest & KEY_MENU)) {                UI_OpenMenu(UIMENU_MAIN);            } else {                Con_Close(qtrue);            }        } else if (cls.key_dest & KEY_MENU) {            UI_Keydown(key);        } else if (cls.key_dest & KEY_MESSAGE) {            Key_Message(key);        } else if (cls.state == ca_active) {            UI_OpenMenu(UIMENU_GAME);        } else {            UI_OpenMenu(UIMENU_MAIN);        }        return;    }    // track if any key is down for BUTTON_ANY    if (down) {        if (keydown[key] == 1)            anykeydown++;    } else {        anykeydown--;        if (anykeydown < 0)            anykeydown = 0;    }//.........这里部分代码省略.........
开发者ID:jayschwa,项目名称:q2pro,代码行数:101,


示例15: CL_Frame

//.........这里部分代码省略.........		}		lodFrameCount++;		if(lodFrameCount==5 && bias > 0)		{			bias--;			Cvar_SetValue("r_lodBias", bias);			lodFrameCount = 0;		}	}	frameCount++;	if(in_camera)	{		// No LOD stuff during cutscenes		Cvar_SetValue("r_lodBias", 0);	}	cls.frametimeFraction=fractionMsec;	cls.realtime += msec;	cls.realtimeFraction+=fractionMsec;	if (cls.realtimeFraction>=1.0f)	{		if (cl_newClock&&cl_newClock->integer)		{			cls.realtime++;		}		cls.realtimeFraction-=1.0f;	}#ifndef _XBOX	if ( cl_timegraph->integer ) {		SCR_DebugGraph ( cls.realFrametime * 0.25, 0 );	}#endif#ifdef _XBOX	//Check on the hot swappable button states.	CL_UpdateHotSwap();#endif	// see if we need to update any userinfo	CL_CheckUserinfo();	// if we haven't gotten a packet in a long time,	// drop the connection	CL_CheckTimeout();	// send intentions now	CL_SendCmd();	// resend a connection request if necessary	CL_CheckForResend();	// decide on the serverTime to render	CL_SetCGameTime();	if (cl_pano->integer && cls.state == CA_ACTIVE) {	//grab some panoramic shots		int i = 1;		int pref = cl_pano->integer;		int oldnoprint = cl_noprint->integer;		Con_Close();		cl_noprint->integer = 1;	//hide the screen shot msgs		for (; i <= cl_panoNumShots->integer; i++) {			Cvar_SetValue( "pano", i );			SCR_UpdateScreen();// update the screen			Cbuf_ExecuteText( EXEC_NOW, va("screenshot %dpano%02d/n", pref, i) );	//grab this screen		}		Cvar_SetValue( "pano", 0 );	//done		cl_noprint->integer = oldnoprint;	}	if (cl_skippingcin->integer && !cl_endcredits->integer && !com_developer->integer ) {		if (cl_skippingcin->modified){			S_StopSounds();		//kill em all but music				cl_skippingcin->modified=qfalse;			Com_Printf (va(S_COLOR_YELLOW"%s"), SE_GetString("CON_TEXT_SKIPPING"));			SCR_UpdateScreen();		}	} else {		// update the screen		SCR_UpdateScreen();#if defined(_XBOX) && !defined(FINAL_BUILD)		if (D3DPERF_QueryRepeatFrame())			SCR_UpdateScreen();#endif	}	// update audio	S_Update();#ifdef _IMMERSION	FF_Update();#endif // _IMMERSION	// advance local effects for next frame	SCR_RunCinematic();	Con_RunConsole();	cls.framecount++;}
开发者ID:Drakesinger,项目名称:jediacademypc,代码行数:101,


示例16: CLT3_InitCGame

void CLT3_InitCGame() {	int t1 = Sys_Milliseconds();	// put away the console	Con_Close();	// find the current mapname	const char* info = GGameType & GAME_WolfSP ? cl.ws_gameState.stringData + cl.ws_gameState.stringOffsets[ Q3CS_SERVERINFO ] :					   GGameType & GAME_WolfMP ? cl.wm_gameState.stringData + cl.wm_gameState.stringOffsets[ Q3CS_SERVERINFO ] :					   GGameType & GAME_ET ? cl.et_gameState.stringData + cl.et_gameState.stringOffsets[ Q3CS_SERVERINFO ] :					   cl.q3_gameState.stringData + cl.q3_gameState.stringOffsets[ Q3CS_SERVERINFO ];	const char* mapname = Info_ValueForKey( info, "mapname" );	String::Sprintf( cl.q3_mapname, sizeof ( cl.q3_mapname ), "maps/%s.bsp", mapname );	if ( GGameType & GAME_Quake3 ) {		// load the dll or bytecode		vmInterpret_t interpret;		if ( cl_connectedToPureServer != 0 ) {			// if sv_pure is set we only allow qvms to be loaded			interpret = VMI_COMPILED;		} else {			interpret = ( vmInterpret_t )( int )Cvar_VariableValue( "vm_cgame" );		}		cgvm = VM_Create( "cgame", CLQ3_CgameSystemCalls, interpret );	} else if ( GGameType & GAME_WolfSP ) {		cgvm = VM_Create( "cgame", CLWS_CgameSystemCalls, VMI_NATIVE );	} else if ( GGameType & GAME_WolfMP ) {		cgvm = VM_Create( "cgame", CLWM_CgameSystemCalls, VMI_NATIVE );	} else {		cgvm = VM_Create( "cgame", CLET_CgameSystemCalls, VMI_NATIVE );	}	if ( !cgvm ) {		common->Error( "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	if ( GGameType & GAME_ET ) {		//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.q3_serverMessageSequence, clc.q3_lastExecutedServerCommand, clc.q3_clientNum, clc.demoplaying );	} else {		VM_Call( cgvm, CG_INIT, clc.q3_serverMessageSequence, clc.q3_lastExecutedServerCommand, clc.q3_clientNum );	}	// we will send a usercmd this frame, which	// will cause the server to send us the first snapshot	cls.state = CA_PRIMED;	int t2 = Sys_Milliseconds();	common->Printf( "CLT3_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	R_EndRegistration();	// clear anything that got printed	Con_ClearNotify();}
开发者ID:janisl,项目名称:jlquake,代码行数:61,


示例17: CL_Frame

void CL_Frame ( int msec,float fractionMsec ) {	if ( !com_cl_running->integer ) {		return;	}	// load the ref / cgame if needed	CL_StartHunkUsers();	if ( cls.state == CA_DISCONNECTED && !( Key_GetCatcher( ) & KEYCATCH_UI )		&& !com_sv_running->integer ) {		// if disconnected, bring up the menu		if (!CL_CheckPendingCinematic())	// this avoid having the menu flash for one frame before pending cinematics		{			UI_SetActiveMenu( "mainMenu",NULL );		}	}	// if recording an avi, lock to a fixed fps	if ( cl_avidemo->integer ) {		// save the current screen		if ( cls.state == CA_ACTIVE ) {			if (cl_avidemo->integer > 0) {				Cbuf_ExecuteText( EXEC_NOW, "screenshot silent/n" );			} else {				Cbuf_ExecuteText( EXEC_NOW, "screenshot_tga silent/n" );			}		}		// fixed time for next frame		if (cl_avidemo->integer > 0) {			msec = 1000 / cl_avidemo->integer;		} else {			msec = 1000 / -cl_avidemo->integer;		}	}	// save the msec before checking pause	cls.realFrametime = msec;	// decide the simulation time	cls.frametime = msec;	if(cl_framerate->integer)	{		avgFrametime+=msec;		char mess[256];		if(!(frameCount&0x1f))		{			sprintf(mess,"Frame rate=%f/n/n",1000.0f*(1.0/(avgFrametime/32.0f)));	//		OutputDebugString(mess);			Com_Printf(mess);			avgFrametime=0.0f;		}		frameCount++;	}	cls.frametimeFraction=fractionMsec;	cls.realtime += msec;	cls.realtimeFraction+=fractionMsec;	if (cls.realtimeFraction>=1.0f)	{		if (cl_newClock&&cl_newClock->integer)		{			cls.realtime++;		}		cls.realtimeFraction-=1.0f;	}	if ( cl_timegraph->integer ) {		SCR_DebugGraph ( cls.realFrametime * 0.25, 0 );	}	// see if we need to update any userinfo	CL_CheckUserinfo();	// if we haven't gotten a packet in a long time,	// drop the connection	CL_CheckTimeout();	// send intentions now	CL_SendCmd();	// resend a connection request if necessary	CL_CheckForResend();	// decide on the serverTime to render	CL_SetCGameTime();	if (cl_pano->integer && cls.state == CA_ACTIVE) {	//grab some panoramic shots		int i = 1;		int pref = cl_pano->integer;		int oldnoprint = cl_noprint->integer;		Con_Close();		cl_noprint->integer = 1;	//hide the screen shot msgs		for (; i <= cl_panoNumShots->integer; i++) {			Cvar_SetValue( "pano", i );			SCR_UpdateScreen();// update the screen			Cbuf_ExecuteText( EXEC_NOW, va("screenshot %dpano%02d/n", pref, i) );	//grab this screen		}		Cvar_SetValue( "pano", 0 );	//done		cl_noprint->integer = oldnoprint;	}//.........这里部分代码省略.........
开发者ID:eezstreet,项目名称:OpenJK,代码行数:101,


示例18: CL_PlayDemo_f

//.........这里部分代码省略.........		MsgDev( D_ERROR, "couldn't open %s/n", filename );		cls.demonum = -1; // stop demo loop		return;	}	cls.demofile = FS_Open( filename, "rb", true );	Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));	Q_strncpy( menu.globals->demoname, demoname, sizeof( menu.globals->demoname ));	// read in the m_DemoHeader	FS_Read( cls.demofile, &demo.header, sizeof( demoheader_t ));	if( demo.header.id != IDEMOHEADER )	{		MsgDev( D_ERROR, "%s is not a demo file/n", filename );		FS_Close( cls.demofile );		cls.demofile = NULL;		cls.demonum = -1; // stop demo loop		return;	}	if( demo.header.net_protocol != PROTOCOL_VERSION || demo.header.dem_protocol != DEMO_PROTOCOL )	{		MsgDev( D_ERROR, "demo protocol outdated/n"			"Demo file protocols Network(%i), Demo(%i)/n"			"Server protocol is at Network(%i), Demo(%i)/n",			demo.header.net_protocol, 			demo.header.dem_protocol,			PROTOCOL_VERSION,			DEMO_PROTOCOL		);		FS_Close( cls.demofile );		cls.demofile = NULL;		cls.demonum = -1; // stop demo loop		return;	}	// now read in the directory structure.	FS_Seek( cls.demofile, demo.header.directory_offset, SEEK_SET );	FS_Read( cls.demofile, &demo.directory.numentries, sizeof( int ));	if( demo.directory.numentries < 1 || demo.directory.numentries > 1024 )	{		MsgDev( D_ERROR, "demo had bogus # of directory entries: %i/n", demo.directory.numentries );		FS_Close( cls.demofile );		cls.demofile = NULL;		cls.demonum = -1; // stop demo loop		cls.changedemo = false;		return;	}	if( cls.changedemo )	{		S_StopAllSounds();		SCR_BeginLoadingPlaque( false );		CL_ClearState ();		CL_InitEdicts (); // re-arrange edicts	}	else	{		// NOTE: at this point demo is still valid		CL_Disconnect();		Host_ShutdownServer();		Con_Close();		UI_SetActiveMenu( false );	}	// allocate demo entries	demo.directory.entries = Mem_Alloc( cls.mempool, sizeof( demoentry_t ) * demo.directory.numentries );	for( i = 0; i < demo.directory.numentries; i++ )	{		FS_Read( cls.demofile, &demo.directory.entries[i], sizeof( demoentry_t ));	}	demo.entryIndex = 0;	demo.entry = &demo.directory.entries[demo.entryIndex];	FS_Seek( cls.demofile, demo.entry->offset, SEEK_SET );	cls.demoplayback = true;	cls.state = ca_connected;	cl.background = (cls.demonum != -1) ? true : false;	demo.starttime = CL_GetDemoPlaybackClock(); // for determining whether to read another message	Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, net_qport->integer );	demo.framecount = 0;	cls.lastoutgoingcommand = -1; 	cls.nextcmdtime = host.realtime;	// g-cont. is this need?	Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));	// begin a playback demo}
开发者ID:nekonomicon,项目名称:xash3d,代码行数:101,


示例19: CL_GetAutoUpdate

void CL_GetAutoUpdate(void){#ifdef FEATURE_AUTOUPDATE	// Don't try and get an update if we haven't checked for one	if (!autoupdate.updateChecked)	{		return;	}	// Make sure there's a valid update file to request	if (strlen(com_updatefiles->string) < 5)	{		return;	}	Com_DPrintf("Connecting to auto-update server.../n");	S_StopAllSounds();	// starting to load a map so we get out of full screen ui mode	Cvar_Set("r_uiFullScreen", "0");	// toggle on all the download related cvars	Cvar_Set("cl_allowDownload", "1");  // general flag	Cvar_Set("cl_wwwDownload", "1");    // ftp/http support	// clear any previous "server full" type messages	clc.serverMessage[0] = 0;	if (com_sv_running->integer)	{		// if running a local server, kill it		SV_Shutdown("Server quit/n");	}	// make sure a local server is killed	Cvar_Set("sv_killserver", "1");	SV_Frame(0);	CL_Disconnect(qtrue);	Con_Close();	Q_strncpyz(cls.servername, "ET:L Update Server", sizeof(cls.servername));	if (autoupdate.autoupdateServer.type == NA_BAD)	{		Com_Printf("Bad server address/n");		cls.state = CA_DISCONNECTED;		Cvar_Set("ui_connecting", "0");		return;	}	// Copy auto-update server address to Server connect address	memcpy(&clc.serverAddress, &autoupdate.autoupdateServer, sizeof(netadr_t));	Com_DPrintf("%s resolved to %s/n", cls.servername,	            NET_AdrToString(clc.serverAddress));	cls.state = CA_CONNECTING;	cls.keyCatchers        = 0;	clc.connectTime        = -99999; // CL_CheckForResend() will fire immediately	clc.connectPacketCount = 0;	// server connection string	Cvar_Set("cl_currentServerAddress", "ET:L Update Server");#endif /* FEATURE_AUTOUPDATE */}
开发者ID:Ponce,项目名称:etlegacy,代码行数:68,


示例20: CL_PlayDemo_f

/** * @brief Usage: demo /<demoname/> */void CL_PlayDemo_f(void){	char name[MAX_OSPATH], retry[MAX_OSPATH];	char *arg, *ext_test;	int  protocol, i;	if (Cmd_Argc() != 2)	{		Com_FuncPrinf("playdemo <demoname>/n");		return;	}	// make sure a local server is killed	Cvar_Set("sv_killserver", "1");	CL_Disconnect(qtrue);	// open the demo file	arg = Cmd_Argv(1);	// check for an extension .DEMOEXT_?? (?? is protocol)	ext_test = strrchr(arg, '.');	if (ext_test && !Q_stricmpn(ext_test + 1, DEMOEXT, ARRAY_LEN(DEMOEXT) - 1))	{		protocol = atoi(ext_test + ARRAY_LEN(DEMOEXT));		for (i = 0; demo_protocols[i]; i++)		{			if (demo_protocols[i] == protocol)			{				break;			}		}		if (demo_protocols[i] || protocol == PROTOCOL_VERSION)		{			Com_sprintf(name, sizeof(name), "demos/%s", arg);			FS_FOpenFileRead(name, &clc.demofile, qtrue);		}		else		{			int len;			Com_FuncPrinf("Protocol %d not supported for demos/n", protocol);			len = ext_test - arg;			if (len >= ARRAY_LEN(retry))			{				len = ARRAY_LEN(retry) - 1;			}			Q_strncpyz(retry, arg, len + 1);			retry[len] = '/0';			protocol   = CL_WalkDemoExt(retry, name, &clc.demofile);		}	}	else	{		protocol = CL_WalkDemoExt(arg, name, &clc.demofile);	}	if (!clc.demofile)	{		Com_FuncDrop("couldn't open %s", name);		return;	}	Q_strncpyz(clc.demoName, arg, sizeof(clc.demoName));	Con_Close();#if NEW_DEMOFUNC	CL_AllocateDemoPoints();	CL_ParseDemo();#endif	cls.state       = CA_CONNECTED;	clc.demoplaying = qtrue;	if (Cvar_VariableValue("cl_wavefilerecord"))	{		CL_WriteWaveOpen();	}	Q_strncpyz(cls.servername, arg, sizeof(cls.servername));	// read demo messages until connected	while (cls.state >= CA_CONNECTED && cls.state < CA_PRIMED)	{		CL_ReadDemoMessage();	}	// don't get the first snapshot this frame, to prevent the long	// time from the gamestate load from messing causing a time skip	clc.firstDemoFrameSkipped = qfalse;}
开发者ID:dstaesse,项目名称:etlegacy,代码行数:97,


示例21: CL_ParseGamestate

/*==================CL_ParseGamestate==================*/void CL_ParseGamestate( msg_t *msg ) {	int				i;	int				cmd;	char			*s;	Con_Close();	UI_UpdateConnectionString( "" );	// wipe local client state	CL_ClearState();	// a gamestate always marks a server command sequence	clc.serverCommandSequence = MSG_ReadLong( msg );	// parse all the configstrings and baselines	cl.gameState.dataCount = 1;	// leave a 0 at the beginning for uninitialized configstrings	while ( 1 ) {		cmd = MSG_ReadByte( msg );		if ( cmd <= 0 ) {			break;		}				if ( cmd == svc_configstring ) {			int		len;			i = MSG_ReadShort( msg );			if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {				Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );			}			s = MSG_ReadString( msg );			len = strlen( s );			if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {				Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );			}			// append it to the gameState string buffer			cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;			memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );			cl.gameState.dataCount += len + 1;			if ( cl_shownet->integer == 3 ) {				Com_Printf ("%3i:  CS# %d %s (%d)/n",msg->readcount, i,s,len);			}		} else if ( cmd == svc_baseline ) {			assert(0);		} else {			Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );		}	}	// parse serverId and other cvars	CL_SystemInfoChanged();	// reinitialize the filesystem if the game directory has changed#if 0	if ( fs_game->modified ) {	}#endif	// let the client game init and load data	cls.state = CA_LOADING;	CL_StartHunkUsers();	// make sure the game starts	Cvar_Set( "cl_paused", "0" );}
开发者ID:BishopExile,项目名称:OpenJK,代码行数:74,


示例22: CL_GetServerCommand

//.........这里部分代码省略.........	int argc;	// if we have irretrievably lost a reliable command, drop the connection	if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS ) {		// when a demo record was started after the client got a whole bunch of		// reliable commands then the client never got those first reliable commands		if ( clc.demoplaying )			return qfalse;		Com_Error( ERR_DROP, "CL_GetServerCommand: a reliable command was cycled out" );		return qfalse;	}	if ( serverCommandNumber > clc.serverCommandSequence ) {		Com_Error( ERR_DROP, "CL_GetServerCommand: requested a command not received" );		return qfalse;	}	s = clc.serverCommands[ serverCommandNumber & ( MAX_RELIABLE_COMMANDS - 1 ) ];	clc.lastExecutedServerCommand = serverCommandNumber;	Com_DPrintf( "serverCommand: %i : %s/n", serverCommandNumber, s );rescan:	Cmd_TokenizeString( s );	cmd = Cmd_Argv(0);	argc = Cmd_Argc();	if ( !strcmp( cmd, "disconnect" ) ) {		// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=552		// allow server to indicate why they were disconnected		if ( argc >= 2 )			Com_Error( ERR_SERVERDISCONNECT, "Server disconnected - %s", Cmd_Argv( 1 ) );		else			Com_Error( ERR_SERVERDISCONNECT, "Server disconnected/n" );	}	if ( !strcmp( cmd, "bcs0" ) ) {		Com_sprintf( bigConfigString, BIG_INFO_STRING, "cs %s /"%s", Cmd_Argv(1), Cmd_Argv(2) );		return qfalse;	}	if ( !strcmp( cmd, "bcs1" ) ) {		s = Cmd_Argv(2);		if( strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING ) {			Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );		}		strcat( bigConfigString, s );		return qfalse;	}	if ( !strcmp( cmd, "bcs2" ) ) {		s = Cmd_Argv(2);		if( strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING ) {			Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );		}		strcat( bigConfigString, s );		strcat( bigConfigString, "/"" );		s = bigConfigString;		goto rescan;	}	if ( !strcmp( cmd, "cs" ) ) {		CL_ConfigstringModified();		// reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()		Cmd_TokenizeString( s );		return qtrue;	}	if ( !strcmp( cmd, "map_restart" ) ) {		// clear notify lines and outgoing commands before passing		// the restart to the cgame		Con_ClearNotify();		Com_Memset( cl.cmds, 0, sizeof( cl.cmds ) );		return qtrue;	}	// the clientLevelShot command is used during development	// to generate 128*128 screenshots from the intermission	// point of levels for the menu system to use	// we pass it along to the cgame to make apropriate adjustments,	// but we also clear the console and notify lines here	if ( !strcmp( cmd, "clientLevelShot" ) ) {		// don't do it if we aren't running the server locally,		// otherwise malicious remote servers could overwrite		// the existing thumbnails		if ( !com_sv_running->integer ) {			return qfalse;		}		// close the console		Con_Close();		// take a special screenshot next frame		Cbuf_AddText( "wait ; wait ; wait ; wait ; screenshot levelshot/n" );		return qtrue;	}	// we may want to put a "connect to other server" command here	// cgame can now act on the command	return qtrue;}
开发者ID:BruceJohnJennerLawso,项目名称:quake3,代码行数:101,


示例23: CLT3_GetServerCommand

//	Set up argc/argv for the given commandbool CLT3_GetServerCommand( int serverCommandNumber ) {	static char bigConfigString[ BIG_INFO_STRING ];	// if we have irretrievably lost a reliable command, drop the connection	int maxReliableCommands = GGameType & GAME_Quake3 ? MAX_RELIABLE_COMMANDS_Q3 : MAX_RELIABLE_COMMANDS_WOLF;	if ( serverCommandNumber <= clc.q3_serverCommandSequence - maxReliableCommands ) {		// when a demo record was started after the client got a whole bunch of		// reliable commands then the client never got those first reliable commands		if ( clc.demoplaying ) {			return false;		}		common->Error( "CLT3_GetServerCommand: a reliable command was cycled out" );		return false;	}	if ( serverCommandNumber > clc.q3_serverCommandSequence ) {		common->Error( "CLT3_GetServerCommand: requested a command not received" );		return false;	}	const char* s = clc.q3_serverCommands[ serverCommandNumber & ( maxReliableCommands - 1 ) ];	clc.q3_lastExecutedServerCommand = serverCommandNumber;	if ( clt3_showServerCommands->integer ) {		common->DPrintf( "serverCommand: %i : %s/n", serverCommandNumber, s );	}rescan:	Cmd_TokenizeString( s );	const char* cmd = Cmd_Argv( 0 );	int argc = Cmd_Argc();	if ( !String::Cmp( cmd, "disconnect" ) ) {		// allow server to indicate why they were disconnected		if ( argc >= 2 ) {			common->ServerDisconnected( "Server Disconnected - %s", Cmd_Argv( 1 ) );		} else {			common->ServerDisconnected( "Server disconnected/n" );		}	}	if ( !String::Cmp( cmd, "bcs0" ) ) {		String::Sprintf( bigConfigString, BIG_INFO_STRING, "cs %s /"%s", Cmd_Argv( 1 ), Cmd_Argv( 2 ) );		return false;	}	if ( !String::Cmp( cmd, "bcs1" ) ) {		s = Cmd_Argv( 2 );		if ( String::Length( bigConfigString ) + String::Length( s ) >= BIG_INFO_STRING ) {			common->Error( "bcs exceeded BIG_INFO_STRING" );		}		String::Cat( bigConfigString, sizeof ( bigConfigString ), s );		return false;	}	if ( !String::Cmp( cmd, "bcs2" ) ) {		s = Cmd_Argv( 2 );		if ( String::Length( bigConfigString ) + String::Length( s ) + 1 >= BIG_INFO_STRING ) {			common->Error( "bcs exceeded BIG_INFO_STRING" );		}		String::Cat( bigConfigString, sizeof ( bigConfigString ), s );		String::Cat( bigConfigString, sizeof ( bigConfigString ), "/"" );		s = bigConfigString;		goto rescan;	}	if ( !String::Cmp( cmd, "cs" ) ) {		CLT3_ConfigstringModified();		// reparse the string, because CLT3_ConfigstringModified may have done another Cmd_TokenizeString()		Cmd_TokenizeString( s );		return true;	}	if ( !String::Cmp( cmd, "map_restart" ) ) {		// clear notify lines and outgoing commands before passing		// the restart to the cgame		Con_ClearNotify();		Com_Memset( cl.q3_cmds, 0, sizeof ( cl.q3_cmds ) );		Com_Memset( cl.ws_cmds, 0, sizeof ( cl.ws_cmds ) );		Com_Memset( cl.wm_cmds, 0, sizeof ( cl.wm_cmds ) );		Com_Memset( cl.et_cmds, 0, sizeof ( cl.et_cmds ) );		return true;	}	// the clientLevelShot command is used during development	// to generate 128*128 screenshots from the intermission	// point of levels for the menu system to use	// we pass it along to the cgame to make apropriate adjustments,	// but we also clear the console and notify lines here	if ( !String::Cmp( cmd, "clientLevelShot" ) ) {		// don't do it if we aren't running the server locally,		// otherwise malicious remote servers could overwrite		// the existing thumbnails		if ( !com_sv_running->integer ) {			return false;		}		// close the console		Con_Close();		// take a special screenshot next frame//.........这里部分代码省略.........
开发者ID:janisl,项目名称:jlquake,代码行数:101,



注:本文中的Con_Close函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Con_DrawConsole函数代码示例
C++ Con_ClearNotify函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。