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

C++ FS_Printf函数代码示例

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

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



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

示例1: GenerateFootstepList

/**
 * @brief Generate a list of textures that should have footsteps when walking on them
 * @param[in] filename Add this texture to the list of
 * textures where we should have footstep sounds for
 * @param[in] mipTexIndex The index in the textures array
 * @sa SV_GetFootstepSound
 * @sa Com_GetTerrainType
 */
static void GenerateFootstepList (const char* filename, int mipTexIndex)
{
	if (!config.generateFootstepFile)
		return;

	if (textureref[mipTexIndex].footstepMarked)
		return;

	assert(filename);

	char fileBase[MAX_OSPATH];
	Com_StripExtension(filename, fileBase, sizeof(fileBase));

	ScopedFile f;
	FS_OpenFile(va("%s.footsteps", fileBase), &f, FILE_APPEND);
	if (!f) {
		Com_Printf("Could not open footstep file '%s.footsteps' for writing\n", fileBase);
		config.generateFootstepFile = false;
		return;
	}
#ifdef _WIN32
	FS_Printf(&f, "terrain %s {\n}\n\n", textureref[mipTexIndex].name);
#else
	FS_Printf(&f, "%s\n", textureref[mipTexIndex].name);
#endif
	footstepsCnt++;
	textureref[mipTexIndex].footstepMarked = true;
}
开发者ID:nicogiraldi,项目名称:ufoai,代码行数:36,代码来源:map.cpp


示例2: GenerateMaterialFile

/**
 * @brief Generates material files in case the settings can be guessed from map file
 */
static void GenerateMaterialFile (const char* filename, int mipTexIndex, side_t* s)
{
	bool terrainByTexture = false;
	char fileBase[MAX_OSPATH], materialPath[MAX_OSPATH];

	if (!config.generateMaterialFile)
		return;

	/* we already have a material definition for this texture */
	if (textureref[mipTexIndex].materialMarked)
		return;

	assert(filename);

	Com_StripExtension(filename, fileBase, sizeof(fileBase));
	Com_sprintf(materialPath, sizeof(materialPath), "materials/%s.mat", Com_SkipPath(fileBase));

	ScopedFile f;
	FS_OpenFile(materialPath, &f, FILE_APPEND);
	if (!f) {
		Com_Printf("Could not open material file '%s' for writing\n", materialPath);
		config.generateMaterialFile = false;
		return;
	}

	if (strstr(textureref[mipTexIndex].name, "dirt")
	 || strstr(textureref[mipTexIndex].name, "rock")
	 || strstr(textureref[mipTexIndex].name, "grass")) {
		terrainByTexture = true;
	}

	if ((s->contentFlags & CONTENTS_TERRAIN) || terrainByTexture) {
		FS_Printf(&f, "{\n\tmaterial %s\n\t{\n\t\ttexture <fillme>\n\t\tterrain 0 64\n\t\tlightmap\n\t}\n}\n", textureref[mipTexIndex].name);
		textureref[mipTexIndex].materialMarked = true;
		materialsCnt++;
	}

	/* envmap for water surfaces */
	if ((s->contentFlags & CONTENTS_WATER)
	 || strstr(textureref[mipTexIndex].name, "glass")
	 || strstr(textureref[mipTexIndex].name, "window")) {
		FS_Printf(&f, "{\n\tmaterial %s\n\tspecular 2.0\n\t{\n\t\tenvmap 0\n\t}\n}\n", textureref[mipTexIndex].name);
		textureref[mipTexIndex].materialMarked = true;
		materialsCnt++;
	}

	if (strstr(textureref[mipTexIndex].name, "wood")) {
		FS_Printf(&f, "{\n\tmaterial %s\n\tspecular 0.2\n}\n", textureref[mipTexIndex].name);
		textureref[mipTexIndex].materialMarked = true;
		materialsCnt++;
	}

	if (strstr(textureref[mipTexIndex].name, "wall")) {
		FS_Printf(&f, "{\n\tmaterial %s\n\tspecular 0.6\n\tbump 2.0\n}\n", textureref[mipTexIndex].name);
		textureref[mipTexIndex].materialMarked = true;
		materialsCnt++;
	}
}
开发者ID:nicogiraldi,项目名称:ufoai,代码行数:61,代码来源:map.cpp


示例3: Key_WriteBindings

/*
* Key_WriteBindings
* 
* Writes lines containing "bind key value"
*/
void Key_WriteBindings( int file )
{
	int i;

	FS_Printf( file, "unbindall\r\n" );

	for( i = 0; i < 256; i++ )
		if( keybindings[i] && keybindings[i][0] )
			FS_Printf( file, "bind %s \"%s\"\r\n", (i == ';' ? SEMICOLON_BINDNAME : Key_KeynumToString( i )), keybindings[i] );
}
开发者ID:ewirch,项目名称:qfusion,代码行数:15,代码来源:keys.c


示例4: WriteMapFile

/**
 * @sa LoadMapFile
 * @sa FixErrors
 */
void WriteMapFile (const char* filename)
{
	int removed;

	Verb_Printf(VERB_NORMAL, "writing map: '%s'\n", filename);

	ScopedFile f;
	FS_OpenFile(filename, &f, FILE_WRITE);
	if (!f)
		Sys_Error("Could not open %s for writing", filename);

	removed = 0;
	FS_Printf(&f, "\n");
	for (int i = 0; i < num_entities; i++) {
		const entity_t* mapent = &entities[i];
		const epair_t* e = mapent->epairs;

		/* maybe we don't want to write it back into the file */
		if (mapent->skip) {
			removed++;
			continue;
		}
		FS_Printf(&f, "// entity %i\n{\n", i - removed);
		WriteMapEntities(&f, e);

		/* need 2 counters. j counts the brushes in the source entity.
		 * jc counts the brushes written back. they may differ if some are skipped,
		 * eg they are microbrushes */
		int j, jc;
		for (j = 0, jc = 0; j < mapent->numbrushes; j++) {
			const mapbrush_t* brush = &mapbrushes[mapent->firstbrush + j];
			if (brush->skipWriteBack)
				continue;
			WriteMapBrush(brush, jc++, &f);
		}

		/* add brushes from func_groups with single members to worldspawn */
		if (i == 0) {
			int numToAdd;
			mapbrush_t** brushesToAdd = Check_ExtraBrushesForWorldspawn(&numToAdd);
			if (brushesToAdd != nullptr) {
				for (int k = 0; k < numToAdd; k++) {
					if (brushesToAdd[k]->skipWriteBack)
						continue;
					WriteMapBrush(brushesToAdd[k], j++, &f);
				}
				Mem_Free(brushesToAdd);
			}
		}
		FS_Printf(&f, "}\n");
	}

	if (removed)
		Verb_Printf(VERB_NORMAL, "removed %i entities\n", removed);
}
开发者ID:nicogiraldi,项目名称:ufoai,代码行数:59,代码来源:map.cpp


示例5: Key_WriteBindings

/*
============
Key_WriteBindings

Writes lines containing "bind key value"
============
*/
void Key_WriteBindings( fileHandle_t f ) {
	int		i;

	FS_Printf( f, "unbindall" Q_NEWLINE );

	for ( i = 0 ; i < MAX_KEYS ; i++ ) {
		if ( keys[i].binding && keys[i].binding[0] ) {
			FS_Printf( f, "bind %s \"%s\"" Q_NEWLINE, Key_KeynumToString(i), keys[i].binding );
		}
	}
}
开发者ID:BigJohnJD,项目名称:Quake-III-132,代码行数:18,代码来源:keys.c


示例6: Key_WriteBindings

/*
============
Key_WriteBindings

Writes lines containing "bind key value"
============
*/
void Key_WriteBindings( file_t *f )
{
	int	i;

	if( !f ) return;
	FS_Printf( f, "unbindall\n" );

	for( i = 0; i < 256; i++ )
	{
		if( keys[i].binding && keys[i].binding[0] )
			FS_Printf( f, "bind %s \"%s\"\n", Key_KeynumToString(i), keys[i].binding );
	}
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:20,代码来源:keys.c


示例7: UI_EditorNodeExtractNode

static void UI_EditorNodeExtractNode (qFILE* file, uiNode_t* node, int depth)
{
	assert(depth < 16);

	int i;
	char tab[16];
	for (i = 0; i < depth; i++) {
		tab[i] = '\t';
	}
	tab[i] = '\0';

	FS_Printf(file, "%s%s %s {\n", tab, node->behaviour->name, node->name);
	uiNode_t* child = node->firstChild;

	/* properties */
	if (child) {
		FS_Printf(file, "%s\t{\n", tab);
		FS_Printf(file, "%s\t\tpos\t\"%d %d\"\n", tab, (int)node->box.pos[0], (int)node->box.pos[1]);
		FS_Printf(file, "%s\t\tsize\t\"%d %d\"\n", tab, (int)node->box.size[0], (int)node->box.size[1]);
		FS_Printf(file, "%s\t}\n", tab);
	} else {
		FS_Printf(file, "%s\tpos\t\"%d %d\"\n", tab, (int)node->box.pos[0], (int)node->box.pos[1]);
		FS_Printf(file, "%s\tsize\t\"%d %d\"\n", tab, (int)node->box.size[0], (int)node->box.size[1]);
	}

	/* child */
	while (child) {
		UI_EditorNodeExtractNode(file, child, depth + 1);
		child = child->next;
	}

	FS_Printf(file, "%s}\n", tab);
}
开发者ID:chagara,项目名称:ufoai,代码行数:33,代码来源:ui_node_editor.cpp


示例8: R_CreateDetailTexturesList

void R_CreateDetailTexturesList( const char *filename )
{
	file_t		*detail_txt = NULL;
	const char	*detail_name, *texname;
	int		i;

	for( i = 0; i < cl.worldmodel->numtextures; i++ )
	{
		texname = cl.worldmodel->textures[i]->name;
		detail_name = R_DetailTextureForName( texname );
		if( !detail_name ) continue;

		// detailtexture detected
		if( detail_name )
		{
			if( !detail_txt ) detail_txt = FS_Open( filename, "w", false ); 
			if( !detail_txt )
			{
				MsgDev( D_ERROR, "Can't write %s\n", filename );
				break;
			}

			// store detailtexture description
			FS_Printf( detail_txt, "%s detail/%s 10.0 10.0\n", texname, detail_name );
		}
	}

	if( detail_txt ) FS_Close( detail_txt );
}
开发者ID:Xash3DLinux,项目名称:xash3dlinux,代码行数:29,代码来源:gl_rmisc.c


示例9: SV_StartDemoRecording

void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrack)
{
	prvm_prog_t *prog = SVVM_prog;
	char name[MAX_QPATH];

	if(client->sv_demo_file != NULL)
		return; // we already have a demo

	strlcpy(name, filename, sizeof(name));
	FS_DefaultExtension(name, ".dem", sizeof(name));

	Con_Printf("Recording demo for # %d (%s) to %s\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress, name);

	// Reset discardable flag for every new demo.
	PRVM_serveredictfloat(client->edict, discardabledemo) = 0;

	client->sv_demo_file = FS_OpenRealFile(name, "wb", false);
	if(!client->sv_demo_file)
	{
		Con_Print("ERROR: couldn't open.\n");
		return;
	}

	FS_Printf(client->sv_demo_file, "%i\n", forcetrack);
}
开发者ID:paulvortex,项目名称:DpOmnicide,代码行数:25,代码来源:sv_demo.c


示例10: Sys_WritePIDFile

qboolean Sys_WritePIDFile(void)
{
	fileHandle_t f;

	// First, check if the pid file is already there
	if (FS_FileInPathExists(com_pidfile->string))
	{
		// TODO: check if we are hijacking live pid file
		/*
		FS_FOpenFileRead(com_pidfile->string, &f, qtrue);

		if(Sys_PIDIsRunning(pid))
		{
		    Com_Printf("WARNING: another instance of ET:L is using this path!\n");
		    return qfalse;
		}
		*/
		FS_Delete(com_pidfile->string); // stale pid from previous run
	}

	f = FS_FOpenFileWrite(com_pidfile->string);
	if (f < 0)
	{
		return qfalse;
	}

	FS_Printf(f, "%d", com_pid->integer);

	FS_FCloseFile(f);

	// track profile changes
	Com_TrackProfile(com_pidfile->string);

	return qtrue;
}
开发者ID:scenna,项目名称:etlegacy,代码行数:35,代码来源:sys_main.c


示例11: Cmd_WriteHelp

static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc, void *f )
{
	if( !desc ) return;				// ignore fantom cmds
	if( !Q_strcmp( desc, "" )) return;		// blank description
	if( name[0] == '+' || name[0] == '-' ) return;	// key bindings	
	FS_Printf( f, "%s\t\t\t\"%s\"\n", name, desc );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:7,代码来源:con_utils.c


示例12: Cvar_WriteVariables

/**
 * @brief appends lines containing "set variable value" for all variables
 * with the archive flag set to true.
 * @note Stores the archive cvars
 */
void Cvar_WriteVariables (qFILE* f)
{
	for (const cvar_t* var = cvarVars; var; var = var->next) {
		if (var->flags & CVAR_ARCHIVE)
			FS_Printf(f, "set %s \"%s\" a\n", var->name, var->string);
	}
}
开发者ID:drone-pl,项目名称:ufoai,代码行数:12,代码来源:cvar.cpp


示例13: Cvar_WriteVariables

/*
* Cvar_WriteVariables
* 
* Appends lines containing "set variable value" for all variables
* with the archive flag set to true.
*/
void Cvar_WriteVariables( int file )
{
	char buffer[MAX_PRINTMSG];
	struct trie_dump_s *dump;
	unsigned int i;
	cvar_flag_t cvar_archive = CVAR_ARCHIVE;

	assert( cvar_trie );
	Trie_DumpIf( cvar_trie, "", TRIE_DUMP_VALUES, Cvar_HasFlags, &cvar_archive, &dump );
	for( i = 0; i < dump->size; ++i )
	{
		cvar_t *const var = dump->key_value_vector[i].value;
		const char *cmd;

		if( Cvar_FlagIsSet( var->flags, CVAR_USERINFO ) )
			cmd = "setau";
		else if( Cvar_FlagIsSet( var->flags, CVAR_SERVERINFO ) )
			cmd = "setas";
		else
			cmd = "seta";

		if( Cvar_FlagIsSet( var->flags, CVAR_LATCH ) || Cvar_FlagIsSet( var->flags, CVAR_LATCH_VIDEO ) ||
			Cvar_FlagIsSet( var->flags, CVAR_LATCH_SOUND ) )
		{
			if( var->latched_string )
				Q_snprintfz( buffer, sizeof( buffer ), "%s %s \"%s\"\r\n", cmd, var->name, var->latched_string );
			else
				Q_snprintfz( buffer, sizeof( buffer ), "%s %s \"%s\"\r\n", cmd, var->name, var->string );
		}
		else
			Q_snprintfz( buffer, sizeof( buffer ), "%s %s \"%s\"\r\n", cmd, var->name, var->string );
		FS_Printf( file, "%s", buffer );
	}
	Trie_FreeDump( dump );
}
开发者ID:codetwister,项目名称:qfusion,代码行数:41,代码来源:cvar.c


示例14: Com_WriteConfigToFile

/**
 * @sa Key_WriteBindings
 */
void Com_WriteConfigToFile (const char* filename)
{
	ScopedFile f;

	FS_OpenFile(filename, &f, FILE_WRITE);
	if (!f.file()) {
		Com_Printf("Couldn't write %s.\n", filename);
		return;
	}

	FS_Printf(&f, "// generated by ufo, do not modify\n");
	FS_Printf(&f, "// variables\n");
	Cvar_WriteVariables(&f);
	FS_Printf(&f, "// aliases\n");
	Cmd_WriteAliases(&f);
	Com_Printf("Wrote %s.\n", filename);
}
开发者ID:ArkyRomania,项目名称:ufoai,代码行数:20,代码来源:common.cpp


示例15: Host_WriteVideoConfig

/*
===============
Host_WriteVideoConfig

save render variables into video.cfg
===============
*/
void Host_WriteVideoConfig( void )
{
	file_t	*f;

	MsgDev( D_NOTE, "Host_WriteVideoConfig()\n" );
	f = FS_Open( "video.cfg", "w", false );
	if( f )
	{
		FS_Printf( f, "//=======================================================================\n" );
		FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\tvideo.cfg - archive of renderer variables\n");
		FS_Printf( f, "//=======================================================================\n" );
		Cmd_WriteRenderVariables( f );
		FS_Close( f );	
	}                                                
	else MsgDev( D_ERROR, "can't update video.cfg.\n" );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:24,代码来源:con_utils.c


示例16: Host_WriteOpenGLConfig

/*
===============
Host_WriteOpenGLConfig

save opengl variables into opengl.cfg
===============
*/
void Host_WriteOpenGLConfig( void )
{
	file_t	*f;

	MsgDev( D_NOTE, "Host_WriteGLConfig()\n" );
	f = FS_Open( "opengl.cfg", "w", false );
	if( f )
	{
		FS_Printf( f, "//=======================================================================\n" );
		FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\t    opengl.cfg - archive of opengl extension cvars\n");
		FS_Printf( f, "//=======================================================================\n" );
		Cmd_WriteOpenGLVariables( f );
		FS_Close( f );	
	}                                                
	else MsgDev( D_ERROR, "can't update opengl.cfg.\n" );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:24,代码来源:con_utils.c


示例17: Cmd_WriteAliases

/**
 * @brief Write lines containing "aliasa alias value" for all aliases
 * with the archive flag set to true
 * @param f Filehandle to write the aliases to
 */
void Cmd_WriteAliases (qFILE *f)
{
	cmd_alias_t *a;

	for (a = cmd_alias; a; a = a->next)
		if (a->archive) {
			int i;
			FS_Printf(f, "aliasa %s \"", a->name);
			for (i = 0; i < strlen(a->value); i++) {
				if (a->value[i] == '"')
					FS_Printf(f, "\\\"");
				else
					FS_Printf(f, "%c", a->value[i]);
			}
			FS_Printf(f, "\"\n");
		}
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:22,代码来源:cmd.c


示例18: Host_WriteConfig

/*
===============
Host_WriteConfig

Writes key bindings and archived cvars to config.cfg
===============
*/
void Host_WriteConfig( void )
{
	kbutton_t	*mlook, *jlook;
	file_t	*f;

	if( !clgame.hInstance ) return;

	MsgDev( D_NOTE, "Host_WriteConfig()\n" );
	f = FS_Open( "config.cfg", "w", false );
	if( f )
	{
		FS_Printf( f, "//=======================================================================\n");
		FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\t\tconfig.cfg - archive of cvars\n" );
		FS_Printf( f, "//=======================================================================\n" );
		Key_WriteBindings( f );
		Cmd_WriteVariables( f );

		mlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_mlook" );
		jlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_jlook" );

		if( mlook && ( mlook->state & 1 )) 
			FS_Printf( f, "+mlook\n" );

		if( jlook && ( jlook->state & 1 ))
			FS_Printf( f, "+jlook\n" );

		FS_Printf( f, "exec userconfig.cfg" );

		FS_Close( f );
	}
	else MsgDev( D_ERROR, "Couldn't write config.cfg.\n" );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:40,代码来源:con_utils.c


示例19: Key_EnumCmds_f

void Key_EnumCmds_f( void )
{
	file_t	*f;

	FS_AllowDirectPaths( true );
	if( FS_FileExists( "../help.txt", false ))
	{
		Msg( "help.txt already exist\n" );
		FS_AllowDirectPaths( false );
		return;
	}

	f = FS_Open( "../help.txt", "w", false );
	if( f )
	{
		FS_Printf( f, "//=======================================================================\n");
		FS_Printf( f, "//\t\t\tCopyright XashXT Group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
		FS_Printf( f, "//\t\thelp.txt - xash commands and console variables\n");
		FS_Printf( f, "//=======================================================================\n");

		FS_Printf( f, "\n\n\t\t\tconsole variables\n\n");
		Cvar_LookupVars( 0, NULL, f, Cmd_WriteHelp ); 
		FS_Printf( f, "\n\n\t\t\tconsole commands\n\n");
		Cmd_LookupCmds( NULL, f, Cmd_WriteHelp ); 
  		FS_Printf( f, "\n\n");
		FS_Close( f );
		Msg( "help.txt created\n" );
	}
	else MsgDev( D_ERROR, "Couldn't write help.txt.\n");
	FS_AllowDirectPaths( false );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:31,代码来源:con_utils.c


示例20: Cvar_WriteVariables

void Cvar_WriteVariables( fileHandle_t f )
{
	for (const cvar_t* var = cvar_vars; var; var = var->next) {
		if ((Q_stricmp( var->name, "cl_cdkey" ) == 0) || !(var->flags & CVAR_ARCHIVE))
			continue;
		// write the latched value, even if it hasn't taken effect yet
		FS_Printf( f, "seta %s \"%s\"\n", var->name, var->latchedString ? var->latchedString : var->string );
	}
}
开发者ID:DaTa-,项目名称:cnq3x,代码行数:9,代码来源:cvar.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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