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

C++ FS_GetFileList函数代码示例

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

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



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

示例1: ML_Update

/*
* ML_Update
*/
bool ML_Update( void )
{
	int i, len, total, newpaks;
	size_t size;
	char *map, *maps, *filename;

	newpaks = FS_Rescan();
	if( !newpaks )
		return false;

	total = FS_GetFileListExt( "maps", ".bsp", NULL, &size, 0, 0 );
	if( size )
	{
		maps = ( char* )Mem_TempMalloc( size );
		FS_GetFileList( "maps", ".bsp", maps, size, 0, 0 );
		for( i = 0, len = 0; i < total; i++ )
		{
			map = maps + len;
			len += strlen( map ) + 1;

			filename = ( char * )COM_FileBase( map );
			COM_StripExtension( filename );

			// don't check for existance of each file itself, as we've just got the fresh list
			if( !ML_FilenameExistsExt( filename, true ) )
				ML_AddMap( filename, MLIST_UNKNOWN_MAPNAME );
		}
		Mem_TempFree( maps );
	}

	return true;
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:35,代码来源:mlist.c


示例2: SV_BeginAutoRecordDemos

// starts demo recording on all active clients
void SV_BeginAutoRecordDemos() {
	if ( sv_autoDemo->integer ) {
		for ( client_t *client = svs.clients; client - svs.clients < sv_maxclients->integer; client++ ) {
			if ( client->state == CS_ACTIVE && !client->demo.demorecording ) {
				if ( client->netchan.remoteAddress.type != NA_BOT || sv_autoDemoBots->integer ) {
					SV_AutoRecordDemo( client );
				}
			}
		}
		if ( sv_autoDemoMaxMaps->integer > 0 && sv.demosPruned == qfalse ) {
			char autorecordDirList[500 * MAX_OSPATH], tmpFileList[5 * MAX_OSPATH];
			int autorecordDirListCount = SV_FindLeafFolders( "demos/autorecord", autorecordDirList, 500, MAX_OSPATH );
			int i;

			qsort( autorecordDirList, autorecordDirListCount, MAX_OSPATH, SV_DemoFolderTimeComparator );
			for ( i = sv_autoDemoMaxMaps->integer; i < autorecordDirListCount; i++ ) {
				char *folder = &autorecordDirList[i * MAX_OSPATH], *slash = NULL;
				FS_HomeRmdir( folder, qtrue );
				// if this folder was the last thing in its parent folder (and its parent isn't the root folder),
				// also delete the parent.
				for (;;) {
					slash = strrchr( folder, '/' );
					if ( slash == NULL ) {
						break;
					}
					slash[0] = '\0';
					if ( !strcmp( folder, "demos/autorecord" ) ) {
						break;
					}
					int numFiles = FS_GetFileList( folder, "", tmpFileList, sizeof( tmpFileList ) );
					int numFolders = FS_GetFileList( folder, "/", tmpFileList, sizeof( tmpFileList ) );
					// numFolders will include . and ..
					if ( numFiles == 0 && numFolders == 2 ) {
						// dangling empty folder, delete
						FS_HomeRmdir( folder, qfalse );
					} else {
						break;
					}
				}
			}
			sv.demosPruned = qtrue;
		}
	}
}
开发者ID:adnanfzafar,项目名称:OpenJK,代码行数:45,代码来源:sv_ccmds.cpp


示例3: ML_InitFromMaps

/*
* ML_InitFromMaps
* Fills map list array from each map file. Very slow
* and should only be called if cache doesnt exist
*/
static void ML_InitFromMaps( void )
{
	int i, j, total, len;
	char maps[2048];
	char *filename;

	if( ml_initialized )
		return;

	total = FS_GetFileList( "maps", ".bsp", NULL, 0, 0, 0 );
	if( !total )
		return;

	i = 0;
	while( i < total )
	{
		memset( maps, 0, sizeof( maps ) );
		j = FS_GetFileList( "maps", ".bsp", maps, sizeof( maps ), i, total );

		// no maps returned, map name is too big or end of list?
		if( !j )
		{
			i++;
			continue;
		}
		i += j;

		// split the maps up and find their fullnames
		len = 0;
		while( j-- )
		{
			filename = maps + len;
			if( !*filename )
				continue;

			len += strlen( filename ) + 1;

			COM_SanitizeFilePath( filename );
			COM_StripExtension( filename );

			ML_AddMap( filename, NULL );
		}
	}
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:49,代码来源:mlist.c


示例4: fread

	/*	Precache the radio sounds + some other sounds of urt 'cause it doesn't on its own and it
		may be freezing rendering in the process of fread()ing assets for the 1st time. */
	static void PreCache_UT_Audio (void) {

		//lister stolen from UI_LoadBots()
		char	*		dirptr;
		char			dirlist[8192],filename[1024];
		int			numdirs,dirlen, i;

		numdirs = FS_GetFileList("sound/radio/female", ".wav", dirlist, 8192);
		dirptr  = dirlist;
		for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
			dirlen = strlen(dirptr);
			strcpy(filename, "sound/radio/female/");
			strcat(filename, dirptr);
			S_RegisterSound(filename, qfalse);
		}

		numdirs = FS_GetFileList("sound/radio/male", ".wav", dirlist, 8192);
		dirptr  = dirlist;
		for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
			dirlen = strlen(dirptr);
			strcpy(filename, "sound/radio/male/");
			strcat(filename, dirptr);
			S_RegisterSound(filename, qfalse);
		}

		//some extra ones caught not being pre-registered:
		S_RegisterSound ("sound/misc/kcaction.wav", qfalse);
		S_RegisterSound ("sound/player/ledgegrab.wav", qfalse);
		S_RegisterSound ("sound/surfaces/bullets/water1.wav", qfalse);
		S_RegisterSound ("sound/items/nvgoff.wav", qfalse);
		S_RegisterSound ("sound/items/nvgon.wav", qfalse);
		S_RegisterSound ("sound/items/flashlight.wav", qfalse);
		S_RegisterSound ("sound/items/laseronoff.wav", qfalse);
		S_RegisterSound ("sound/weapons/beretta/92G_noammo.wav", qfalse);
		S_RegisterSound ("sound/bomb/Bomb_disarm.wav", qfalse);
		S_RegisterSound ("sound/bomb/Explode01.wav", qfalse);
		S_RegisterSound ("sound/misc/blast_wind.wav", qfalse);
		S_RegisterSound ("sound/misc/blast_fire.wav", qfalse);
	}
开发者ID:anthonynguyen,项目名称:ioq3-mitsu,代码行数:41,代码来源:ioq3-urt_Precache.c


示例5: PreCache_UT_Models

	//similarly, pre-cache funstuff
	static void PreCache_UT_Models (void) {
		char*		dirptr;
		char			dirlist[8192],filename[1024];
		int			numdirs,dirlen, i;

		numdirs = FS_GetFileList("models/players/funstuff/", ".md3", dirlist, 8192 );
		dirptr  = dirlist;
		for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
			dirlen = strlen(dirptr);
			strcpy(filename, "models/players/funstuff/");
			strcat(filename, dirptr);
			RE_RegisterModel (filename);
		}
	}
开发者ID:anthonynguyen,项目名称:ioq3-mitsu,代码行数:15,代码来源:ioq3-urt_Precache.c


示例6: SV_FindLeafFolders

// returns number of folders found.  pass NULL result pointer for just a count.
static int SV_FindLeafFolders( const char *baseFolder, char *result, int maxResults, int maxFolderLength ) {
	char *fileList = (char *)Z_Malloc( MAX_OSPATH * maxResults, TAG_FILESYS ); // too big for stack since this is recursive
	char fullFolder[MAX_OSPATH];
	int resultCount = 0;
	char *fileName;
	int i;
	int numFiles = FS_GetFileList( baseFolder, "/", fileList, MAX_OSPATH * maxResults );

	fileName = fileList;
	for ( i = 0; i < numFiles; i++ ) {
		if ( Q_stricmp( fileName, "." ) && Q_stricmp( fileName, ".." ) ) {
			char *nextResult = NULL;
			Com_sprintf( fullFolder, sizeof( fullFolder ), "%s/%s", baseFolder, fileName );
			if ( result != NULL ) {
				nextResult = &result[maxFolderLength * resultCount];
			}
			int newResults = SV_FindLeafFolders( fullFolder, nextResult, maxResults - resultCount, maxFolderLength );
			resultCount += newResults;
			if ( result != NULL && resultCount >= maxResults ) {
				break;
			}
			if ( newResults == 0 ) {
				if ( result != NULL ) {
					Q_strncpyz( &result[maxFolderLength * resultCount], fullFolder, maxFolderLength );
				}
				resultCount++;
				if ( result != NULL && resultCount >= maxResults ) {
					break;
				}
			}
		}
		fileName += strlen( fileName ) + 1;
	}

	Z_Free( fileList );

	return resultCount;
}
开发者ID:adnanfzafar,项目名称:OpenJK,代码行数:39,代码来源:sv_ccmds.cpp


示例7: 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


示例8: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
int CL_UISystemCalls( int *args ) {
	switch( args[0] ) {
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;

	case UI_PRINT:
		Com_Printf( "%s", VMA(1) );
		return 0;

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_CVAR_REGISTER:
		Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( VMA(1) );
		return 0;

	case UI_CVAR_SET:
		Cvar_Set( VMA(1), VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( VMA(1) ) );

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValue( VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_RESET:
		Cvar_Reset( VMA(1) );
		return 0;

	case UI_CVAR_CREATE:
		Cvar_Get( VMA(1), VMA(2), args[3] );
		return 0;

	case UI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[1], VMA(2), args[3] );
		return 0;

	case UI_ARGC:
		return Cmd_Argc();

	case UI_ARGV:
		Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
		return 0;

	case UI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], VMA(2) );
		return 0;

	case UI_FS_FOPENFILE:
		return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );

	case UI_FS_READ:
		FS_Read2( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;

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

	case UI_FS_GETFILELIST:
		return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );

	case UI_FS_SEEK:
		return FS_Seek( args[1], args[2], args[3] );
	
	case UI_R_REGISTERMODEL:
#ifdef IOS_NOTYET
		GLimp_AcquireGL();
		return re.RegisterModel( VMA(1) );
		GLimp_ReleaseGL();
#else
		return re.RegisterModel( VMA(1) );
#endif // IOS

	case UI_R_REGISTERSKIN:
#ifdef IOS_NOTYET
		GLimp_AcquireGL();
		return re.RegisterSkin( VMA(1) );
//.........这里部分代码省略.........
开发者ID:he110world,项目名称:quake3-ios,代码行数:101,代码来源:cl_ui.c


示例9: CLWM_UISystemCalls

//	The ui module is making a system call
qintptr CLWM_UISystemCalls( qintptr* args ) {
	switch ( args[ 0 ] ) {
	case WMUI_ERROR:
		common->Error( "%s", ( char* )VMA( 1 ) );
		return 0;

	case WMUI_PRINT:
		common->Printf( "%s", ( char* )VMA( 1 ) );
		return 0;

	case WMUI_MILLISECONDS:
		return Sys_Milliseconds();

	case WMUI_CVAR_REGISTER:
		Cvar_Register( ( vmCvar_t* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );
		return 0;

	case WMUI_CVAR_UPDATE:
		Cvar_Update( ( vmCvar_t* )VMA( 1 ) );
		return 0;

	case WMUI_CVAR_SET:
		Cvar_Set( ( char* )VMA( 1 ), ( char* )VMA( 2 ) );
		return 0;

	case WMUI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( ( char* )VMA( 1 ) ) );

	case WMUI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_CVAR_SETVALUE:
		Cvar_SetValue( ( char* )VMA( 1 ), VMF( 2 ) );
		return 0;

	case WMUI_CVAR_RESET:
		Cvar_Reset( ( char* )VMA( 1 ) );
		return 0;

	case WMUI_CVAR_CREATE:
		Cvar_Get( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[ 1 ], MAX_INFO_STRING_Q3, ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_ARGC:
		return Cmd_Argc();

	case WMUI_ARGV:
		Cmd_ArgvBuffer( args[ 1 ], ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[ 1 ], ( char* )VMA( 2 ) );
		return 0;

	case WMUI_FS_FOPENFILE:
		return FS_FOpenFileByMode( ( char* )VMA( 1 ), ( fileHandle_t* )VMA( 2 ), ( fsMode_t )args[ 3 ] );

	case WMUI_FS_READ:
		FS_Read( VMA( 1 ), args[ 2 ], args[ 3 ] );
		return 0;

	case WMUI_FS_WRITE:
		FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] );
		return 0;

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

	case WMUI_FS_DELETEFILE:
		return FS_Delete( ( char* )VMA( 1 ) );

	case WMUI_FS_GETFILELIST:
		return FS_GetFileList( ( char* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );

	case WMUI_R_REGISTERMODEL:
		return R_RegisterModel( ( char* )VMA( 1 ) );

	case WMUI_R_REGISTERSKIN:
		return R_RegisterSkin( ( char* )VMA( 1 ) );

	case WMUI_R_REGISTERSHADERNOMIP:
		return R_RegisterShaderNoMip( ( char* )VMA( 1 ) );

	case WMUI_R_CLEARSCENE:
		R_ClearScene();
		return 0;

	case WMUI_R_ADDREFENTITYTOSCENE:
		CLWM_AddRefEntityToScene( ( wmrefEntity_t* )VMA( 1 ) );
		return 0;

	case WMUI_R_ADDPOLYTOSCENE:
		R_AddPolyToScene( args[ 1 ], args[ 2 ], ( polyVert_t* )VMA( 3 ), 1 );
//.........这里部分代码省略.........
开发者ID:janisl,项目名称:jlquake,代码行数:101,代码来源:ui.cpp


示例10: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls(intptr_t * args) {
	switch (args[0]) {
		case UI_ERROR:
			Com_Error(ERR_DROP, "%s", (char *)VMA(1));
			return 0;
		case UI_PRINT:
			Com_Printf("%s", (char *)VMA(1));
			return 0;
		case UI_MILLISECONDS:
			return Sys_Milliseconds();
		case UI_CVAR_REGISTER:
			Cvar_Register((vmCvar_t*)VMA(1), (char*)VMA(2), (char*)VMA(3), args[4]);
			return 0;
		case UI_CVAR_UPDATE:
			Cvar_Update((vmCvar_t*)VMA(1));
			return 0;
		case UI_CVAR_SET:
			Cvar_Set((char*)VMA(1), (char*)VMA(2));
			return 0;
		case UI_CVAR_VARIABLEVALUE:
			return FloatAsInt(Cvar_VariableValue((char*)VMA(1)));
		case UI_CVAR_VARIABLESTRINGBUFFER:
			Cvar_VariableStringBuffer((char*)VMA(1), (char*)VMA(2), args[3]);
			return 0;
		case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
			Cvar_LatchedVariableStringBuffer((char*)VMA(1), (char*)VMA(2), args[3]);
			return 0;
		case UI_CVAR_SETVALUE:
			Cvar_SetValue((char*)VMA(1), VMF(2));
			return 0;
		case UI_CVAR_RESET:
			Cvar_Reset((char*)VMA(1));
			return 0;
		case UI_CVAR_CREATE:
			Cvar_Get((char*)VMA(1), (char*)VMA(2), args[3], (char*)VMA(4));
			return 0;
		case UI_CVAR_INFOSTRINGBUFFER:
			Cvar_InfoStringBuffer(args[1], (char*)VMA(2), args[3]);
			return 0;
		case UI_ARGC:
			return Cmd_Argc();
		case UI_ARGV:
			Cmd_ArgvBuffer(args[1], (char*)VMA(2), args[3]);
			return 0;
		case UI_CMD_EXECUTETEXT:
			Cbuf_ExecuteText(args[1], (char*)VMA(2));
			return 0;
		case UI_ADDCOMMAND:
			Cmd_AddCommand((char*)VMA(1), NULL, (char*)VMA(3));
			return 0;
		case UI_FS_FOPENFILE:
			return FS_FOpenFileByMode((char*)VMA(1), (fileHandle_t*)VMA( 2 ), (fsMode_t)args[3] );
		case UI_FS_READ:
			FS_Read2(VMA(1), args[2], args[3]);
			return 0;
		case UI_FS_WRITE:
			FS_Write(VMA(1), args[2], args[3]);
			return 0;
		case UI_FS_FCLOSEFILE:
			FS_FCloseFile(args[1]);
			return 0;
		case UI_FS_DELETEFILE:
			return FS_Delete((char*)VMA(1));
		case UI_FS_GETFILELIST:
			return FS_GetFileList((char*)VMA(1), (char*)VMA(2), (char*)VMA(3), args[4]);
		case UI_FS_SEEK:
			return FS_Seek( args[1], args[2], args[3] );
		case UI_R_REGISTERMODEL:
			return re.RegisterModel((char*)VMA(1));
		case UI_R_REGISTERSKIN:
			return re.RegisterSkin((char*)VMA(1));
		case UI_R_REGISTERSHADERNOMIP:
			return re.RegisterShaderNoMip((char*)VMA(1));
		case UI_R_CLEARSCENE:
			re.ClearScene();
			return 0;
		case UI_R_ADDREFENTITYTOSCENE:
			re.AddRefEntityToScene((refEntity_t*)VMA(1));
			return 0;
		case UI_R_ADDPOLYTOSCENE:
			re.AddPolyToScene(args[1], args[2], (polyVert_t*)VMA(3));
			return 0;
		case UI_R_ADDPOLYSTOSCENE:
			re.AddPolysToScene(args[1], args[2], (polyVert_t*)VMA(3), args[4]);
			return 0;
		case UI_R_ADDLIGHTTOSCENE:
			re.AddLightToScene((vec_t*)VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7], args[8]);
			return 0;
		case UI_R_ADDCORONATOSCENE:
			re.AddCoronaToScene((vec_t*)VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), args[6], (bool)args[7]);
			return 0;
		case UI_R_RENDERSCENE:
			re.RenderScene((refdef_t*)VMA(1));
//.........这里部分代码省略.........
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:101,代码来源:cl_ui.cpp


示例11: SV_DemoList_f

void SV_DemoList_f( client_t *client )
{
	char message[MAX_STRING_CHARS];
	char numpr[16];
	char buffer[MAX_STRING_CHARS];
	char *s, *p;
	size_t j, length, length_escaped, pos, extlen;
	int numdemos, i, start = -1, end, k;

	if( client->state < CS_SPAWNED )
		return;

	if( Cmd_Argc() > 2 )
	{
		SV_AddGameCommand( client, "pr \"Usage: demolist [starting position]\n\"" );
		return;
	}

	if( Cmd_Argc() == 2 )
	{
		start = atoi( Cmd_Argv( 1 ) ) - 1;
		if( start < 0 )
		{
			SV_AddGameCommand( client, "pr \"Usage: demolist [starting position]\n\"" );
			return;
		}
	}

	Q_strncpyz( message, "pr \"Available demos:\n----------------\n", sizeof( message ) );

	numdemos = FS_GetFileList( SV_DEMO_DIR, APP_DEMO_EXTENSION_STR, NULL, 0, 0, 0 );
	if( numdemos )
	{
		if( start < 0 )
			start = max( 0, numdemos - DEMOS_PER_VIEW );
		else if( start > numdemos - 1 )
			start = numdemos - 1;

		if( start > 0 )
			Q_strncatz( message, "...\n", sizeof( message ) );

		end = start + DEMOS_PER_VIEW;
		if( end > numdemos )
			end = numdemos;

		extlen = strlen( APP_DEMO_EXTENSION_STR );

		i = start;
		do
		{
			if( ( k = FS_GetFileList( SV_DEMO_DIR, APP_DEMO_EXTENSION_STR, buffer, sizeof( buffer ), i, end ) ) == 0 )
			{
				i++;
				continue;
			}

			for( s = buffer; k > 0; k--, s += length+1, i++ )
			{
				length = strlen( s );

				length_escaped = length;
				p = s;
				while( ( p = strchr( p, '\\' ) ) )
					length_escaped++;

				Q_snprintfz( numpr, sizeof( numpr ), "%i: ", i+1 );
				if( strlen( message ) + strlen( numpr ) + length_escaped - extlen + 1 + 5 >= sizeof( message ) )
				{
					Q_strncatz( message, "\"", sizeof( message ) );
					SV_AddGameCommand( client, message );

					Q_strncpyz( message, "pr \"", sizeof( message ) );
					if( strlen( "demoget " ) + strlen( numpr ) + length_escaped - extlen + 1 + 5 >= sizeof( message ) )
						continue;
				}

				Q_strncatz( message, numpr, sizeof( message ) );
				pos = strlen( message );
				for( j = 0; j < length - extlen; j++ )
				{
					assert( s[j] != '\\' );
					if( s[j] == '"' )
						message[pos++] = '\\';
					message[pos++] = s[j];
				}
				message[pos++] = '\n';
				message[pos] = '\0';
			}
		}
		while( i < end );

		if( end < numdemos )
			Q_strncatz( message, "...\n", sizeof( message ) );
	}
	else
	{
		Q_strncatz( message, "none\n", sizeof( message ) );
	}

	Q_strncatz( message, "\"", sizeof( message ) );
//.........这里部分代码省略.........
开发者ID:cfr,项目名称:qfusion,代码行数:101,代码来源:sv_demos.c


示例12: ML_InitFromCache

/*
* ML_InitFromCache
* Fills map list array from cache, much faster
*/
static void ML_InitFromCache( void )
{
	int count, i, total, len;
	size_t size = 0;
	char *buffer, *chr, *current, *curend;
	char *temp, *maps, *map;
	mapdir_t *dir, *curmap, *prev;

	if( ml_initialized )
		return;

	total = FS_GetFileListExt( "maps", ".bsp", NULL, &size, 0, 0 );
	if( !total )
		return;

	// load maps from directory reading into a list
	maps = temp = ( char* )Mem_TempMalloc( size + sizeof( mapdir_t ) * total );
	temp += size;
	FS_GetFileList( "maps", ".bsp", maps, size, 0, 0 );
	len = 0;
	prev = NULL;
	dir = NULL;
	for( i = 0; i < total; i++ )
	{
		map = maps + len;
		len += strlen( map ) + 1;

		curmap = ( mapdir_t * )temp;
		temp += sizeof( mapdir_t );

		COM_StripExtension( map );

		if( !i )
			dir = curmap;
		else
		{
			prev->next = curmap;
			curmap->prev = prev;
		}

		curmap->filename = map;
		prev = curmap;
	}

	FS_LoadCacheFile( MLIST_CACHE, (void **)&buffer, NULL, 0 );
	if( !buffer )
	{
		Mem_TempFree( maps );
		return;
	}

	current = curend = buffer;
	count = 0;

	for( chr = buffer; *chr; chr++ )
	{
		// current character is a delimiter
		if( *chr == '\n' )
		{
			if( *(chr-1) == '\r' )
				*(chr-1) = '\0';	// clear the CR too
			*chr = '\0';			// clear the LF

			// if we have got both params
			if( !( ++count & 1 ) )
			{
				// check if its in the maps directory
				for( curmap = dir; curmap; curmap = curmap->next )
				{
					if( !Q_stricmp( curmap->filename, current ) )
					{
						if( curmap->prev )
							curmap->prev->next = curmap->next;
						else
							dir = curmap->next;

						if( curmap->next )
							curmap->next->prev = curmap->prev;
						break;
					}
				}

				// if we found it in the maps directory
				if( curmap )
				{
					COM_SanitizeFilePath( current );

					// well, if we've got a map with an unknown fullname, load it from map
					if( !strcmp( curend + 1, MLIST_UNKNOWN_MAPNAME ) )
						ML_AddMap( current, NULL );
					else
						ML_AddMap( current, curend + 1 );
				}
				current = chr + 1;
			}
			else
//.........这里部分代码省略.........
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:101,代码来源:mlist.c


示例13: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls( intptr_t *args ) 
{

	switch( args[0] ) 
	{
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;

	case UI_CVAR_REGISTER:
		Cvar_Register( (vmCvar_t *)VMA(1),(const char *) VMA(2),(const char *) VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_SET:
		Cvar_Set( (const char *) VMA(1), (const char *) VMA(2) );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValue( (const char *) VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( (vmCvar_t *) VMA(1) );
		return 0;

	case UI_R_REGISTERMODEL:
		return re.RegisterModel((const char *) VMA(1) );

	case UI_R_REGISTERSHADERNOMIP:
		return re.RegisterShaderNoMip((const char *) VMA(1) );

	case UI_GETGLCONFIG:
		CL_GetGlconfig( ( glconfig_t *) VMA(1) );
		return 0;

	case UI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], (const char *) VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( (const char *) VMA(1) ) );

	case UI_FS_GETFILELIST:
		return FS_GetFileList( (const char *) VMA(1), (const char *) VMA(2), (char *) VMA(3), args[4] );

	case UI_KEY_SETCATCHER:
		Key_SetCatcher( args[1] );
		return 0;

	case UI_KEY_CLEARSTATES:
		Key_ClearStates();
		return 0;

	case UI_R_SETCOLOR:
		re.SetColor( (const float *) VMA(1) );
		return 0;

	case UI_R_DRAWSTRETCHPIC:
		re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] );
		return 0;

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( (const char *) VMA(1), (char *) VMA(2), args[3] );
		return 0;

  case UI_R_MODELBOUNDS:
		re.ModelBounds( args[1], (float *) VMA(2),(float *) VMA(3) );
		return 0;

	case UI_R_CLEARSCENE:
		re.ClearScene();
		return 0;

//	case UI_KEY_GETOVERSTRIKEMODE:
//		return Key_GetOverstrikeMode();
//		return 0;

//	case UI_PC_READ_TOKEN:
//		return PC_ReadTokenHandle( args[1], VMA(2) );
		
//	case UI_PC_SOURCE_FILE_AND_LINE:
//		return PC_SourceFileAndLine( args[1], VMA(2), VMA(3) );

	case UI_KEY_GETCATCHER:
		return Key_GetCatcher();

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_S_REGISTERSOUND:
		return S_RegisterSound((const char *) VMA(1));

	case UI_S_STARTLOCALSOUND:
//.........这里部分代码省略.........
开发者ID:Elfmagi,项目名称:OpenJK,代码行数:101,代码来源:cl_ui.cpp


示例14: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
int CL_UISystemCalls( int *args ) {
	switch( args[0] ) {
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;

	case UI_PRINT:
		Com_Printf( "%s", VMA(1) );
		return 0;

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_CVAR_REGISTER:
		Cvar_Register( (vmCvar_t *)VMA(1), (const char *)VMA(2), (const char *)VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( (vmCvar_t *)VMA(1) );
		return 0;

	case UI_CVAR_SET:
		Cvar_Set( (const char *)VMA(1), (const char *)VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( (const char *)VMA(1) ) );

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( (const char *)VMA(1), (char *)VMA(2), args[3] );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValue( (const char *)VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_RESET:
		Cvar_Reset( (const char *)VMA(1) );
		return 0;

	case UI_CVAR_CREATE:
		Cvar_Get( (const char *)VMA(1), (const char *)VMA(2), args[3] );
		return 0;

	case UI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[1], (char *)VMA(2), args[3] );
		return 0;

	case UI_ARGC:
		return Cmd_Argc();

	case UI_ARGV:
		Cmd_ArgvBuffer( args[1], (char *)VMA(2), args[3] );
		return 0;

	case UI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], (const char *)VMA(2) );
		return 0;

	case UI_FS_FOPENFILE:
		return FS_FOpenFileByMode( (const char *)VMA(1), (int *)VMA(2), (fsMode_t)args[3] );

	case UI_FS_READ:
		FS_Read2( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;

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

	case UI_FS_GETFILELIST:
		return FS_GetFileList( (const char *)VMA(1), (const char *)VMA(2), (char *)VMA(3), args[4] );

	case UI_R_REGISTERMODEL:
		return re.RegisterModel( (const char *)VMA(1) );

	case UI_R_REGISTERSKIN:
		return re.RegisterSkin( (const char *)VMA(1) );

	case UI_R_REGISTERSHADERNOMIP:
		return re.RegisterShaderNoMip( (const char *)VMA(1) );

	case UI_R_CLEARSCENE:
		re.ClearScene();
		return 0;

	case UI_R_ADDREFENTITYTOSCENE:
		re.AddRefEntityToScene( (const refEntity_t *)VMA(1) );
		return 0;
//.........这里部分代码省略.........
开发者ID:Boothand,项目名称:jk2mp,代码行数:101,代码来源:cl_ui.cpp


示例15: CL_UISystemCalls

/**
 * @brief The ui module is making a system call
 * @param[in] args
 * @return
 */
intptr_t CL_UISystemCalls(intptr_t *args)
{
    switch (args[0])
    {
    case UI_ERROR:
        Com_Error(ERR_DROP, "%s", (char *)VMA(1));
    case UI_PRINT:
        Com_Printf("%s", (char *)VMA(1));
        return 0;
    case UI_MILLISECONDS:
        return Sys_Milliseconds();
    case UI_CVAR_REGISTER:
        Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
        return 0;
    case UI_CVAR_UPDATE:
        Cvar_Update(VMA(1));
        return 0;
    case UI_CVAR_SET:
        Cvar_SetSafe(VMA(1), VMA(2));
        return 0;
    case UI_CVAR_VARIABLEVALUE:
        return FloatAsInt(Cvar_VariableValue(VMA(1)));
    case UI_CVAR_VARIABLESTRINGBUFFER:
        Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
        return 0;
    case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
        Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
        return 0;
    case UI_CVAR_SETVALUE:
        Cvar_SetValueSafe(VMA(1), VMF(2));
        return 0;
    case UI_CVAR_RESET:
        Cvar_Reset(VMA(1));
        return 0;
    case UI_CVAR_CREATE:
        Cvar_Register(NULL, VMA(1), VMA(2), args[3]);
        return 0;
    case UI_CVAR_INFOSTRINGBUFFER:
        Cvar_InfoStringBuffer(args[1], VMA(2), args[3]);
        return 0;
    case UI_ARGC:
        return Cmd_Argc();
    case UI_ARGV:
        Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
        return 0;
    case UI_CMD_EXECUTETEXT:
        if (args[1] == EXEC_NOW
                && (!strncmp(VMA(2), "snd_restart", 11)
                    || !strncmp(VMA(2), "vid_restart", 11)
                    || !strncmp(VMA(2), "quit", 5)))
        {
            Com_Printf(S_COLOR_YELLOW "turning EXEC_NOW '%.11s' into EXEC_INSERT\n", (const char *)VMA(2));
            args[1] = EXEC_INSERT;
        }
        Cbuf_ExecuteText(args[1], VMA(2));
        return 0;
    case UI_ADDCOMMAND:
        Cmd_AddCommand(VMA(1));
        return 0;
    case UI_FS_FOPENFILE:
        return FS_FOpenFileByMode(VMA(1), VMA(2), (fsMode_t)args[3]);
    case UI_FS_READ:
        FS_Read(VMA(1), args[2], args[3]);
        return 0;
    case UI_FS_WRITE:
        FS_Write(VMA(1), args[2], args[3]);
        return 0;
    case UI_FS_FCLOSEFILE:
        FS_FCloseFile(args[1]);
        return 0;
    case UI_FS_DELETEFILE:
        return FS_Delete(VMA(1));
    case UI_FS_GETFILELIST:
        return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
    case UI_R_REGISTERMODEL:
        return re.RegisterModel(VMA(1));
    case UI_R_REGISTERSKIN:
        return re.RegisterSkin(VMA(1));
    case UI_R_REGISTERSHADERNOMIP:
        return re.RegisterShaderNoMip(VMA(1));
    case UI_R_CLEARSCENE:
        re.ClearScene();
        return 0;
    case UI_R_ADDREFENTITYTOSCENE:
        re.AddRefEntityToScene(VMA(1));
        return 0;
    case UI_R_ADDPOLYTOSCENE:
        re.AddPolyToScene(args[1], args[2], VMA(3));
        return 0;
    case UI_R_ADDPOLYSTOSCENE:
        re.AddPolysToScene(args[1], args[2], VMA(3), args[4]);
        return 0;
    case UI_R_ADDLIGHTTOSCENE:
        // new dlight code
        re.AddLightToScene(VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7], args[8]);
//.........这里部分代码省略.........
开发者ID:etlegacy,项目名称:etlegacy,代码行数:101,代码来源:cl_ui.c


示例16: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls( intptr_t *args ) {
	switch( args[0] ) {
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
		return 0;

	case UI_PRINT:
		Com_Printf( "%s", (const char*)VMA(1) );
		return 0;

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_CVAR_REGISTER:
		Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( VMA(1) );
		return 0;

	case UI_CVAR_SET:
		Cvar_SetSafe( VMA(1), VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( VMA(1) ) );

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValueSafe( VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_RESET:
		Cvar_Reset( VMA(1) );
		return 0;

	case UI_CVAR_CREATE:
		Cvar_Get( VMA(1), VMA(2), args[3] );
		return 0;

	case UI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[1], VMA(2), args[3] );
		return 0;

	case UI_ARGC:
		return Cmd_Argc();

	case UI_ARGV:
		Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
		return 0;

	case UI_CMD_EXECUTETEXT:
		if(args[1] == EXEC_NOW
		&& (!strncmp(VMA(2), "snd_restart", 11)
		|| !strncmp(VMA(2), "vid_restart", 11)
		|| !strncmp(VMA(2), "quit", 5)))
		{
			Com_Printf (S_COLOR_YELLOW "turning EXEC_NOW '%.11s' into EXEC_INSERT\n", (const char*)VMA(2));
			args[1] = EXEC_INSERT;
		}
		Cbuf_ExecuteText( args[1], VMA(2) );
		return 0;

	case UI_FS_FOPENFILE:
		return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );

	case UI_FS_READ:
		FS_Read2( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;

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

	case UI_FS_GETFILELIST:
		return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );
	
	case UI_R_REGISTERMODEL:
		return re.RegisterModel( VMA(1) );

	case UI_R_REGISTERSKIN:
		return re.RegisterSkin( VMA(1) );

	case UI_R_REGISTERSHADERNOMIP:
		return re.RegisterShaderNoMip( VMA(1) );
//.........这里部分代码省略.........
开发者ID:Aravind7z,项目名称:zeq2lite,代码行数:101,代码来源:cl_ui.c


示例17: Com_sprintf

/////////////////////////////////////////////////////////////////////
// Name        : SV_GetMapSoundingLike
// Description : Retrieve a full map name given a substring of it
// Author      : Fenix, p5yc0runn3r
/////////////////////////////////////////////////////////////////////
static char *SV_GetMapSoundingLike(const char *s) 
{
    int  i, mapcount;
    int  len = 0, count = 0;
    char *matches[MAX_MAPLIST_SIZE];
    char *searchmap;
    static char maplist[MAX_MAPLIST_STRING];

    // [BUGFIX]: instead of iterating through all the maps matching both full and
    // partial name, search just for the exact map name and return it if the match is found
    Com_sprintf(maplist, sizeof(maplist), "maps/%s.bsp", s);
    if (FS_ReadFile(maplist, NULL) > 0) 
    {
        Com_sprintf(maplist, sizeof(maplist), "%s", s);
        return maplist; // @p5yc0runn3r: Return static string
    }

    // We didn't found an exact name match. Keep iterating through all the
    // available maps matching partial substrings
    if (!(mapcount = FS_GetFileList("maps", ".bsp", maplist, sizeof(maplist)))) 
    {
        Com_Printf("Unable to retrieve map list\n");
        return NULL;
    }

    for (searchmap = maplist, i = 0; i < mapcount && count < MAX_MAPLIST_SIZE; i++, searchmap += len + 1) 
    {
        len = strlen(searchmap);
        SV_StripExtension(searchmap, searchmap);

        // Check for substring match
        if (Q_strisub(searchmap, s)) 
        {
            matches[count] = searchmap;
            count++;
        }
    }

    // One match = one map, found match.
    if (count == 1) return matches[0]; // @p5yc0runn3r: matches points to static string, safe to return.

    if (count > 1) 
    {
        // Multiple matches found for the given map name
        Com_Printf("Multiple maps found matching '%s':\n", s);

        // Sorting the short map list alphabetically
        qsort(matches, count, sizeof(char *), SV_SortMaps);

        for (i = 0; i < count; i++) 
        {
            // Printing a short map list so the user can retry with a more specific name
            Com_Printf(" %2d: [%s]\n", i + 1, matches[i]);
        }

        if (count >= MAX_MAPLIST_SIZE) 
        {
            // Tell the user that there are actually more
            // maps matching the given substring, although
            // we are not displaying them....
            Com_Printf("...and more\n");
        }
        return NULL;
    }

    // No match found for the given map name input
    Com_Printf("No map found matching '%s'\n", s);
    return NULL;
}
开发者ID:CoolOppo,项目名称:ioq3-for-UrbanTerror-4,代码行数:74,代码来源:sv_ccmds.c


示例18: SV_DemoGet_f

/*
* SV_DemoGet_f
* 
* Responds to clients demoget request with: demoget "filename"
* If nothing is found, responds with demoget without filename, so client knowns it wasn't found
*/
void SV_DemoGet_f( client_t *client )
{
	int num, numdemos;
	char message[MAX_STRING_CHARS];
	char buffer[MAX_STRING_CHARS];
	char *s, *p;
	size_t j, length, length_escaped, pos, pos_bak, msglen;

	if( client->state < CS_SPAWNED )
		return;
	if( Cmd_Argc() != 2 )
		return;

	Q_strncpyz( message, "demoget \"", sizeof( message ) );
	Q_strncatz( message, SV_DEMO_DIR, sizeof( message ) );
	msglen = strlen( message );
	message[msglen++] = '/';

	pos = pos_bak = msglen;

	numdemos = FS_GetFileList( SV_DEMO_DIR, APP_DEMO_EXTENSION_STR, NULL, 0, 0, 0 );
	if( numdemos )
	{
		if( Cmd_Argv( 1 )[0] == '.' )
			num = numdemos - strlen( Cmd_Argv( 1 ) );
		else
			num = atoi( Cmd_Argv( 1 ) ) - 1;
		clamp( num, 0, numdemos - 1 );

		numdemos = FS_GetFileList( SV_DEMO_DIR, APP_DEMO_EXTENSION_STR, buffer, sizeof( buffer ), num, num+1 );
		if( numdemos )
		{
			s = buffer;
			length = strlen( buffer );

			length_escaped = length;
			p = s;
			while( ( p = strchr( p, '\\' ) ) )
				length_escaped++;

			if( msglen + length_escaped + 1 + 5 < sizeof( message ) )
			{
				for( j = 0; j < length; j++ )
				{
					assert( s[j] != '\\' );
					if( s[j] == '"' )
						message[pos++] = '\\';
					message[pos++] = s[j];
				}
			}
		}
	}

	if( pos == pos_bak )
		return;

	message[pos++] = '"';
	message[pos] = '\0';

	SV_AddGameCommand( client, message );
}
开发者ID:cfr,项目名称:qfusion,代码行数:67,代码来源:sv_demos.c


示例19: 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", (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] );
		r 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FS_Open函数代码示例发布时间:2022-05-30
下一篇:
C++ FS_Gamedir函数代码示例发布时间: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