这篇教程C++ DefaultExtension函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DefaultExtension函数的典型用法代码示例。如果您正苦于以下问题:C++ DefaultExtension函数的具体用法?C++ DefaultExtension怎么用?C++ DefaultExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DefaultExtension函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainvoid 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"); }}
开发者ID:JoelTroch,项目名称:am_src_30jan2011,代码行数:34,
示例2: AddModulesstatic 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 ); } } }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:25,
示例3: SaveSkinDialogvoid 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);}
开发者ID:Almamu,项目名称:Quake-2-Tools,代码行数:32,
示例4: MakeLITFilevoid 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);}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:29,
示例5: SCharCountC4SoundEffect* 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}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:32,
示例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"); }}
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:35,
示例7: SCopyC4SoundEffect *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;}
开发者ID:ev1313,项目名称:yaC,代码行数:33,
示例8: MakeAllScalesvoid 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));}
开发者ID:jpiolho,项目名称:halflife,代码行数:26,
示例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;}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:62,
示例10: BSPInfoint 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;}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:55,
示例11: WriteBSP/*============WriteBSP============*/void WriteBSP (char *name){ char path[1024]; strcpy (path, name); DefaultExtension (path, ".bsp"); SetModelNumbers (); SetLightStyles (); UnparseEntities (); if ( !onlyents ) WriteMiptex (); WriteBSPFile (path);}
开发者ID:6779660,项目名称:halflife,代码行数:21,
示例12: DelModulesstatic 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 ); } }}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:21,
示例13: mainint 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;}
开发者ID:atphalix,项目名称:eviltoys,代码行数:21,
示例14: ProcessLumpyScript/*=================ProcessLumpyScriptLoads 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);}
开发者ID:DeadlyGamer,项目名称:cs16nd,代码行数:47,
示例15: SaveAsDialogvoid 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}
开发者ID:amitahire,项目名称:development,代码行数:40,
示例16: ExportEntitiesMainint ExportEntitiesMain( int argc, char **argv ){ /* arg checking */ if ( argc < 1 ) { Sys_Printf( "Usage: q3map -exportents [-v] <mapname>/n" ); return 0; } /* do some path mangling */ strcpy( source, ExpandArg( argv[ argc - 1 ] ) ); StripExtension( source ); DefaultExtension( source, ".bsp" ); /* load the bsp */ Sys_Printf( "Loading %s/n", source ); LoadBSPFile( source ); /* export the lightmaps */ ExportEntities(); /* return to sender */ return 0;}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:22,
示例17: WriteLitFilevoidWriteLitFile(const char *filename, int version){ FILE *l; char f[1024]; litheader_t h; strncpy(f, filename, 1019); /* 1024 - space for extension - '/0' */ f[1023] = '/0'; StripExtension(f); DefaultExtension(f, ".lit"); h.ident[0] = 'Q'; h.ident[1] = 'L'; h.ident[2] = 'I'; h.ident[3] = 'T'; h.version = LittleLong(version); l = SafeOpenWrite(f); SafeWrite(l, &h, sizeof(litheader_t)); SafeWrite(l, lit_filebase, lightdatasize * 3); fclose(l);}
开发者ID:AidHamza,项目名称:eviltoys,代码行数:23,
示例18: main/*===========main===========*/int main (int argc, char **argv){ char portalfile[1024]; char source[1024]; int i; double start, end; printf ("vis.exe v1.3 (%s)/n", __DATE__); printf ("---- vis ----/n"); verbose = false; for (i=1 ; i<argc ; i++) { if (!strcmp(argv[i],"-threads")) { numthreads = atoi (argv[i+1]); i++; } else if (!strcmp(argv[i], "-fast")) { printf ("fastvis = true/n"); fastvis = true; } else if (!strcmp(argv[i], "-v")) { printf ("verbose = true/n"); verbose = true; } else if (argv[i][0] == '-') Error ("Unknown option /"%s/"", argv[i]); else break; } if (i != argc - 1) Error ("usage: vis [-threads #] [-level 0-4] [-fast] [-v] bspfile"); start = I_FloatTime (); ThreadSetDefault (); printf ("%i thread(s)/n", numthreads); strcpy (source, argv[i]); StripExtension (source); DefaultExtension (source, ".bsp"); LoadBSPFile (source); strcpy (portalfile, argv[i]); StripExtension (portalfile); strcat (portalfile, ".prt"); LoadPortals (portalfile); uncompressed = malloc(bitbytes*portalleafs); memset (uncompressed, 0, bitbytes*portalleafs); CalcVis (); qprintf ("c_chains: %i/n",c_chains); visdatasize = vismap_p - dvisdata; printf ("visdatasize:%i compressed from %i/n", visdatasize, originalvismapsize); CalcAmbientSounds (); WriteBSPFile (source); // unlink (portalfile); end = I_FloatTime (); printf ("%5.1f seconds elapsed/n", end-start); free(uncompressed); return 0;}
开发者ID:6779660,项目名称:halflife,代码行数:83,
示例19: main/*==============main==============*/int main (int argc, char **argv){ static int i; // VC4.2 compiler bug if auto... char path[1024]; // using GtkRadiant's versioning next to Id's versioning printf ("Q3Data - (c) 1999 Id Software Inc./n"); printf ("GtkRadiant - v" RADIANT_VERSION " " __DATE__ "/n"); ExpandWildcards (&argc, &argv); for (i=1 ; i<argc ; i++) { if (!strcmp(argv[i], "-archive")) { archive = qtrue; strcpy (archivedir, argv[i+1]); printf ("Archiving source to: %s/n", archivedir); i++; } else if (!strcmp(argv[i], "-release")) { g_release = qtrue; strcpy (g_releasedir, argv[i+1]); printf ("Copy output to: %s/n", g_releasedir); i++; } else if ( !strcmp( argv[i], "-nostrips" ) ) { g_stripify = qfalse; printf( "Not optimizing for strips/n" ); } else if ( !strcmp( argv[i], "-writedir" ) ) { strcpy( writedir, argv[i+1] ); printf( "Write output to: %s/n", writedir ); i++; } else if ( !strcmp( argv[i], "-verbose" ) ) { g_verbose = qtrue; } else if ( !strcmp( argv[i], "-dump" ) ) { printf( "Dumping contents of: '%s'/n", argv[i+1] ); if ( strstr( argv[i+1], ".md3" ) ) { MD3_Dump( argv[i+1] ); } else { Error( "Do not know how to dump the contents of '%s'/n", argv[i+1] ); } i++; } else if ( !strcmp( argv[i], "-3dsconvert" ) ) { // NOTE TTimo this is broken, tried on a sample .3ds // what happens .. it calls the Convert3DStoMD3, // which calls the scriptlib function in non initialized state .. and crashes printf( "Converting %s.3DS to %s.MD3/n", argv[i+1], argv[i+1] ); SetQdirFromPath( argv[i+1] ); vfsInitDirectory( gamedir ); Convert3DStoMD3( argv[i+1] ); i++; } else if (!strcmp(argv[i], "-only")) { strcpy (g_only, argv[i+1]); printf ("Only grabbing %s/n", g_only); i++; } else if (!strcmp(argv[i], "-gamedir")) { strcpy(gamedir, argv[i+1]); i++; } else if (argv[i][0] == '-') Error ("Unknown option /"%s/"", argv[i]); else break; } if (i == argc) Error ("usage: q3data [-archive <directory>] [-dump <file.md3>] [-release <directory>] [-only <model>] [-3dsconvert <file.3ds>] [-verbose] [file.qdt]"); for ( ; i<argc ; i++) { printf ("--------------- %s ---------------/n", argv[i]); // load the script strcpy (path, argv[i]); DefaultExtension (path, ".qdt"); if(!gamedir[0]) SetQdirFromPath (path); // NOTE TTimo//.........这里部分代码省略.........
开发者ID:AEonZR,项目名称:GtkRadiant,代码行数:101,
示例20: main/*==============main==============*/int main (int argc, char **argv){ static int i; // VC4.2 compiler bug if auto... char path[1024]; ExpandWildcards (&argc, &argv); for (i=1 ; i<argc ; i++) { if (!strcmp(argv[i], "-archive")) { // -archive f:/quake2/release/dump_11_30 archive = true; strcpy (archivedir, argv[i+1]); printf ("Archiving source to: %s/n", archivedir); i++; } else if (!strcmp(argv[i], "-release")) { g_release = true; strcpy (g_releasedir, argv[i+1]); printf ("Copy output to: %s/n", g_releasedir); i++; } else if (!strcmp(argv[i], "-compress")) { g_compress_pak = true; printf ("Compressing pakfile/n"); } else if (!strcmp(argv[i], "-pak")) { g_release = true; g_pak = true; printf ("Building pakfile: %s/n", argv[i+1]); BeginPak (argv[i+1]); i++; } else if (!strcmp(argv[i], "-only")) { strcpy (g_only, argv[i+1]); printf ("Only grabbing %s/n", g_only); i++; } else if (!strcmp(argv[i], "-3ds")) { do3ds = true; printf ("loading .3ds files/n"); } else if (argv[i][0] == '-') Error ("Unknown option /"%s/"", argv[i]); else break; } if (i >= argc) Error ("usage: qgrab [-archive <directory>] [-release <directory>] [-only <model>] [-3ds] file.qgr"); if (do3ds) trifileext = ext_3ds; else trifileext = ext_tri; for ( ; i<argc ; i++) { printf ("--------------- %s ---------------/n", argv[i]); // load the script strcpy (path, argv[i]); DefaultExtension (path, ".qdt"); SetQdirFromPath (path); LoadScriptFile (ExpandArg(path)); // // parse it // ParseScript (); // write out the last model FinishModel (); FinishSprite (); } if (g_pak) FinishPak (); return 0;}
开发者ID:amitahire,项目名称:development,代码行数:91,
示例21: ConvertBspToASE/*ConvertBspToASE()exports an 3d studio ase file from the bsp*/int ConvertBspToASE(int argc, char **argv){ int i; double start, end; char source[1024]; char dest[1024]; Sys_Printf("---- convert map to ase ----/n"); for(i = 1; i < argc; i++) { if(!strcmp(argv[i], "-threads")) { numthreads = atoi(argv[i + 1]); i++; } else if(!strcmp(argv[i], "-v")) { Sys_Printf("verbose = true/n"); verbose = qtrue; } else if(!strcmp(argv[i], "-connect")) { Broadcast_Setup(argv[++i]); } else if(argv[i][0] == '-') Error("Unknown option /"%s/"", argv[i]); else break; } if(i != argc - 1) { Error("usage: xmap -bsp2ase [-<switch> [-<switch> ...]] <mapname.bsp>/n" "/n" "Switches:/n" " v = verbose output/n"); //" quake1 = convert from QuakeWorld to XreaL/n" //" quake2 = convert from Quake2 to XreaL/n" //" quake3 = convert from Quake3 to XreaL/n" //" quake4 = convert from Quake4 to XreaL/n"); } start = I_FloatTime(); ThreadSetDefault(); SetQdirFromPath(argv[i]); strcpy(source, ExpandArg(argv[i])); StripExtension(source); DefaultExtension(source, ".bsp"); // start from scratch LoadShaderInfo(); Sys_Printf("reading %s/n", source); LoadBSPFile(source); ParseEntities(); // strcpy(dest, ExpandArg(argv[i])); StripExtension(dest); strcat(dest, "_converted"); DefaultExtension(dest, ".ase"); WriteASEFile(dest); end = I_FloatTime(); Sys_Printf("%5.0f seconds elapsed/n", end - start); // shut down connection Broadcast_Shutdown(); return 0;}
开发者ID:otty,项目名称:cake3,代码行数:80,
示例22: main/* * ================== * main * light modelfile * ================== */intmain(int argc, const char **argv){ int i, bsp_version; double start; double end; char source[1024]; init_log("light.log"); logprint("----- TyrLight v0.99e -----/n"#if 0 "** Beta version " __DATE__ " " __TIME__ "/n"#endif ); numthreads = GetDefaultThreads(); for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-threads")) { numthreads = atoi(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-extra")) { extrasamples = true; logprint("extra sampling enabled/n"); } else if (!strcmp(argv[i], "-dist")) { scaledist = atof(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-range")) { rangescale = atof(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-light")) { worldminlight = atof(argv[i + 1]); i++; } else if (!strcmp(argv[i], "-compress")) { compress_ents = true; logprint("light entity compression enabled/n"); } else if (!strcmp(argv[i], "-colored") || !strcmp(argv[i], "-coloured")) { colored = true; } else if (!strcmp(argv[i], "-bsp30")) { bsp30 = true; } else if (!strcmp(argv[i], "-lit")) { litfile = true; } else if (!strcmp(argv[i], "-nominlimit")) { nominlimit = true; } else if (argv[i][0] == '-') Error("Unknown option /"%s/"", argv[i]); else break; } if (numthreads > 1) logprint("running with %d threads/n", numthreads); // Switch on colored flag if specifying -lit or -bsp30 if (bsp30 || litfile) colored = true; // Check the colored options if (colored) { if (!bsp30 && !litfile) { logprint("colored output format not specified -> using bsp 30/n"); bsp30 = true; } else if (bsp30 && litfile) { Error("Two colored output formats specified"); } else if (litfile) { logprint("colored output format: lit/n"); } else if (bsp30) { logprint("colored output format: bsp30/n"); } } if (i != argc - 1) Error("usage: light [-threads num] [-light num] [-extra]/n" " [-colored] [-bsp30] [-lit]/n" " [-nocount] [-compress] [-nominlimit] bspfile/n"); start = I_FloatTime(); strcpy(source, argv[i]); StripExtension(source); DefaultExtension(source, ".bsp"); bsp_version = LoadBSPFile(source); LoadEntities(); MakeTnodes(); FindFaceOffsets(); LightWorld(); WriteEntitiesToString(); if (colored && bsp30) WriteBSPFile(source, 30); else//.........这里部分代码省略.........
开发者ID:JoshEngebretson,项目名称:FSRadQuakeStuff,代码行数:101,
示例23: BSPMain//.........这里部分代码省略......... emitFlares = qtrue; } else if( !strcmp( argv[ i ], "-noflares" ) ) { Sys_Printf( "Flare surfaces disabled/n" ); emitFlares = qfalse; } else if( !strcmp( argv[ i ], "-skyfix" ) ) { Sys_Printf( "GL_CLAMP sky fix/hack/workaround enabled/n" ); skyFixHack = qtrue; } else if( !strcmp( argv[ i ], "-debugsurfaces" ) ) { Sys_Printf( "emitting debug surfaces/n" ); debugSurfaces = qtrue; } else if( !strcmp( argv[ i ], "-debuginset" ) ) { Sys_Printf( "Debug surface triangle insetting enabled/n" ); debugInset = qtrue; } else if( !strcmp( argv[ i ], "-debugportals" ) ) { Sys_Printf( "Debug portal surfaces enabled/n" ); debugPortals = qtrue; } else if( !strcmp( argv[ i ], "-bsp" ) ) Sys_Printf( "-bsp argument unnecessary/n" ); else Sys_Printf( "WARNING: Unknown option /"%s/"/n", argv[ i ] ); } /* fixme: print more useful usage here */ if( i != (argc - 1) ) Error( "usage: q3map [options] mapfile" ); /* copy source name */ strcpy( source, ExpandArg( argv[ i ] ) ); StripExtension( source ); /* ydnar: set default sample size */ SetDefaultSampleSize( sampleSize ); /* delete portal, line and surface files */ sprintf( path, "%s.prt", source ); remove( path ); sprintf( path, "%s.lin", source ); remove( path ); //% sprintf( path, "%s.srf", source ); /* ydnar */ //% remove( path ); /* expand mapname */ strcpy( name, ExpandArg( argv[ i ] ) ); if( strcmp( name + strlen( name ) - 4, ".reg" ) ) { /* if we are doing a full map, delete the last saved region map */ sprintf( path, "%s.reg", source ); remove( path ); DefaultExtension( name, ".map" ); /* might be .reg */ } /* if onlyents, just grab the entites and resave */ if( onlyents ) { OnlyEnts(); return 0; } /* load shaders */ LoadShaderInfo(); /* load original file from temp spot in case it was renamed by the editor on the way in */ if( strlen( tempSource ) > 0 ) LoadMapFile( tempSource, qfalse ); else LoadMapFile( name, qfalse ); /* ydnar: decal setup */ ProcessDecals(); /* ydnar: cloned brush model entities */ SetCloneModelNumbers(); /* process world and submodels */ ProcessModels(); /* set light styles from targetted light entities */ SetLightStyles(); /* finish and write bsp */ EndBSPFile(); /* remove temp map source file if appropriate */ if( strlen( tempSource ) > 0) remove( tempSource ); /* return to sender */ return 0;}
开发者ID:Teivaz,项目名称:nebula2,代码行数:101,
示例24: IdentifyVersionstatic EIWADType IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad){ WadStuff wads[countof(IWADNames)]; size_t foundwads[NUM_IWAD_TYPES] = { 0 }; const char *iwadparm = Args->CheckValue ("-iwad"); size_t numwads; int pickwad; size_t i; bool iwadparmfound = false; FString custwad; if (iwadparm == NULL && iwad != NULL && *iwad != 0) { iwadparm = iwad; } if (iwadparm) { custwad = iwadparm; FixPathSeperator (custwad); if (CheckIWAD (custwad, wads)) { // -iwad parameter was a directory iwadparm = NULL; } else { DefaultExtension (custwad, ".wad"); iwadparm = custwad; IWADNames[0] = iwadparm; CheckIWAD ("", wads); } } if (iwadparm == NULL || wads[0].Path.IsEmpty()) { if (GameConfig->SetSection ("IWADSearch.Directories")) { const char *key; const char *value; while (GameConfig->NextInSection (key, value)) { if (stricmp (key, "Path") == 0) { FString nice = NicePath(value); FixPathSeperator(nice); CheckIWAD(nice, wads); } } }#ifdef _WIN32 FString steam_path = I_GetSteamPath(); if (steam_path.IsNotEmpty()) { static const char *const steam_dirs[] = { "doom 2/base", "final doom/base", "heretic shadow of the serpent riders/base", "hexen/base", "hexen deathkings of the dark citadel/base", "ultimate doom/base" }; steam_path += "/SteamApps/common/"; for (i = 0; i < countof(steam_dirs); ++i) { CheckIWAD (steam_path + steam_dirs[i], wads); } }#endif } if (iwadparm != NULL && !wads[0].Path.IsEmpty()) { iwadparmfound = true; } for (i = numwads = 0; i < countof(IWADNames); i++) { if (!wads[i].Path.IsEmpty()) { if (i != numwads) { wads[numwads] = wads[i]; } foundwads[wads[numwads].Type] = numwads + 1; numwads++; } } if (foundwads[IWAD_HexenDK] && !foundwads[IWAD_Hexen]) { // Cannot play Hexen DK without Hexen size_t kill = foundwads[IWAD_HexenDK]; for (i = kill; i < numwads; ++i) { wads[i - 1] = wads[i]; } numwads--; foundwads[IWAD_HexenDK] = 0; for (i = 0; i < NUM_IWAD_TYPES; ++i)//.........这里部分代码省略.........
开发者ID:WChrisK,项目名称:Zandronum,代码行数:101,
示例25: FixAASint FixAAS( int argc, char **argv ){ int length, checksum; void *buffer; FILE *file; char aas[ 1024 ], **ext; char *exts[] = { ".aas", "_b0.aas", "_b1.aas", NULL }; /* arg checking */ if( argc < 2 ) { Sys_Printf( "Usage: q3map -fixaas [-v] <mapname>/n" ); return 0; } /* do some path mangling */ strcpy( source, ExpandArg( argv[ argc - 1 ] ) ); StripExtension( source ); DefaultExtension( source, ".bsp" ); /* note it */ Sys_Printf( "--- FixAAS ---/n" ); /* load the bsp */ Sys_Printf( "Loading %s/n", source ); length = LoadFile( source, &buffer ); /* create bsp checksum */ Sys_Printf( "Creating checksum.../n" ); checksum = LittleLong( MD4BlockChecksum( buffer, length ) ); /* write checksum to aas */ ext = exts; while( *ext ) { /* mangle name */ strcpy( aas, source ); StripExtension( aas ); strcat( aas, *ext ); Sys_Printf( "Trying %s/n", aas ); ext++; /* fix it */ file = fopen( aas, "r+b" ); if( !file ) continue; if( fwrite( &checksum, 4, 1, file ) != 1 ) Error( "Error writing checksum to %s", aas ); fclose( file ); } /* return to sender */ return 0;}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:61,
示例26: ConvertBSPMainint ConvertBSPMain( int argc, char **argv ){ int i; int (*convertFunc)( char * ); game_t *convertGame; /* set default */ convertFunc = ConvertBSPToASE; convertGame = NULL; /* arg checking */ if( argc < 1 ) { Sys_Printf( "Usage: q3map -scale <value> [-v] <mapname>/n" ); return 0; } /* process arguments */ for( i = 1; i < (argc - 1); i++ ) { /* -format map|ase|... */ if( !strcmp( argv[ i ], "-format" ) ) { i++; if( !Q_stricmp( argv[ i ], "ase" ) ) convertFunc = ConvertBSPToASE; else if( !Q_stricmp( argv[ i ], "map" ) ) convertFunc = ConvertBSPToMap; else { convertGame = GetGame( argv[ i ] ); if( convertGame == NULL ) Sys_Printf( "Unknown conversion format /"%s/". Defaulting to ASE./n", argv[ i ] ); } } } /* clean up map name */ strcpy( source, ExpandArg( argv[ i ] ) ); StripExtension( source ); DefaultExtension( source, ".bsp" ); LoadShaderInfo(); Sys_Printf( "Loading %s/n", source ); /* ydnar: load surface file */ //% LoadSurfaceExtraFile( source ); LoadBSPFile( source ); /* parse bsp entities */ ParseEntities(); /* bsp format convert? */ if( convertGame != NULL ) { /* set global game */ game = convertGame; /* write bsp */ StripExtension( source ); DefaultExtension( source, "_c.bsp" ); Sys_Printf( "Writing %s/n", source ); WriteBSPFile( source ); /* return to sender */ return 0; } /* normal convert */ return convertFunc( source );}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:74,
示例27: ScaleBSPMainint ScaleBSPMain( int argc, char **argv ){ int i; float f, scale; vec3_t vec; char str[ 1024 ]; /* arg checking */ if( argc < 2 ) { Sys_Printf( "Usage: q3map -scale <value> [-v] <mapname>/n" ); return 0; } /* get scale */ scale = atof( argv[ argc - 2 ] ); if( scale == 0.0f ) { Sys_Printf( "Usage: q3map -scale <value> [-v] <mapname>/n" ); Sys_Printf( "Non-zero scale value required./n" ); return 0; } /* do some path mangling */ strcpy( source, ExpandArg( argv[ argc - 1 ] ) ); StripExtension( source ); DefaultExtension( source, ".bsp" ); /* load the bsp */ Sys_Printf( "Loading %s/n", source ); LoadBSPFile( source ); ParseEntities(); /* note it */ Sys_Printf( "--- ScaleBSP ---/n" ); Sys_FPrintf( SYS_VRB, "%9d entities/n", numEntities ); /* scale entity keys */ for( i = 0; i < numBSPEntities && i < numEntities; i++ ) { /* scale origin */ GetVectorForKey( &entities[ i ], "origin", vec ); if( (vec[ 0 ] + vec[ 1 ] + vec[ 2 ]) ) { VectorScale( vec, scale, vec ); sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] ); SetKeyValue( &entities[ i ], "origin", str ); } /* scale door lip */ f = FloatForKey( &entities[ i ], "lip" ); if( f ) { f *= scale; sprintf( str, "%f", f ); SetKeyValue( &entities[ i ], "lip", str ); } } /* scale models */ for( i = 0; i < numBSPModels; i++ ) { VectorScale( bspModels[ i ].mins, scale, bspModels[ i ].mins ); VectorScale( bspModels[ i ].maxs, scale, bspModels[ i ].maxs ); } /* scale nodes */ for( i = 0; i < numBSPNodes; i++ ) { VectorScale( bspNodes[ i ].mins, scale, bspNodes[ i ].mins ); VectorScale( bspNodes[ i ].maxs, scale, bspNodes[ i ].maxs ); } /* scale leafs */ for( i = 0; i < numBSPLeafs; i++ ) { VectorScale( bspLeafs[ i ].mins, scale, bspLeafs[ i ].mins ); VectorScale( bspLeafs[ i ].maxs, scale, bspLeafs[ i ].maxs ); } /* scale drawverts */ for( i = 0; i < numBSPDrawVerts; i++ ) VectorScale( bspDrawVerts[ i ].xyz, scale, bspDrawVerts[ i ].xyz ); /* scale planes */ for( i = 0; i < numBSPPlanes; i++ ) bspPlanes[ i ].dist *= scale; /* scale gridsize */ GetVectorForKey( &entities[ 0 ], "gridsize", vec ); if( (vec[ 0 ] + vec[ 1 ] + vec[ 2 ]) == 0.0f ) VectorCopy( gridSize, vec ); VectorScale( vec, scale, vec ); sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] ); SetKeyValue( &entities[ 0 ], "gridsize", str ); /* write the bsp */ UnparseEntities(); StripExtension( source );//.........这里部分代码省略.........
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:101,
注:本文中的DefaultExtension函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DefaultGrid函数代码示例 C++ DefaultDepthOfScreen函数代码示例 |