本文整理汇总了C++中FS_Printf函数的典型用法代码示例。如果您正苦于以下问题:C++ FS_Printf函数的具体用法?C++ FS_Printf怎么用?C++ FS_Printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FS_Printf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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++;
}
}
示例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] );
}
示例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);
}
示例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 );
}
}
}
示例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 );
}
}
示例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);
}
示例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 );
}
示例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);
}
示例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;
}
示例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 );
}
示例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);
}
}
示例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 );
}
示例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);
}
示例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" );
}