本文整理匯總了C++中DefaultExtension函數的典型用法代碼示例。如果您正苦於以下問題:C++ DefaultExtension函數的具體用法?C++ DefaultExtension怎麽用?C++ DefaultExtension使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DefaultExtension函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: main
void main (int argc, char **argv)
{
int i;
char source[1024];
int size;
FILE *f;
printf( "bspinfo.exe v2.1 (%s)\n", __DATE__ );
printf ("---- bspinfo ----\n" );
if (argc == 1)
Error ("usage: bspinfo bspfile [bspfiles]");
for (i=1 ; i<argc ; i++)
{
printf ("---------------------\n");
strcpy (source, argv[i]);
DefaultExtension (source, ".bsp");
f = fopen (source, "rb");
if (f)
{
size = filelength (f);
fclose (f);
}
else
size = 0;
printf ("%s: %i\n", source, size);
LoadBSPFile (source);
PrintBSPFileSizes ();
printf ("---------------------\n");
}
}
示例2: AddModules
static void AddModules( void )
{
lib_cmd *cmd;
char buff[ MAX_IMPORT_STRING ];
for( cmd = CmdList; cmd != NULL; cmd = cmd->next ) {
if( !( cmd->ops & OP_ADD ) )
continue;
strcpy( buff, cmd->name );
if( cmd->ops & OP_IMPORT ) {
ProcessImport( buff );
} else {
DefaultExtension( buff, EXT_OBJ );
ProcessLibOrObj( buff, OBJ_PROCESS, AddOneObject );
}
Options.modified = TRUE;
if( Options.ar && Options.verbose ) {
if( cmd->ops & OP_DELETED ) {
Message( "r - %s", cmd->name );
} else {
Message( "a - %s", cmd->name );
}
}
}
}
示例3: SaveSkinDialog
void SaveSkinDialog (void)
{
// strcpy (szDirName, ValueForKey (project_entity, "basepath") );
// strcat (szDirName, "\\maps");
/* Place the terminating null character in the szFile. */
szFile[0] = '\0';
/* Set the members of the OPENFILENAME structure. */
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = mainwindow;
ofn.lpstrFilter = szSkinFilter;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof(szFileTitle);
ofn.lpstrInitialDir = szDirName;
ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST |
OFN_FILEMUSTEXIST;
/* Display the Open dialog box. */
if (!GetSaveFileName(&ofn))
return; // canceled
DefaultExtension (ofn.lpstrFile, ".lbm");
Skin_SaveFile (ofn.lpstrFile);
strcpy (skin_filename, ofn.lpstrFile);
}
示例4: MakeLITFile
void MakeLITFile (const char *filename)
{
char litname[1024];
FILE *litfile;
litheader_t litheader;
strcpy (litname, filename);
StripExtension (litname);
DefaultExtension (litname, ".lit", sizeof(litname));
litfile = fopen (litname, "wb");
if (!litfile)
{
printf ("Unable to create %s\n", litname);
return;
}
litheader.ident[0] = 'Q';
litheader.ident[1] = 'L';
litheader.ident[2] = 'I';
litheader.ident[3] = 'T';
litheader.version = LittleLong(LIT_VERSION);
fwrite (&litheader, sizeof(litheader), 1, litfile);
fwrite (&newdlightdata, newlightdatasize, 1, litfile);
fclose (litfile);
printf ("Wrote litfile: %s\n", litname);
}
示例5: SCharCount
C4SoundEffect* C4SoundSystem::GetEffect(const char *szSndName)
{
// Remember wildcards before adding .* extension - if there are 2 versions with different file extensions, play the last added
bool bRandomSound = SCharCount('?',szSndName) || SCharCount('*',szSndName);
// Evaluate sound name
char szName[C4MaxSoundName+2+1];
SCopy(szSndName,szName,C4MaxSoundName);
// Any extension accepted
DefaultExtension(szName,"*");
// Play nth Sound. Standard: 1
int32_t iNumber = 1;
// Sound with a wildcard: determine number of available matches
if (bRandomSound)
{
iNumber = 0;
// Count matching sounds
for (C4SoundEffect *pSfx=FirstSound; pSfx; pSfx=pSfx->Next)
if (WildcardMatch(szName,pSfx->Name))
++iNumber;
// Nothing found? Abort
if(iNumber == 0)
return NULL;
iNumber=UnsyncedRandom(iNumber)+1;
}
// Find requested sound effect in bank
C4SoundEffect *pSfx;
for (pSfx=FirstSound; pSfx; pSfx=pSfx->Next)
if (WildcardMatch(szName,pSfx->Name))
if(!--iNumber)
break;
return pSfx; // Is still NULL if nothing is found
}
示例6: Bspinfo
/*
============
Bspinfo
============
*/
void Bspinfo( int count, char **fileNames ) {
int i;
char source[1024];
int size;
FILE *f;
if ( count < 1 ) {
_printf( "No files to dump info for.\n");
return;
}
for ( i = 0 ; i < count ; i++ ) {
_printf ("---------------------\n");
strcpy (source, fileNames[ i ] );
DefaultExtension (source, ".bsp");
f = fopen (source, "rb");
if (f)
{
size = Q_filelength (f);
fclose (f);
}
else
size = 0;
_printf ("%s: %i\n", source, size);
LoadBSPFile (source);
PrintBSPFileSizes ();
_printf ("---------------------\n");
}
}
示例7: SCopy
C4SoundEffect *C4SoundSystem::GetEffect(const char *szSndName) {
C4SoundEffect *pSfx;
char szName[C4MaxSoundName + 4 + 1];
int32_t iNumber;
// Evaluate sound name
SCopy(szSndName, szName, C4MaxSoundName);
// Default extension
DefaultExtension(szName, "wav");
// Convert old style '*' wildcard to correct '?' wildcard
// For sound effects, '*' is supposed to match single digits only
SReplaceChar(szName, '*', '?');
// Sound with a wildcard: determine number of available matches
if (SCharCount('?', szName)) {
// Search global sound file
if (!(iNumber = SoundFile.EntryCount(szName)))
// Search scenario local files
if (!(iNumber = Game.ScenarioFile.EntryCount(szName)))
// Search bank loaded sounds
if (!(iNumber = EffectInBank(szName)))
// None found: failure
return NULL;
// Insert index to name
iNumber = BoundBy(1 + SafeRandom(iNumber), 1, 9);
SReplaceChar(szName, '?', '0' + iNumber);
}
// Find requested sound effect in bank
for (pSfx = FirstSound; pSfx; pSfx = pSfx->Next)
if (SEqualNoCase(szName, pSfx->Name)) break;
// Sound not in bank, try add
if (!pSfx)
if (!(pSfx = AddEffect(szName))) return NULL;
return pSfx;
}
示例8: MakeAllScales
void MakeAllScales (void)
{
strcpy(transferfile, source);
StripExtension( transferfile );
DefaultExtension( transferfile, ".r2" );
if ( !incremental
|| !IsIncremental(incrementfile)
|| (unsigned)readtransfers(transferfile, num_patches) != num_patches )
{
// determine visibility between patches
BuildVisMatrix ();
RunThreadsOn (num_patches, true, MakeScales);
if ( incremental )
writetransfers(transferfile, num_patches);
else
unlink(transferfile);
// release visibility matrix
FreeVisMatrix ();
}
qprintf ("transfer lists: %5.1f megs\n"
, (float)total_transfer * sizeof(transfer_t) / (1024*1024));
}
示例9: VIS_Main
/*
===========
main
===========
*/
int VIS_Main(){
char portalfile[1024];
char source[1024];
char name[1024];
double start, end;
int total_vis_time;
Sys_Printf( "\n----- VIS ----\n\n" );
//if (i != argc - 1)
// Error ("usage: vis [-threads #] [-level 0-4] [-fast] [-v] bspfile");
start = I_FloatTime();
ThreadSetDefault();
SetQdirFromPath( mapname );
strcpy( source, ExpandArg( mapname ) );
StripExtension( source );
DefaultExtension( source, ".bsp" );
sprintf( name, "%s%s", inbase, source );
Sys_Printf( "reading %s\n", name );
LoadBSPFile( name );
if ( numnodes == 0 || numfaces == 0 ) {
Error( "Empty map" );
}
sprintf( portalfile, "%s%s", inbase, ExpandArg( mapname ) );
StripExtension( portalfile );
strcat( portalfile, ".prt" );
Sys_Printf( "reading %s\n", portalfile );
LoadPortals( portalfile );
CalcVis();
CalcPHS();
visdatasize = vismap_p - dvisdata;
Sys_Printf( "visdatasize:%i compressed from %i\n", visdatasize, originalvismapsize * 2 );
sprintf( name, "%s%s", outbase, source );
Sys_Printf( "writing %s\n", name );
WriteBSPFile( name );
end = I_FloatTime();
total_vis_time = (int) ( end - start );
Sys_Printf( "\nVIS Time: " );
if ( total_vis_time > 59 ) {
Sys_Printf( "%d Minutes ", total_vis_time / 60 );
}
Sys_Printf( "%d Seconds\n", total_vis_time % 60 );
return 0;
}
示例10: BSPInfo
int BSPInfo( int count, char **fileNames )
{
int i;
char source[ 1024 ], ext[ 64 ];
int size;
FILE *f;
/* dummy check */
if( count < 1 )
{
Sys_Printf( "No files to dump info for.\n");
return -1;
}
/* enable info mode */
infoMode = qtrue;
/* walk file list */
for( i = 0; i < count; i++ )
{
Sys_Printf( "---------------------------------\n" );
/* mangle filename and get size */
strcpy( source, fileNames[ i ] );
ExtractFileExtension( source, ext );
if( !Q_stricmp( ext, "map" ) )
StripExtension( source );
DefaultExtension( source, ".bsp" );
f = fopen( source, "rb" );
if( f )
{
size = Q_filelength (f);
fclose( f );
}
else
size = 0;
/* load the bsp file and print lump sizes */
Sys_Printf( "%s\n", source );
LoadBSPFile( source );
PrintBSPFileSizes();
/* print sizes */
Sys_Printf( "\n" );
Sys_Printf( " total %9d\n", size );
Sys_Printf( " %9d KB\n", size / 1024 );
Sys_Printf( " %9d MB\n", size / (1024 * 1024) );
Sys_Printf( "---------------------------------\n" );
}
/* return count */
return i;
}
示例11: WriteBSP
/*
============
WriteBSP
============
*/
void WriteBSP (char *name)
{
char path[1024];
strcpy (path, name);
DefaultExtension (path, ".bsp");
SetModelNumbers ();
SetLightStyles ();
UnparseEntities ();
if ( !onlyents )
WriteMiptex ();
WriteBSPFile (path);
}
示例12: DelModules
static void DelModules( void )
{
lib_cmd *cmd;
char buff[ MAX_IMPORT_STRING ];
for( cmd = CmdList; cmd != NULL; cmd = cmd->next ) {
if( !( cmd->ops & OP_DELETE ) )
continue;
strcpy( buff, cmd->name );
DefaultExtension( buff, EXT_OBJ );
if( IsExt( buff, EXT_LIB ) ) {
ProcessLibOrObj( buff, OBJ_SKIP, DelOneObject );
cmd->ops |= OP_DELETED;
}
if( !( cmd->ops & OP_DELETED ) && !( cmd->ops & OP_ADD ) ) {
Warning( ERR_CANT_DELETE, cmd->name );
} else if( ( cmd->ops & OP_DELETED ) && !( cmd->ops & OP_ADD ) && Options.ar && Options.verbose ) {
Message( "-d %s", cmd->name );
}
}
}
示例13: main
int main (int argc, char **argv)
{
int i;
char source[1024];
if (argc == 1)
Error ("usage: bspinfo bspfile [bspfiles]");
for (i=1 ; i<argc ; i++)
{
printf ("---------------------\n");
strcpy (source, argv[i]);
DefaultExtension (source, ".bsp");
printf ("%s\n", source);
LoadBSPFile (source);
PrintBSPFileSizes ();
printf ("---------------------\n");
}
return 0;
}
示例14: ProcessLumpyScript
/*
=================
ProcessLumpyScript
Loads a script file, then grabs everything from it
=================
*/
void ProcessLumpyScript (char *basename)
{
char script[256];
printf ("qlumpy script: %s\n",basename);
//
// create default destination directory
//
strcpy (destfile, ExpandPath(basename));
StripExtension (destfile);
strcat (destfile,".wad"); // unless the script overrides, save in cwd
//
// save in a wadfile by default
//
savesingle = false;
grabbed = 0;
outputcreated = false;
//
// read in the script file
//
strcpy (script, basename);
DefaultExtension (script, ".ls");
LoadScriptFile (script);
strcpy (basepath, basename);
ParseScript (); // execute load / grab commands
if (!savesingle)
{
WriteWad (do16bit); // write out the wad directory
printf ("%i lumps grabbed in a wad file\n",grabbed);
}
else
printf ("%i lumps written seperately\n",grabbed);
}
示例15: SaveAsDialog
void SaveAsDialog (void)
{
strcpy (szDirName, ValueForKey (g_qeglobals.d_project_entity, "basepath") );
strcat (szDirName, "\\maps");
/* Place the terminating null character in the szFile. */
szFile[0] = '\0';
/* Set the members of the OPENFILENAME structure. */
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = g_qeglobals.d_hwndCamera;
ofn.lpstrFilter = szFilter;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = sizeof(szFileTitle);
ofn.lpstrInitialDir = szDirName;
ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST |
OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT;
/* Display the Open dialog box. */
if (!GetSaveFileName(&ofn))
return; // canceled
DefaultExtension (ofn.lpstrFile, ".map");
strcpy (currentmap, ofn.lpstrFile);
// Add the file in MRU.
AddNewItem(g_qeglobals.d_lpMruMenu, ofn.lpstrFile);
// Refresh the File menu.
PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu,GetSubMenu(GetMenu(g_qeglobals.d_hwndMain),0),
ID_FILE_EXIT);
Map_SaveFile (ofn.lpstrFile, false); // ignore region
}