这篇教程C++ CL_AddReliableCommand函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CL_AddReliableCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ CL_AddReliableCommand函数的具体用法?C++ CL_AddReliableCommand怎么用?C++ CL_AddReliableCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CL_AddReliableCommand函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CLQW_CalcModelChecksumstatic 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,
示例2: CG_ScoresDown_fstatic 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,
示例3: CL_Disconnect/*=====================CL_DisconnectCalled when a connection, or cinematic is being terminated.Goes from a connected state to either a menu state or a console stateSends a disconnect message to the serverThis 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,
示例4: CLQW_ParseModelListstatic 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,
示例5: CL_ForwardCommandToServer/*===================CL_ForwardCommandToServeradds the current command line as a clientCommandthings 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,
示例6: CL_cURL_BeginDownloadvoid 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,
示例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,
示例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,
示例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,
示例10: CL_ParseDownload/*=====================CL_ParseDownloadA 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,
示例11: CLWS_CgameSystemCalls// The cgame module is making a system callqintptr 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,
示例12: CLQW_ParseServerDatastatic 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,
示例13: CL_CgameSystemCallsintptr_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,
示例14: CL_CgameSystemCalls/*====================CL_CgameSystemCallsThe 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,
示例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,
示例16: DL_Endvoid 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,
示例17: CL_CgameSystemCallsintptr_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,
示例18: CL_DownloadRequest/** CL_DownloadRequest* * Request file download* return false if couldn't request it for some reason* Files with .pk3 or .pak extension have to have gamedir attached* Other files must not have gamedir*/bool CL_DownloadRequest( const char *filename, bool requestpak ){ if( cls.download.requestname ) { Com_Printf( "Can't download: %s. Download already in progress./n", filename ); return false; } if( !COM_ValidateRelativeFilename( filename ) ) { Com_Printf( "Can't download: %s. Invalid filename./n", filename ); return false; } if( FS_CheckPakExtension( filename ) ) { if( FS_PakFileExists( filename ) ) { Com_Printf( "Can't download: %s. File already exists./n", filename ); return false; } if( !Q_strnicmp( COM_FileBase( filename ), "modules", strlen( "modules" ) ) ) { if( !CL_CanDownloadModules() ) return false; } } else { if( FS_FOpenFile( filename, NULL, FS_READ ) != -1 ) { Com_Printf( "Can't download: %s. File already exists./n", filename ); return false; } if( !requestpak ) { const char *extension; // only allow demo downloads extension = COM_FileExtension( filename ); if( !extension || Q_stricmp( extension, APP_DEMO_EXTENSION_STR ) ) { Com_Printf( "Can't download, got arbitrary file type: %s/n", filename ); return false; } } } if( cls.socket->type == SOCKET_LOOPBACK ) { Com_DPrintf( "Can't download: %s. Loopback server./n", filename ); return false; } Com_Printf( "Asking to download: %s/n", filename ); cls.download.requestpak = requestpak; cls.download.requestname = Mem_ZoneMalloc( sizeof( char ) * ( strlen( filename ) + 1 ) ); Q_strncpyz( cls.download.requestname, filename, sizeof( char ) * ( strlen( filename ) + 1 ) ); cls.download.timeout = Sys_Milliseconds() + 5000; CL_AddReliableCommand( va( "download %i /"%s/"", requestpak, filename ) ); return true;}
开发者ID:MGXRace,项目名称:racesow,代码行数:73,
示例19: CL_CgameSystemCallsintptr_t CL_CgameSystemCalls( intptr_t *args ) {#ifndef __NO_JK2 if( com_jk2 && com_jk2->integer ) { args[0] = (intptr_t)CL_ConvertJK2SysCall((cgameJK2Import_t)args[0]); }#endif switch( args[0] ) { case CG_PRINT: Com_Printf( "%s", VMA(1) ); return 0; case CG_ERROR: Com_Error( ERR_DROP, S_COLOR_RED"%s", 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_Set( (const char *) VMA(1), (const char *) VMA(2) ); 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_FS_FOPENFILE: return FS_FOpenFileByMode( (const char *) VMA(1), (int *) VMA(2), (fsMode_t) 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( (const char *) VMA(1) ); return 0; case CG_ADDCOMMAND: CL_AddCgameCommand( (const char *) VMA(1) ); return 0; case CG_SENDCLIENTCOMMAND: CL_AddReliableCommand( (const char *) 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! SCR_UpdateScreen(); return 0; case CG_RMG_INIT: /* if (!com_sv_running->integer) { // don't do this if we are connected locally if (!TheRandomMissionManager) { TheRandomMissionManager = new CRMManager; } TheRandomMissionManager->SetLandScape( cmg.landScapes[args[1]] ); TheRandomMissionManager->LoadMission(qfalse); TheRandomMissionManager->SpawnMission(qfalse); cmg.landScapes[args[1]]->UpdatePatches(); } */ //this is SP.. I guess we're always the client and server.// cl.mRMGChecksum = cm.landScapes[args[1]]->get_rand_seed(); RM_CreateRandomModels(args[1], (const char *)VMA(2)); //cmg.landScapes[args[1]]->rand_seed(cl.mRMGChecksum); // restore it, in case we do a vid restart cmg.landScape->rand_seed(cmg.landScape->get_rand_seed());// TheRandomMissionManager->CreateMap(); return 0; case CG_CM_REGISTER_TERRAIN: return CM_RegisterTerrain((const char *)VMA(1), false)->GetTerrainId(); case CG_RE_INIT_RENDERER_TERRAIN: re.InitRendererTerrain((const char *)VMA(1)); return 0; case CG_CM_LOADMAP: CL_CM_LoadMap( (const char *) VMA(1), args[2] ); 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( (const float *) VMA(1), (const float *) VMA(2) );//, (int) VMA(3) ); case CG_CM_POINTCONTENTS: return CM_PointContents( (float *)VMA(1), args[2] ); case CG_CM_TRANSFORMEDPOINTCONTENTS: return CM_TransformedPointContents( (const float *) VMA(1), args[2], (const float *) VMA(3), (const float *) VMA(4) ); case CG_CM_BOXTRACE: CM_BoxTrace( (trace_t *) VMA(1), (const float *) VMA(2), (const float *) VMA(3), (const float *) VMA(4), (const float *) VMA(5), args[6], args[7] );//.........这里部分代码省略.........
开发者ID:Delfin1,项目名称:OpenJK,代码行数:101,
示例20: CL_ParseDownload/*=====================CL_ParseDownloadA download message has been received from the server=====================*/void CL_ParseDownload( msg_t *msg ){ int size; unsigned char data[ MAX_MSGLEN ]; int block; if ( !*cls.downloadTempName ) { Com_Printf("%s", _( "Server sending download, but no download was requested/n" )); CL_AddReliableCommand( "stopdl" ); return; } // read the data block = MSG_ReadShort( msg ); // TTimo - www dl // if we haven't acked the download redirect yet if ( block == -1 ) { if ( !clc.bWWWDl ) { // server is sending us a www download Q_strncpyz( cls.originalDownloadName, cls.downloadName, sizeof( cls.originalDownloadName ) ); Q_strncpyz( cls.downloadName, MSG_ReadString( msg ), sizeof( cls.downloadName ) ); clc.downloadSize = MSG_ReadLong( msg ); clc.downloadFlags = MSG_ReadLong( msg ); Cvar_SetValue( "cl_downloadSize", clc.downloadSize ); Com_DPrintf( "Server redirected download: %s/n", cls.downloadName ); clc.bWWWDl = qtrue; // activate wwwdl client loop CL_AddReliableCommand( "wwwdl ack" ); // make sure the server is not trying to redirect us again on a bad checksum if ( strstr( clc.badChecksumList, va( "@%s", cls.originalDownloadName ) ) ) { Com_Printf(_( "refusing redirect to %s by server (bad checksum)/n"), cls.downloadName ); CL_AddReliableCommand( "wwwdl fail" ); clc.bWWWDlAborting = qtrue; return; } // make downloadTempName an OS path Q_strncpyz( cls.downloadTempName, FS_BuildOSPath( Cvar_VariableString( "fs_homepath" ), cls.downloadTempName, "" ), sizeof( cls.downloadTempName ) ); cls.downloadTempName[ strlen( cls.downloadTempName ) - 1 ] = '/0'; if ( !DL_BeginDownload( cls.downloadTempName, cls.downloadName, com_developer->integer ) ) { // setting bWWWDl to false after sending the wwwdl fail doesn't work // not sure why, but I suspect we have to eat all remaining block -1 that the server has sent us // still leave a flag so that CL_WWWDownload is inactive // we count on server sending us a gamestate to start up clean again CL_AddReliableCommand( "wwwdl fail" ); clc.bWWWDlAborting = qtrue; Com_Printf(_( "Failed to initialize download for '%s'/n"), cls.downloadName ); } // Check for a disconnected download // we'll let the server disconnect us when it gets the bbl8r message if ( clc.downloadFlags & ( 1 << DL_FLAG_DISCON ) ) { CL_AddReliableCommand( "wwwdl bbl8r" ); cls.bWWWDlDisconnected = qtrue; } return; } else { // server keeps sending that message till we ack it, eat and ignore //MSG_ReadLong( msg ); MSG_ReadString( msg ); MSG_ReadLong( msg ); MSG_ReadLong( msg ); return; } } if ( !block ) { // 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 ) ); } } size = MSG_ReadShort( msg );//.........这里部分代码省略.........
开发者ID:justhacking,项目名称:Unvanquished,代码行数:101,
示例21: CL_InitDownload_f//.........这里部分代码省略......... cls.download.name = ZoneCopyString( filename ); alloc_size = strlen( filename ) + strlen( ".tmp" ) + 1; cls.download.tempname = Mem_ZoneMalloc( alloc_size ); Q_snprintfz( cls.download.tempname, alloc_size, "%s.tmp", filename ); cls.download.web = qfalse; cls.download.cancelled = qfalse; cls.download.disconnect = qfalse; cls.download.size = size; cls.download.checksum = checksum; cls.download.percent = 0; cls.download.timeout = 0; cls.download.retries = 0; cls.download.timestart = Sys_Milliseconds(); cls.download.offset = 0; cls.download.baseoffset = 0; cls.download.pending_reconnect = qfalse; Cvar_ForceSet( "cl_download_name", COM_FileBase( cls.download.name ) ); Cvar_ForceSet( "cl_download_percent", "0" ); if( cls.download.requestnext ) { dl = Mem_ZoneMalloc( sizeof( download_list_t ) ); dl->filename = ZoneCopyString( cls.download.name ); dl->next = cls.download.list; cls.download.list = dl; } if( cl_downloads_from_web->integer && allow_localhttpdownload && url && url[0] != 0 ) { cls.download.web = qtrue; Com_Printf( "Web download: %s from %s%s/n", cls.download.tempname, cls.httpbaseurl, url ); } else if( cl_downloads_from_web->integer && url && url[0] != 0 ) { cls.download.web = qtrue; Com_Printf( "Web download: %s from %s/n", cls.download.tempname, url ); } else { Com_Printf( "Server download: %s/n", cls.download.tempname ); } cls.download.baseoffset = cls.download.offset = FS_FOpenBaseFile( cls.download.tempname, &cls.download.filenum, FS_APPEND ); if( !cls.download.filenum ) { Com_Printf( "Can't download, couldn't open %s for writing/n", cls.download.tempname ); Mem_ZoneFree( cls.download.name ); cls.download.name = NULL; Mem_ZoneFree( cls.download.tempname ); cls.download.tempname = NULL; cls.download.filenum = 0; cls.download.offset = 0; cls.download.size = 0; CL_DownloadDone(); return; } if( cls.download.web ) { char *referer, *fullurl; const char *headers[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL }; alloc_size = strlen( APP_URI_SCHEME ) + strlen( NET_AddressToString( &cls.serveraddress ) ) + 1; referer = Mem_ZoneMalloc( alloc_size ); Q_snprintfz( referer, alloc_size, APP_URI_SCHEME "%s", NET_AddressToString( &cls.serveraddress ) ); Q_strlwr( referer ); if( allow_localhttpdownload ) { alloc_size = strlen( cls.httpbaseurl ) + 1 + strlen( url ) + 1; fullurl = Mem_ZoneMalloc( alloc_size ); Q_snprintfz( fullurl, alloc_size, "%s/%s", cls.httpbaseurl, url ); } else { size_t url_len = strlen( url ); alloc_size = url_len + 1 + strlen( filename ) * 3 + 1; fullurl = Mem_ZoneMalloc( alloc_size ); Q_snprintfz( fullurl, alloc_size, "%s/", url ); Q_urlencode_unsafechars( filename, fullurl + url_len + 1, alloc_size - url_len - 1 ); } headers[0] = "Referer"; headers[1] = referer; CL_AddSessionHttpRequestHeaders( fullurl, &headers[2] ); CL_AsyncStreamRequest( fullurl, headers, cl_downloads_from_web_timeout->integer / 100, cls.download.offset, CL_WebDownloadReadCb, CL_WebDownloadDoneCb, NULL, NULL, qfalse ); Mem_ZoneFree( fullurl ); Mem_ZoneFree( referer ); return; } // have to use Sys_Milliseconds because cls.realtime might be old from Web_Get cls.download.timeout = Sys_Milliseconds() + 3000; cls.download.retries = 0; CL_AddReliableCommand( va( "nextdl /"%s/" %i", cls.download.name, cls.download.offset ) );}
开发者ID:Turupawn,项目名称:DogeWarsow,代码行数:101,
示例22: CG_DrawOldTourneyScoreboard/*=================CG_DrawTourneyScoreboard Draw the oversize scoreboard for tournements=================*/void CG_DrawOldTourneyScoreboard( void ){ const char *s; vec4_t color; int min, tens, ones; clientInfo_t *ci; int y; int i; // request more scores regularly if ( cg.scoresRequestTime + 2000 < cg.time ) { cg.scoresRequestTime = cg.time; CL_AddReliableCommand( "score" ); } color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; // draw the dialog background color[0] = color[1] = color[2] = 0; color[3] = 1; CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color ); // print the mesage of the day s = CG_ConfigString( CS_MOTD ); if ( !s[0] ) { s = "Scoreboard"; } // print optional title CG_CenterGiantLine( 8, s ); // print server time ones = cg.time / 1000; min = ones / 60; ones %= 60; tens = ones / 10; ones %= 10; s = va("%i:%i%i", min, tens, ones ); CG_CenterGiantLine( 64, s ); // print the two scores y = 160; if ( cgs.gametype >= GT_TEAM ) { // // teamplay scoreboard // CG_DrawStringExt( 8, y, "Red Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", cg.teamScores[0] ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); y += 64; CG_DrawStringExt( 8, y, "Blue Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", cg.teamScores[1] ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); } else { // // free for all scoreboard // for ( i = 0 ; i < MAX_CLIENTS ; i++ ) { ci = &cgs.clientinfo[i]; if ( !ci->infoValid ) { continue; } if ( ci->team != TEAM_FREE ) { continue; } CG_DrawStringExt( 8, y, ci->name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); s = va("%i", ci->score ); CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); y += 64; } }}
开发者ID:zturtleman,项目名称:recoil,代码行数:98,
示例23: CL_ParseDownload/** CL_ParseDownload* Handles download message from the server.* Writes data to the file and requests next download block.*/static void CL_ParseDownload( msg_t *msg ){ size_t size, offset; char *svFilename; // read the data svFilename = MSG_ReadString( msg ); offset = MSG_ReadLong( msg ); size = MSG_ReadLong( msg ); if( msg->readcount + size > msg->cursize ) { Com_Printf( "Error: Download message didn't have as much data as it promised/n" ); CL_RetryDownload(); return; } if( !cls.download.filenum ) { Com_Printf( "Error: Download message while not dowloading/n" ); msg->readcount += size; return; } if( Q_stricmp( cls.download.name, svFilename ) ) { Com_Printf( "Error: Download message for wrong file/n" ); msg->readcount += size; return; } if( offset+size > cls.download.size ) { Com_Printf( "Error: Invalid download message/n" ); msg->readcount += size; CL_RetryDownload(); return; } if( cls.download.offset != offset ) { Com_Printf( "Error: Download message for wrong position/n" ); msg->readcount += size; CL_RetryDownload(); return; } FS_Write( msg->data + msg->readcount, size, cls.download.filenum ); msg->readcount += size; cls.download.offset += size; cls.download.percent = (double)cls.download.offset / (double)cls.download.size; clamp( cls.download.percent, 0, 1 ); Cvar_ForceSet( "cl_download_percent", va( "%.1f", cls.download.percent * 100 ) ); if( cls.download.offset < cls.download.size ) { cls.download.timeout = Sys_Milliseconds() + 3000; cls.download.retries = 0; CL_AddReliableCommand( va( "nextdl /"%s/" %i", cls.download.name, cls.download.offset ) ); } else { Com_Printf( "Download complete: %s/n", cls.download.name ); CL_DownloadComplete(); // let the server know we're done CL_AddReliableCommand( va( "nextdl /"%s/" %i", cls.download.name, -1 ) ); CL_StopServerDownload(); CL_DownloadDone(); }}
开发者ID:Turupawn,项目名称:DogeWarsow,代码行数:81,
示例24: CL_AddReliableCommand2static void CL_AddReliableCommand2( const char *cmd ) { CL_AddReliableCommand( cmd, qfalse );}
开发者ID:Razish,项目名称:CompJA,代码行数:3,
示例25: CLQW_ParseDownloadstatic void CLQW_ParseDownload( QMsg& message ) { // read the data int size = message.ReadShort(); int percent = message.ReadByte(); if ( clc.demoplaying ) { if ( size > 0 ) { message.readcount += size; } return; // not in demo playback } if ( size == -1 ) { common->Printf( "File not found./n" ); if ( clc.download ) { common->Printf( "cls.download shouldn't have been set/n" ); FS_FCloseFile( clc.download ); clc.download = 0; } CLQW_RequestNextDownload(); return; } // open the file if not opened yet if ( !clc.download ) { if ( String::NCmp( clc.downloadTempName, "skins/", 6 ) ) { clc.download = FS_FOpenFileWrite( clc.downloadTempName ); } else { char name[ 1024 ]; sprintf( name, "qw/%s", clc.downloadTempName ); clc.download = FS_SV_FOpenFileWrite( name ); } if ( !clc.download ) { message.readcount += size; common->Printf( "Failed to open %s/n", clc.downloadTempName ); CLQW_RequestNextDownload(); return; } } FS_Write( message._data + message.readcount, size, clc.download ); message.readcount += size; if ( percent != 100 ) { // change display routines by zoid // request next block clc.downloadPercent = percent; CL_AddReliableCommand( "nextdl" ); } else { FS_FCloseFile( clc.download ); // rename the temp file to it's final name if ( String::Cmp( clc.downloadTempName, clc.downloadName ) ) { if ( String::NCmp( clc.downloadTempName,"skins/",6 ) ) { FS_Rename( clc.downloadTempName, clc.downloadName ); } else { char oldn[ MAX_OSPATH ]; sprintf( oldn, "qw/%s", clc.downloadTempName ); char newn[ MAX_OSPATH ]; sprintf( newn, "qw/%s", clc.downloadName ); FS_SV_Rename( oldn, newn ); } } clc.download = 0; clc.downloadPercent = 0; // get another file if needed CLQW_RequestNextDownload(); }}
开发者ID:janisl,项目名称:jlquake,代码行数:74,
示例26: CL_CgameSystemCalls/*====================CL_CgameSystemCallsThe cgame module is making a system call====================*/intptr_t CL_CgameSystemCalls( intptr_t *args ) { switch( args[0] ) { case CG_PRINT: Com_Printf( "%s", (const char*)VMA(1) ); return 0; case CG_ERROR: Com_Error( ERR_DROP, "%s", (const 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_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_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_Read2( 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( args[1], args[2], args[3] ); 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_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; 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_S_STARTSOUND://.........这里部分代码省略.........
开发者ID:BruceJohnJennerLawso,项目名称:quake3,代码行数:101,
示例27: CL_CgameSystemCalls/*====================CL_CgameSystemCallsThe cgame module is making a system call====================*/intptr_t CL_CgameSystemCalls( intptr_t *args ) { switch ( args[0] ) { case CG_PRINT: Com_Printf( "%s", (const char*)VMA(1) ); return 0; case CG_ERROR: Com_Error( ERR_DROP, "%s", (const 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_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_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), qfalse); 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 ), 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_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_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_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_S_STARTSOUND: S_StartSound( VMA( 1 ), args[2], args[3], args[4] ); return 0;//----(SA) added//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,
注:本文中的CL_AddReliableCommand函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CL_AllocParticle函数代码示例 C++ CL_ASSERT函数代码示例 |