• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CL_AddReliableCommand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CLQW_CalcModelChecksum

static void CLQW_CalcModelChecksum( const char* modelName, const char* cvarName ) {
	idList<byte> buffer;
	if ( !FS_ReadFile( modelName, buffer ) ) {
		common->Error( "Couldn't load %s", modelName );
	}

	unsigned short crc;
	CRC_Init( &crc );
	for ( int i = 0; i < buffer.Num(); i++ ) {
		CRC_ProcessByte( &crc, buffer[ i ] );
	}

	char st[ 40 ];
	sprintf( st, "%d", ( int )crc );
	Info_SetValueForKey( cls.qh_userinfo, cvarName, st, MAX_INFO_STRING_QW, 64, 64, true, false );

	sprintf( st, "setinfo %s %d", cvarName, ( int )crc );
	CL_AddReliableCommand( st );
}
开发者ID:janisl,项目名称:jlquake,代码行数:19,代码来源:parse.cpp


示例2: CG_ScoresDown_f

static void CG_ScoresDown_f( void ) {

	if ( cg.scoresRequestTime + 2000 < cg.time ) {
		// the scores are more than two seconds out of data,
		// so request New ones
		cg.scoresRequestTime = cg.time;
		CL_AddReliableCommand( "score" );

		// leave the current scores up if they were already
		// displayed, but if this is the first hit, clear them out
		if ( !cg.showScores ) {
			cg.showScores = true;
			cg.numScores = 0;
		}
	} else {
		// show the cached contents even if they just pressed if it
		// is within two seconds
		cg.showScores = true;
	}
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:20,代码来源:cg_consolecmds.c


示例3: CL_Disconnect

/*
=====================
CL_Disconnect

Called when a connection, or cinematic is being terminated.
Goes from a connected state to either a menu state or a console state
Sends a disconnect message to the server
This is also called on Com_Error and Com_Quit, so it shouldn't cause any errors
=====================
*/
void CL_Disconnect( void ) {
	int		i;

	if ( !com_cl_running || !com_cl_running->integer ) {
		return;
	}

	if (cls.uiStarted)
		UI_SetActiveMenu( NULL,NULL );

	SCR_StopCinematic ();
	S_ClearSoundBuffer();

	// send a disconnect message to the server
	// send it a few times in case one is dropped
	if ( cls.state >= CA_CONNECTED ) {
		CL_AddReliableCommand( "disconnect" );
		CL_WritePacket();
		CL_WritePacket();
		CL_WritePacket();
	}
	
	CL_ClearState ();

	// wipe the client connection
	for ( i = 0 ; i < MAX_RELIABLE_COMMANDS ; i++ ) {
		if ( clc.reliableCommands[i] ) {
			Z_Free( clc.reliableCommands[i] );
		}
	}
	memset( &clc, 0, sizeof( clc ) );

	cls.state = CA_DISCONNECTED;

	// allow cheats locally
	Cvar_Set( "timescale", "1" );//jic we were skipping
	Cvar_Set( "skippingCinematic", "0" );//jic we were skipping
}
开发者ID:Agustinlv,项目名称:BlueHarvest,代码行数:48,代码来源:cl_main.cpp


示例4: CLQW_ParseModelList

static void CLQW_ParseModelList( QMsg& message ) {
	// precache models and note certain default indexes
	int nummodels = message.ReadByte();

	for (;; ) {
		const char* str = message.ReadString2();
		if ( !str[ 0 ] ) {
			break;
		}
		nummodels++;
		if ( nummodels == MAX_MODELS_Q1 ) {
			common->Error( "Server sent too many model_precache" );
		}
		String::Cpy( cl.qh_model_name[ nummodels ], str );

		if ( !String::Cmp( cl.qh_model_name[ nummodels ],"progs/spike.mdl" ) ) {
			clq1_spikeindex = nummodels;
		}
		if ( !String::Cmp( cl.qh_model_name[ nummodels ],"progs/player.mdl" ) ) {
			clq1_playerindex = nummodels;
		}
		if ( !String::Cmp( cl.qh_model_name[ nummodels ],"progs/flag.mdl" ) ) {
			clqw_flagindex = nummodels;
		}
	}

	int n = message.ReadByte();

	if ( n ) {
		CL_AddReliableCommand( va( "modellist %i %i", cl.servercount, n ) );
		return;
	}

	clc.downloadNumber = 0;
	clc.downloadType = dl_model;
	CLQW_Model_NextDownload();
}
开发者ID:janisl,项目名称:jlquake,代码行数:37,代码来源:parse.cpp


示例5: CL_ForwardCommandToServer

/*
===================
CL_ForwardCommandToServer

adds the current command line as a clientCommand
things like godmode, noclip, etc, are commands directed to the server,
so when they are typed in at the console, they will need to be forwarded.
===================
*/
void CL_ForwardCommandToServer( void ) {
	char	*cmd;
	char	string[MAX_STRING_CHARS];

	cmd = Cmd_Argv(0);

	// ignore key up commands
	if ( cmd[0] == '-' ) {
		return;
	}

	if ( cls.state != CA_ACTIVE || cmd[0] == '+' ) {
		Com_Printf ("Unknown command \"%s\"\n", cmd);
		return;
	}

	if ( Cmd_Argc() > 1 ) {
		Com_sprintf( string, sizeof(string), "%s %s", cmd, Cmd_Args() );
	} else {
		Q_strncpyz( string, cmd, sizeof(string) );
	}

	CL_AddReliableCommand( string );
}
开发者ID:Hasimir,项目名称:jedi-academy-1,代码行数:33,代码来源:cl_main.cpp


示例6: CL_cURL_BeginDownload

void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
{
    clc.cURLUsed = qtrue;
    Com_Printf("URL: %s\n", remoteURL);
    Com_DPrintf("***** CL_cURL_BeginDownload *****\n"
                "Localname: %s\n"
                "RemoteURL: %s\n"
                "****************************\n", localName, remoteURL);
    CL_cURL_Cleanup();
    Q_strncpyz(clc.downloadURL, remoteURL, sizeof(clc.downloadURL));
    Q_strncpyz(clc.downloadName, localName, sizeof(clc.downloadName));
    Com_sprintf(clc.downloadTempName, sizeof(clc.downloadTempName),
                "%s.tmp", localName);

    // Set so UI gets access to it
    Cvar_Set("cl_downloadName", localName);
    Cvar_Set("cl_downloadSize", "0");
    Cvar_Set("cl_downloadCount", "0");
    Cvar_SetValue("cl_downloadTime", cls.realtime);

    clc.downloadBlock = 0; // Starting new file
    clc.downloadCount = 0;

    clc.downloadCURL = qcurl_easy_init();
    if(!clc.downloadCURL) {
        Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_easy_init() "
                  "failed\n");
        return;
    }
    clc.download = FS_SV_FOpenFileWrite(clc.downloadTempName);
    if(!clc.download) {
        Com_Error(ERR_DROP, "CL_cURL_BeginDownload: failed to open "
                  "%s for writing\n", clc.downloadTempName);
        return;
    }
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download);
    if(com_developer->integer)
        qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
                      NET_AdrToString(clc.serverAddress)));
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
                      Q3_VERSION, qcurl_version()));
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
                      CL_cURL_CallbackWrite);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
                      CL_cURL_CallbackProgress);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
    qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
    clc.downloadCURLM = qcurl_multi_init();
    if(!clc.downloadCURLM) {
        qcurl_easy_cleanup(clc.downloadCURL);
        clc.downloadCURL = NULL;
        Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_multi_init() "
                  "failed\n");
        return;
    }
    qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);

    if(!(clc.sv_allowDownload & DLF_NO_DISCONNECT) &&
            !clc.cURLDisconnected) {

        CL_AddReliableCommand("disconnect");
        CL_WritePacket();
        CL_WritePacket();
        CL_WritePacket();
        clc.cURLDisconnected = qtrue;
    }
}
开发者ID:tariqhamid,项目名称:quake3,代码行数:74,代码来源:cl_curl.c


示例7: CL_GetServerCommand


//.........这里部分代码省略.........
	}

	if ( !strcmp( cmd, "bcs1" ) )
	{
		s = Cmd_QuoteString( 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_QuoteString( 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();
		memset( cl.cmds, 0, sizeof( cl.cmds ) );
		return qtrue;
	}

	if ( !strcmp( cmd, "popup" ) )
	{
		// direct server to client popup request, bypassing cgame
//      trap_UI_Popup(Cmd_Argv(1));
//      if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
//          VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_CLIPBOARD);
//          Menus_OpenByName(Cmd_Argv(1));
//      }
		return qfalse;
	}

#ifdef USE_CRYPTO

	if ( cl_pubkeyID->integer && !strcmp( cmd, "pubkey_request" ) )
	{
		char buffer[ MAX_STRING_CHARS ] = "pubkey ";
		mpz_get_str( buffer + 7, 16, public_key.n );
		CL_AddReliableCommand( buffer );
		return qfalse;
	}

	if ( cl_pubkeyID->integer && !strcmp( cmd, "pubkey_decrypt" ) )
	{
		char         buffer[ MAX_STRING_CHARS ] = "pubkey_identify ";
		unsigned int msg_len = MAX_STRING_CHARS - 16;
		mpz_t        message;

		if ( argc == 1 )
		{
			Com_Printf("%s", _( "^3Server sent a pubkey_decrypt command, but sent nothing to decrypt!\n" ));
			return qfalse;
		}

		mpz_init_set_str( message, Cmd_Argv( 1 ), 16 );

		if ( rsa_decrypt( &private_key, &msg_len, ( unsigned char * ) buffer + 16, message ) )
		{
			nettle_mpz_set_str_256_u( message, msg_len, ( unsigned char * ) buffer + 16 );
			mpz_get_str( buffer + 16, 16, message );
			CL_AddReliableCommand( buffer );
		}

		mpz_clear( message );
		return qfalse;
	}

#endif

	// we may want to put a "connect to other server" command here

	// cgame can now act on the command
	return qtrue;
}
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:101,代码来源:cl_cgame.c


示例8: CL_CgameSystemCalls


//.........这里部分代码省略.........

		case CG_FS_FCLOSEFILE:
			FS_FCloseFile( args[ 1 ] );
			return 0;

		case CG_FS_GETFILELIST:
			VM_CheckBlock( args[3], args[4], "FSGFL" );
			return FS_GetFileList( VMA( 1 ), VMA( 2 ), VMA( 3 ), args[ 4 ] );

		case CG_FS_DELETEFILE:
			return FS_Delete( VMA( 1 ) );

		case CG_SENDCONSOLECOMMAND:
			Cbuf_AddText( VMA( 1 ) );
			return 0;

		case CG_ADDCOMMAND:
			CL_AddCgameCommand( VMA( 1 ) );
			return 0;

		case CG_REMOVECOMMAND:
			Cmd_RemoveCommand( VMA( 1 ) );
			return 0;

		case CG_COMPLETE_CALLBACK:
			if ( completer )
			{
				completer( VMA( 1 ) );
			}

			return 0;

		case CG_SENDCLIENTCOMMAND:
			CL_AddReliableCommand( VMA( 1 ) );
			return 0;

		case CG_UPDATESCREEN:
			SCR_UpdateScreen();
			return 0;

		case CG_CM_LOADMAP:
			CL_CM_LoadMap( VMA( 1 ) );
			return 0;

		case CG_CM_NUMINLINEMODELS:
			return CM_NumInlineModels();

		case CG_CM_INLINEMODEL:
			return CM_InlineModel( args[ 1 ] );

		case CG_CM_TEMPBOXMODEL:
			return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qfalse );

		case CG_CM_TEMPCAPSULEMODEL:
			return CM_TempBoxModel( VMA( 1 ), VMA( 2 ), qtrue );

		case CG_CM_POINTCONTENTS:
			return CM_PointContents( VMA( 1 ), args[ 2 ] );

		case CG_CM_TRANSFORMEDPOINTCONTENTS:
			return CM_TransformedPointContents( VMA( 1 ), args[ 2 ], VMA( 3 ), VMA( 4 ) );

		case CG_CM_BOXTRACE:
			CM_BoxTrace( VMA( 1 ), VMA( 2 ), VMA( 3 ), VMA( 4 ), VMA( 5 ), args[ 6 ], args[ 7 ], TT_AABB );
			return 0;
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:66,代码来源:cl_cgame.c


示例9: CL_ParseServerData


//.........这里部分代码省略.........
	// game directory
	str = MSG_ReadString( msg );
	if( !str || !str[0] )
		Com_Error( ERR_DROP, "Server sent an empty game directory" );
	if( !COM_ValidateRelativeFilename( str ) || strchr( str, '/' ) )
		Com_Error( ERR_DROP, "Server sent an invalid game directory: %s", str );
	gamedir = FS_GameDirectory();
	if( strcmp( str, gamedir ) )
	{
		// shutdown the cgame module first in case it is running for whatever reason
		// (happens on wswtv in lobby), otherwise precaches that are going to follow
		// will probably fuck up (like models trying to load before the world model)
		CL_GameModule_Shutdown();

		if( !FS_SetGameDirectory( str, qtrue ) )
			Com_Error( ERR_DROP, "Failed to load game directory set by server: %s", str );
		ML_Restart( qtrue );
	}

	// parse player entity number
	cl.playernum = MSG_ReadShort( msg );

	// get the full level name
	Q_strncpyz( cl.servermessage, MSG_ReadString( msg ), sizeof( cl.servermessage ) );

	sv_bitflags = MSG_ReadByte( msg );

	if( cls.demo.playing )
	{
		cls.reliable = ( sv_bitflags & SV_BITFLAGS_RELIABLE );
	}
	else
	{
		if( cls.reliable != ( ( sv_bitflags & SV_BITFLAGS_RELIABLE ) != 0 ) )
			Com_Error( ERR_DROP, "Server and client disagree about connection reliability" );
	}

	// builting HTTP server port
	if( cls.httpbaseurl ) {
		Mem_Free( cls.httpbaseurl );
		cls.httpbaseurl = NULL;
	}

	if( ( sv_bitflags & SV_BITFLAGS_HTTP ) != 0 ) {
		if( ( sv_bitflags & SV_BITFLAGS_HTTP_BASEURL ) != 0 ) {
			// read base upstream url
			cls.httpbaseurl = ZoneCopyString( MSG_ReadString( msg ) );
		}
		else {
			http_portnum = MSG_ReadShort( msg ) & 0xffff;
			cls.httpaddress = cls.serveraddress;
			if( cls.httpaddress.type == NA_IP6 ) {
				cls.httpaddress.address.ipv6.port = BigShort( http_portnum );
			} else {
				cls.httpaddress.address.ipv4.port = BigShort( http_portnum );
			}
			if( http_portnum ) {
				if( cls.httpaddress.type == NA_LOOPBACK ) {
					cls.httpbaseurl = ZoneCopyString( va( "http://localhost:%hu/", http_portnum ) );
				}
				else {
					cls.httpbaseurl = ZoneCopyString( va( "http://%s/", NET_AddressToString( &cls.httpaddress ) ) );
				}
			}
		}
	}

	// pure list

	// clean old, if necessary
	Com_FreePureList( &cls.purelist );

	// add new
	numpure = MSG_ReadShort( msg );
	while( numpure > 0 )
	{
		const char *pakname = MSG_ReadString( msg );
		const unsigned checksum = MSG_ReadLong( msg );

		Com_AddPakToPureList( &cls.purelist, pakname, checksum, NULL );

		numpure--;
	}

	//assert( numpure == 0 );

	// get the configstrings request
	CL_AddReliableCommand( va( "configstrings %i 0", cl.servercount ) );

	cls.sv_pure = ( sv_bitflags & SV_BITFLAGS_PURE ) != 0;
	cls.sv_tv = ( sv_bitflags & SV_BITFLAGS_TVSERVER ) != 0;

#ifdef PURE_CHEAT
	cls.sv_pure = qfalse;
#endif

	// separate the printfs so the server message can have a color
	Com_Printf( S_COLOR_WHITE "\n" "=====================================\n" );
	Com_Printf( S_COLOR_WHITE "%s\n\n", cl.servermessage );
}
开发者ID:Turupawn,项目名称:DogeWarsow,代码行数:101,代码来源:cl_parse.c


示例10: CL_ParseDownload

/*
=====================
CL_ParseDownload

A download message has been received from the server
=====================
*/
void CL_ParseDownload ( msg_t *msg ) {
	int		size;
	unsigned char data[MAX_MSGLEN];
	uint16_t block;

	if (!*clc.downloadTempName) {
		Com_Printf("Server sending download, but no download was requested\n");
		CL_AddReliableCommand("stopdl", qfalse);
		return;
	}

	// read the data
	block = MSG_ReadShort ( msg );

	if(!block && !clc.downloadBlock)
	{
		// block zero is special, contains file size
		clc.downloadSize = MSG_ReadLong ( msg );

		Cvar_SetValue( "cl_downloadSize", clc.downloadSize );

		if (clc.downloadSize < 0)
		{
			Com_Error( ERR_DROP, "%s", MSG_ReadString( msg ) );
			return;
		}
	}

	size = MSG_ReadShort ( msg );
	if (size < 0 || size > sizeof(data))
	{
		Com_Error(ERR_DROP, "CL_ParseDownload: Invalid size %d for download chunk", size);
		return;
	}
	
	MSG_ReadData(msg, data, size);

	if((clc.downloadBlock & 0xFFFF) != block)
	{
		Com_DPrintf( "CL_ParseDownload: Expected block %d, got %d\n", (clc.downloadBlock & 0xFFFF), block);
		return;
	}

	// open the file if not opened yet
	if (!clc.download)
	{
		clc.download = FS_SV_FOpenFileWrite( clc.downloadTempName );

		if (!clc.download) {
			Com_Printf( "Could not create %s\n", clc.downloadTempName );
			CL_AddReliableCommand("stopdl", qfalse);
			CL_NextDownload();
			return;
		}
	}

	if (size)
		FS_Write( data, size, clc.download );

	CL_AddReliableCommand(va("nextdl %d", clc.downloadBlock), qfalse);
	clc.downloadBlock++;

	clc.downloadCount += size;

	// So UI gets access to it
	Cvar_SetValue( "cl_downloadCount", clc.downloadCount );

	if (!size) { // A zero length block means EOF
		if (clc.download) {
			FS_FCloseFile( clc.download );
			clc.download = 0;

			// rename the file
			FS_SV_Rename ( clc.downloadTempName, clc.downloadName, qfalse );
		}

		// send intentions now
		// We need this because without it, we would hold the last nextdl and then start
		// loading right away.  If we take a while to load, the server is happily trying
		// to send us that last block over and over.
		// Write it twice to help make sure we acknowledge the download
		CL_WritePacket();
		CL_WritePacket();

		// get another file if needed
		CL_NextDownload ();
	}
}
开发者ID:darklegion,项目名称:tremulous,代码行数:95,代码来源:cl_parse.c


示例11: CLWS_CgameSystemCalls

//	The cgame module is making a system call
qintptr CLWS_CgameSystemCalls( qintptr* args ) {
	switch ( args[ 0 ] ) {
	case WSCG_PRINT:
		common->Printf( "%s", ( char* )VMA( 1 ) );
		return 0;
	case WSCG_ERROR:
		common->Error( "%s", ( char* )VMA( 1 ) );
		return 0;
	case WSCG_MILLISECONDS:
		return Sys_Milliseconds();
	case WSCG_CVAR_REGISTER:
		Cvar_Register( ( vmCvar_t* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );
		return 0;
	case WSCG_CVAR_UPDATE:
		Cvar_Update( ( vmCvar_t* )VMA( 1 ) );
		return 0;
	case WSCG_CVAR_SET:
		Cvar_Set( ( char* )VMA( 1 ), ( char* )VMA( 2 ) );
		return 0;
	case WSCG_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
		return 0;
	case WSCG_ARGC:
		return Cmd_Argc();
	case WSCG_ARGV:
		Cmd_ArgvBuffer( args[ 1 ], ( char* )VMA( 2 ), args[ 3 ] );
		return 0;
	case WSCG_ARGS:
		Cmd_ArgsBuffer( ( char* )VMA( 1 ), args[ 2 ] );
		return 0;
	case WSCG_FS_FOPENFILE:
		return FS_FOpenFileByMode( ( char* )VMA( 1 ), ( fileHandle_t* )VMA( 2 ), ( fsMode_t )args[ 3 ] );
	case WSCG_FS_READ:
		FS_Read( VMA( 1 ), args[ 2 ], args[ 3 ] );
		return 0;
	case WSCG_FS_WRITE:
		return FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] );
	case WSCG_FS_FCLOSEFILE:
		FS_FCloseFile( args[ 1 ] );
		return 0;
	case WSCG_SENDCONSOLECOMMAND:
		Cbuf_AddText( ( char* )VMA( 1 ) );
		return 0;
	case WSCG_ADDCOMMAND:
		CLT3_AddCgameCommand( ( char* )VMA( 1 ) );
		return 0;
	case WSCG_REMOVECOMMAND:
		Cmd_RemoveCommand( ( char* )VMA( 1 ) );
		return 0;
	case WSCG_SENDCLIENTCOMMAND:
		CL_AddReliableCommand( ( char* )VMA( 1 ) );
		return 0;
	case WSCG_UPDATESCREEN:
		SCR_UpdateScreen();
		return 0;
	case WSCG_CM_LOADMAP:
		CLT3_CM_LoadMap( ( char* )VMA( 1 ) );
		return 0;
	case WSCG_CM_NUMINLINEMODELS:
		return CM_NumInlineModels();
	case WSCG_CM_INLINEMODEL:
		return CM_InlineModel( args[ 1 ] );
	case WSCG_CM_TEMPBOXMODEL:
		return CM_TempBoxModel( ( float* )VMA( 1 ), ( float* )VMA( 2 ), false );
	case WSCG_CM_TEMPCAPSULEMODEL:
		return CM_TempBoxModel( ( float* )VMA( 1 ), ( float* )VMA( 2 ), true );
	case WSCG_CM_POINTCONTENTS:
		return CM_PointContentsQ3( ( float* )VMA( 1 ), args[ 2 ] );
	case WSCG_CM_TRANSFORMEDPOINTCONTENTS:
		return CM_TransformedPointContentsQ3( ( float* )VMA( 1 ), args[ 2 ], ( float* )VMA( 3 ), ( float* )VMA( 4 ) );
	case WSCG_CM_BOXTRACE:
		CM_BoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], false );
		return 0;
	case WSCG_CM_TRANSFORMEDBOXTRACE:
		CM_TransformedBoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], ( float* )VMA( 8 ), ( float* )VMA( 9 ), false );
		return 0;
	case WSCG_CM_CAPSULETRACE:
		CM_BoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], true );
		return 0;
	case WSCG_CM_TRANSFORMEDCAPSULETRACE:
		CM_TransformedBoxTraceQ3( ( q3trace_t* )VMA( 1 ), ( float* )VMA( 2 ), ( float* )VMA( 3 ), ( float* )VMA( 4 ), ( float* )VMA( 5 ), args[ 6 ], args[ 7 ], ( float* )VMA( 8 ), ( float* )VMA( 9 ), true );
		return 0;
	case WSCG_CM_MARKFRAGMENTS:
		return R_MarkFragmentsWolf( args[ 1 ], ( const vec3_t* )VMA( 2 ), ( float* )VMA( 3 ), args[ 4 ], ( float* )VMA( 5 ), args[ 6 ], ( markFragment_t* )VMA( 7 ) );
	case WSCG_S_STARTSOUND:
		S_StartSound( ( float* )VMA( 1 ), args[ 2 ], args[ 3 ], args[ 4 ], 0.5 );
		return 0;
	case WSCG_S_STARTSOUNDEX:
		S_StartSoundEx( ( float* )VMA( 1 ), args[ 2 ], args[ 3 ], args[ 4 ], args[ 5 ], 127 );
		return 0;
	case WSCG_S_STARTLOCALSOUND:
		S_StartLocalSound( args[ 1 ], args[ 2 ], 127 );
		return 0;
	case WSCG_S_CLEARLOOPINGSOUNDS:
		CLWS_ClearLoopingSounds( args[ 1 ] );
		return 0;
	case WSCG_S_ADDLOOPINGSOUND:
		// FIXME MrE: handling of looping sounds changed
		S_AddLoopingSound( args[ 1 ], ( float* )VMA( 2 ), ( float* )VMA( 3 ), args[ 4 ], args[ 5 ], args[ 6 ], 0 );
//.........这里部分代码省略.........
开发者ID:janisl,项目名称:jlquake,代码行数:101,代码来源:cgame.cpp


示例12: CLQW_ParseServerData

static void CLQW_ParseServerData( QMsg& message ) {
	common->DPrintf( "Serverdata packet received.\n" );

	Cbuf_Execute();			// make sure any stuffed commands are done

	R_Shutdown( false );
	CL_InitRenderer();

	//
	// wipe the clientActive_t struct
	//
	CL_ClearState();

	// parse protocol version number
	// allow 2.2 and 2.29 demos to play
	int protover = message.ReadLong();
	if ( protover != QWPROTOCOL_VERSION &&
		 !( clc.demoplaying && ( protover == 26 || protover == 27 || protover == 28 ) ) ) {
		common->Error( "Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, QWPROTOCOL_VERSION );
	}

	cl.servercount = message.ReadLong();

	// game directory
	const char* str = message.ReadString2();

	bool cflag = false;
	if ( String::ICmp( fsqhw_gamedirfile, str ) ) {
		// save current config
		Com_WriteConfiguration();
		cflag = true;
	}

	FS_SetGamedirQHW( str );

	//ZOID--run the autoexec.cfg in the gamedir
	//if it exists
	if ( cflag ) {
		if ( FS_FileExists( "config.cfg" ) ) {
			Cbuf_AddText( "cl_warncmd 0\n" );
			Cbuf_AddText( "exec config.cfg\n" );
			Cbuf_AddText( "exec frontend.cfg\n" );
			Cbuf_AddText( "cl_warncmd 1\n" );
		}
	}

	// parse player slot, high bit means spectator
	cl.playernum = message.ReadByte();
	if ( cl.playernum & 128 ) {
		cl.qh_spectator = true;
		cl.playernum &= ~128;
	}
	cl.viewentity = cl.playernum + 1;

	// get the full level name
	str = const_cast<char*>( message.ReadString2() );
	String::NCpy( cl.qh_levelname, str, sizeof ( cl.qh_levelname ) - 1 );

	// get the movevars
	movevars.gravity            = message.ReadFloat();
	movevars.stopspeed          = message.ReadFloat();
	movevars.maxspeed           = message.ReadFloat();
	movevars.spectatormaxspeed  = message.ReadFloat();
	movevars.accelerate         = message.ReadFloat();
	movevars.airaccelerate      = message.ReadFloat();
	movevars.wateraccelerate    = message.ReadFloat();
	movevars.friction           = message.ReadFloat();
	movevars.waterfriction      = message.ReadFloat();
	movevars.entgravity         = message.ReadFloat();

	// seperate the printfs so the server message can have a color
	common->Printf( "\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n" );
	common->Printf( S_COLOR_ORANGE "%s" S_COLOR_WHITE "\n", str );

	// ask for the sound list next
	Com_Memset( cl.qh_sound_name, 0, sizeof ( cl.qh_sound_name ) );
	CL_AddReliableCommand( va( "soundlist %i %i", cl.servercount, 0 ) );

	// now waiting for downloads, etc
	cls.state = CA_LOADING;
}
开发者ID:janisl,项目名称:jlquake,代码行数:81,代码来源:parse.cpp


示例13: CL_CgameSystemCalls

intptr_t CL_CgameSystemCalls(intptr_t *args)
{
	switch (args[0])
	{
	case CG_PRINT:
		Com_Printf("%s", (char *)VMA(1));
		return 0;
	case CG_ERROR:
		Com_Error(ERR_DROP, "%s", (char *)VMA(1));
		return 0;
	case CG_MILLISECONDS:
		return Sys_Milliseconds();
	case CG_CVAR_REGISTER:
		Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
		return 0;
	case CG_CVAR_UPDATE:
		Cvar_Update(VMA(1));
		return 0;
	case CG_CVAR_SET:
		Cvar_SetSafe(VMA(1), VMA(2));
		return 0;
	case CG_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
		return 0;
	case CG_CVAR_LATCHEDVARIABLESTRINGBUFFER:
		Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
		return 0;
	case CG_ARGC:
		return Cmd_Argc();
	case CG_ARGV:
		Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
		return 0;
	case CG_ARGS:
		Cmd_ArgsBuffer(VMA(1), args[2]);
		return 0;
	case CG_FS_FOPENFILE:
		return FS_FOpenFileByMode(VMA(1), VMA(2), args[3]);
	case CG_FS_READ:
		FS_Read(VMA(1), args[2], args[3]);
		return 0;
	case CG_FS_WRITE:
		return FS_Write(VMA(1), args[2], args[3]);
	case CG_FS_FCLOSEFILE:
		FS_FCloseFile(args[1]);
		return 0;
	case CG_FS_GETFILELIST:
		return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
	case CG_FS_DELETEFILE:
		return FS_Delete(VMA(1));
	case CG_SENDCONSOLECOMMAND:
		Cbuf_AddText(VMA(1));
		return 0;
	case CG_ADDCOMMAND:
		CL_AddCgameCommand(VMA(1));
		return 0;
	case CG_REMOVECOMMAND:
		Cmd_RemoveCommandSafe(VMA(1));
		return 0;
	case CG_SENDCLIENTCOMMAND:
		CL_AddReliableCommand(VMA(1));
		return 0;
	case CG_UPDATESCREEN:
		SCR_UpdateScreen();
		return 0;
	case CG_CM_LOADMAP:
		CL_CM_LoadMap(VMA(1));
		return 0;
	case CG_CM_NUMINLINEMODELS:
		return CM_NumInlineModels();
	case CG_CM_INLINEMODEL:
		return CM_InlineModel(args[1]);
	case CG_CM_TEMPBOXMODEL:
		return CM_TempBoxModel(VMA(1), VMA(2), qfalse);
	case CG_CM_TEMPCAPSULEMODEL:
		return CM_TempBoxModel(VMA(1), VMA(2), qtrue);
	case CG_CM_POINTCONTENTS:
		return CM_PointContents(VMA(1), args[2]);
	case CG_CM_TRANSFORMEDPOINTCONTENTS:
		return CM_TransformedPointContents(VMA(1), args[2], VMA(3), VMA(4));
	case CG_CM_BOXTRACE:
		CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse);
		return 0;
	case CG_CM_CAPSULETRACE:
		CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue);
		return 0;
	case CG_CM_TRANSFORMEDBOXTRACE:
		CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse);
		return 0;
	case CG_CM_TRANSFORMEDCAPSULETRACE:
		CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue);
		return 0;
	case CG_CM_MARKFRAGMENTS:
		return re.MarkFragments(args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7));

	case CG_R_PROJECTDECAL:
		re.ProjectDecal(args[1], args[2], VMA(3), VMA(4), VMA(5), args[6], args[7]);
		return 0;
	case CG_R_CLEARDECALS:
		re.ClearDecals();
		return 0;
//.........这里部分代码省略.........
开发者ID:Mailaender,项目名称:etlegacy,代码行数:101,代码来源:cl_cgame.c


示例14: CL_CgameSystemCalls

/*
====================
CL_CgameSystemCalls

The cgame module is making a system call
====================
*/
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
	switch( args[0] ) {
	case CG_PRINT:
		Com_Printf( "%s", VMA(1) );
		return 0;
	case CG_FATAL_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;
	case CG_MILLISECONDS:
		return Sys_Milliseconds();
	case CG_CVAR_REGISTER:
		Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] ); 
		return 0;
	case CG_CVAR_UPDATE:
		Cvar_Update( VMA(1) );
		return 0;
	case CG_CVAR_SET:
		Cvar_Set( VMA(1), VMA(2) );
		return 0;
	case CG_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
		return 0;
	case CG_ARGC:
		return Cmd_Argc();
	case CG_ARGV:
		Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
		return 0;
	case CG_ARGVI:
		return atoi( Cmd_Argv( args[1] ) );
	case CG_ARGS:
		Cmd_ArgsBuffer( VMA(1), args[2] );
		return 0;
	case CG_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], VMA(2) );
		return 0;
	case CG_FS_FOPENFILE:
		return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
	case CG_FS_READ:
		FS_Read( VMA(1), args[2], args[3] );
		return 0;
	case CG_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;
	case CG_FS_FCLOSEFILE:
		FS_FCloseFile( args[1] );
		return 0;
	case CG_SENDCONSOLECOMMAND:
		Cbuf_AddText( VMA(1) );
		return 0;
	case CG_FORWARDCOMMAND:
		VM_Call( uivm, UI_CONSOLE_COMMAND, cls.realtime );
		return 0;
	case CG_ADDCOMMAND:
		CL_AddCgameCommand( VMA(1) );
		return 0;
	case CG_REMOVECOMMAND:
		Cmd_RemoveCommand( VMA(1) );
		return 0;
	case CG_SENDCLIENTCOMMAND:
		CL_AddReliableCommand( VMA(1) );
		return 0;
	case CG_UPDATESCREEN:
		// this is used during lengthy level loading, so pump message loop
//		Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
// if there is a map change while we are downloading at pk3.
// ZOID
		SCR_UpdateScreen();
		return 0;
	case CG_CM_LOADMAP:
		CL_CM_LoadMap( VMA(1) );
		return 0;
	case CG_CM_NUMINLINEMODELS:
		return CM_NumInlineModels();
	case CG_CM_INLINEMODEL:
		return CM_InlineModel( args[1] );
	case CG_CM_TEMPBOXMODEL:
		return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qfalse );
	case CG_CM_TEMPCAPSULEMODEL:
		return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qtrue );
	case CG_CM_POINTCONTENTS:
		return CM_PointContents( VMA(1), args[2] );
	case CG_CM_TRANSFORMEDPOINTCONTENTS:
		return CM_TransformedPointContents( VMA(1), args[2], VMA(3), VMA(4) );
	case CG_CM_BOXTRACE:
		CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse );
		return 0;
	case CG_CM_CAPSULETRACE:
		CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue );
		return 0;
	case CG_CM_TRANSFORMEDBOXTRACE:
		CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse );
		return 0;
//.........这里部分代码省略.........
开发者ID:ballju,项目名称:SpaceTrader-GPL-1.1.14,代码行数:101,代码来源:cl_cgame.c


示例15: CL_HandleServerCommand


//.........这里部分代码省略.........
		return false;
	}

	auto cmd = args.Argv(0);
	int argc = args.Argc();

	if (cmd == "disconnect") {
		// NERVE - SMF - allow server to indicate why they were disconnected
		if (argc >= 2) {
			Com_Error(errorParm_t::ERR_SERVERDISCONNECT, "Server disconnected: %s", args.Argv(1).c_str());
		} else {
			Com_Error(errorParm_t::ERR_SERVERDISCONNECT, "Server disconnected");
		}
	}

	// bcs0 to bcs2 are used by the server to send info strings that are bigger than the size of a packet.
	// See also SV_UpdateConfigStrings
	// bcs0 starts a new big config string
	// bcs1 continues it
	// bcs2 finishes it and feeds it back as a new command sent by the server (bcs0 makes it a cs command)
	if (cmd == "bcs0") {
		if (argc >= 3) {
			Com_sprintf(bigConfigString, BIG_INFO_STRING, "cs %s %s", args.Argv(1).c_str(), args.EscapedArgs(2).c_str());
		}
		return false;
	}

	if (cmd == "bcs1") {
		if (argc >= 3) {
			const char* s = Cmd_QuoteString( args[2].c_str() );

			if (strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING) {
				Com_Error(errorParm_t::ERR_DROP, "bcs exceeded BIG_INFO_STRING");
			}

			Q_strcat(bigConfigString, sizeof(bigConfigString), s);
		}
		return false;
	}

	if (cmd == "bcs2") {
		if (argc >= 3) {
			const char* s = Cmd_QuoteString( args[2].c_str() );

			if (strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING) {
				Com_Error(errorParm_t::ERR_DROP, "bcs exceeded BIG_INFO_STRING");
			}

			Q_strcat(bigConfigString, sizeof(bigConfigString), s);
			Q_strcat(bigConfigString, sizeof(bigConfigString), "\"");
			newText = bigConfigString;
			return CL_HandleServerCommand(bigConfigString, newText);
		}
		return false;
	}

	if (cmd == "cs") {
		CL_ConfigstringModified(args);
		return true;
	}

	if (cmd == "map_restart") {
		// clear outgoing commands before passing
		// the restart to the cgame
		memset(cl.cmds, 0, sizeof(cl.cmds));
		return true;
	}

	if (cmd == "popup") {
		// direct server to client popup request, bypassing cgame
		if (cls.state == connstate_t::CA_ACTIVE && !clc.demoplaying && argc >=1) {
			// TODO: Pass to the cgame
		}
		return false;
	}

	if (cmd == "pubkey_decrypt") {
		char         buffer[ MAX_STRING_CHARS ] = "pubkey_identify ";
		NettleLength msg_len = MAX_STRING_CHARS - 16;
		mpz_t        message;

		if (argc == 1) {
			Log::Notice("^3Server sent a pubkey_decrypt command, but sent nothing to decrypt!\n");
			return false;
		}

		mpz_init_set_str(message, args.Argv(1).c_str(), 16);

		if (rsa_decrypt(&private_key, &msg_len, (unsigned char *) buffer + 16, message)) {
			nettle_mpz_set_str_256_u(message, msg_len, (unsigned char *) buffer + 16);
			mpz_get_str(buffer + 16, 16, message);
			CL_AddReliableCommand(buffer);
		}

		mpz_clear(message);
		return false;
	}

	return true;
}
开发者ID:unrealarena,项目名称:unrealarena,代码行数:101,代码来源:cl_cgame.cpp


示例16: DL_End

void DL_End( CURLcode res, CURLMcode resm )
{
	CURLMsg *msg;
	int msgs;

	if( dl_verbose->integer == 0 && dl_showprogress->integer == 2 && !curlm )
		Com_Printf( "\n" );
	
	if( curlm )
	{	
		// res = final download result
		while( ( msg = curl_multi_info_read( curlm, &msgs ) ) )
		{
			if( msg->msg != CURLMSG_DONE )
			{
				if( dl_error[0] == '\0' )
					Q_strncpyz( dl_error, "Download Interrupted.", sizeof(dl_error) );
			}
			else if( msg->easy_handle == curl )
			{
				if( msg->data.result != CURLE_OK );
					res = msg->data.result;
			}
			else
			{
				Com_Printf( "Invalid cURL handle.\n" );
			}
		}

		curl_multi_cleanup( curlm );
		curlm = NULL;		
	}

	if( curl )
	{
		curl_easy_cleanup( curl );
		curl = NULL;
	}

	// get possible error messages
	if( !*dl_error && res != CURLE_OK )
		Q_strncpyz( dl_error, curl_easy_strerror(res), sizeof(dl_error) );
	if( !*dl_error && resm != CURLM_OK )
		Q_strncpyz( dl_error, curl_multi_strerror(resm), sizeof(dl_error) );
	if( !*dl_error && !f )
		Q_strncpyz( dl_error, "File is not opened.", sizeof(dl_error) );

	if (f) {
		FS_FCloseFile(f);
		f = 0;
		if (!*dl_error) {	// download succeeded
			char dest[MAX_OSPATH];
			Com_Printf("Download complete, restarting filesystem.\n");
			Q_strncpyz(dest, path, strlen(path)-3);	// -4 +1 for the trailing \0
			Q_strcat(dest, sizeof(dest), ".pk3");
			if (!FS_FileExists(dest)) {
				FS_SV_Rename(path, dest);
				FS_Restart(clc.checksumFeed);
				if (dl_showmotd->integer && *motd) {
					Com_Printf("Server motd: %s\n", motd);
				}
			} else {
				// normally such errors should be caught upon starting the transfer. Anyway better do
				// it here again - the filesystem might have changed, plus this may help contain some
				// bugs / exploitable flaws in the code.
				Com_Printf("Failed to copy downloaded file to its location - file already exists.\n");
				FS_HomeRemove(path);
			}
		} else {
			FS_HomeRemove(path);
		}
	}

	Cvar_Set( "cl_downloadName", "" );  // hide the ui downloading screen
	Cvar_SetValue( "cl_downloadSize", 0 );
	Cvar_SetValue( "cl_downloadCount", 0 );
	Cvar_SetValue( "cl_downloadTime", 0 );
	Cvar_Set( "cl_downloadMotd", "" );

	if( *dl_error )
	{
		if( clc.state == CA_CONNECTED )
			Com_Error( ERR_DROP, "%s\n", dl_error ); // download error while connecting, can not continue loading
		else
			Com_Printf( "%s\n", dl_error ); // download error while in game, do not disconnect

		*dl_error = '\0';
	}
	else
	{
		if (strlen(Cvar_VariableString("cl_downloadDemo"))) {
			Cbuf_AddText( va("demo %s\n", Cvar_VariableString("cl_downloadDemo") ) );
		// download completed, request new gamestate to check possible new map if we are not already in game
		} else if( clc.state == CA_CONNECTED)
			CL_AddReliableCommand( "donedl", qfalse); // get new gamestate info from server
	}
}
开发者ID:dourvaris,项目名称:iodfe,代码行数:97,代码来源:cl_download.c


示例17: CL_CgameSystemCalls

intptr_t CL_CgameSystemCalls( intptr_t *args )
{
	if( cls.cgInterface == 2 && args[0] >= CG_R_SETCLIPREGION && args[0] < CG_MEMSET )
    {
		if( args[0] < CG_S_STOPBACKGROUNDTRACK - 1 )
			args[0] += 1;

        else if( args[0] < CG_S_STOPBACKGROUNDTRACK + 4 )
			args[0] += CG_PARSE_ADD_GLOBAL_DEFINE - CG_S_STOPBACKGROUNDTRACK + 1;

        else if( args[0] < CG_PARSE_ADD_GLOBAL_DEFINE + 4 )
			args[0] -= 4;

        else if( args[0] >= CG_PARSE_SOURCE_FILE_AND_LINE && args[0] <= CG_S_SOUNDDURATION )
			args[0] = CG_PARSE_SOURCE_FILE_AND_LINE - 1337 - args[0] ;
	}

	switch( args[0] )
    {
        case CG_PRINT:
            Com_Printf( "%s", (const char*)VMA(1) );
            return 0;
        case CG_ERROR:
            if( probingCG )
            {
                cls.cgInterface = 2; // this is a 1.1.0 cgame
                return 0;
            }
            Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
            return 0;
        case CG_MILLISECONDS:
            return Sys_Milliseconds();
        case CG_CVAR_REGISTER:
            Cvar_Register( (vmCvar_t*)VMA(1), (const char*)VMA(2), (const char*)VMA(3), args[4] ); 
            return 0;
        case CG_CVAR_UPDATE:
            Cvar_Update( (vmCvar_t*)VMA(1) );
            return 0;
        case CG_CVAR_SET:
            Cvar_SetSafe( (const char*)VMA(1), (const char*)VMA(2) );
            return 0;
        case CG_CVAR_VARIABLESTRINGBUFFER:
            Cvar_VariableStringBuffer( (const char*)VMA(1), (char*)VMA(2), args[3] );
            return 0;
        case CG_ARGC:
            return Cmd_Argc();
        case CG_ARGV:
            Cmd_ArgvBuffer( args[1], (char*)VMA(2), args[3] );
            return 0;
        case CG_ARGS:
            Cmd_ArgsBuffer( (char*)VMA(1), args[2] );
            return 0;
        case CG_LITERAL_ARGS:
            Cmd_LiteralArgsBuffer( (char*)VMA(1), args[2] );
            return 0;

        case CG_FS_FOPENFILE:
            return FS_FOpenFileByMode( (const char*)VMA(1), (fileHandle_t*)VMA(2), (FS_Mode)args[3] );
        case CG_FS_READ:
            FS_Read( VMA(1), args[2], args[3] );
            return 0;
        case CG_FS_WRITE:
            FS_Write( VMA(1), args[2], args[3] );
            return 0;
        case CG_FS_FCLOSEFILE:
            FS_FCloseFile( args[1] );
            return 0;
        case CG_FS_SEEK:
            return FS_Seek( (fileHandle_t)args[1], args[2], (FS_Origin)args[3] );
        case CG_FS_GETFILELIST:
            return FS_GetFileList( (const char*)VMA(1), (const char*)VMA(2), (char*)VMA(3), args[4] );

        case CG_SENDCONSOLECOMMAND:
            Cbuf_AddText( (const char*)VMA(1) );
            return 0;
        case CG_ADDCOMMAND:
	        Cmd_AddCommand( (const char*)VMA(1), NULL );
            return 0;
        case CG_REMOVECOMMAND:
            Cmd_RemoveCommandSafe( (const char*)VMA(1) );
            return 0;
        case CG_SENDCLIENTCOMMAND:
            CL_AddReliableCommand((const char*)VMA(1), false);
            return 0;
        case CG_UPDATESCREEN:
            // this is used during lengthy level loading, so pump message loop
            //		Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
            // We can't call Com_EventLoop here, a restart will crash and this _does_ happen
            // if there is a map change while we are downloading at pk3.
            // ZOID
            SCR_UpdateScreen();
            return 0;
        case CG_CM_LOADMAP:
            CL_CM_LoadMap( (const char*)VMA(1) );
            return 0;
        case CG_CM_NUMINLINEMODELS:
            return CM_NumInlineModels();
        case CG_CM_INLINEMODEL:
            return CM_InlineModel( args[1] );
        case CG_CM_TEMPBOXMODEL:
//.........这里部分代码省略.........
开发者ID:wtfbbqhax,项目名称:tremulous,代码行数:101,代码来源:cl_cgame.cpp


示例18: CL_DownloadRequest

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CL_AllocParticle函数代码示例发布时间:2022-05-30
下一篇:
C++ CL_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap