/* =============== Cmd_Cd =============== */ void Cmd_Cd (void) { char temp[256]; FinishModel (); ClearModel (); GetScriptToken (false); // this is a silly mess... sprintf (cdpartial, "models/%s", token); sprintf (cdarchive, "%smodels/%s", gamedir+strlen(qdir), token); sprintf (cddir, "%s%s", gamedir, cdpartial); // Since we also changed directories on the output side (for mirror) make sure the outputdir is set properly too. sprintf(temp, "%s%s", g_outputDir, cdpartial); strcpy(g_outputDir, temp); // if -only was specified and this cd doesn't match, // skip the model (you only need to match leading chars, // so you could regrab all monsters with -only monsters) if (!g_only[0]) return; if (strncmp(token, g_only, strlen(g_only))) { g_skipmodel = true; printf ("skipping %s\n", cdpartial); } }
/* =============== Cmd_Cd =============== */ void Cmd_Cd (void) { FinishModel (); ClearModel (); GetToken (false); // this is a silly mess... sprintf (cdpartial, "models/%s", token); sprintf (cdarchive, "%smodels/%s", gamedir+strlen(qdir), token); sprintf (cddir, "%s%s", gamedir, cdpartial); // if -only was specified and this cd doesn't match, // skip the model (you only need to match leading chars, // so you could regrab all monsters with -only monsters) if (!g_only[0]) return; if (strncmp(token, g_only, strlen(g_only))) { g_skipmodel = true; printf ("skipping %s\n", cdpartial); } }
/* ============== 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 // q3data went through a partial conversion to use the vfs // it was never actually tested before 1.1.1 // the code is still mostly using direct file access calls vfsInitDirectory( gamedir ); LoadScriptFile (ExpandArg(path), -1); // // parse it // ParseScript (); // write out the last model FinishModel ( TYPE_UNKNOWN ); } return 0; }
/* ============== 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; }
/* ============== main ============== */ int main (int argc, char **argv) { int i; char path[1024]; char *basedir; double starttime, endtime; printf ("Qdata Plus : "__TIME__" "__DATE__"\n"); starttime = I_FloatTime(); basedir = NULL; TK_Init(); 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], "-base")) { i++; basedir = argv[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 (!strcmpi(argv[i], "-keypress")) { g_dokeypress = true; } else if (!strcmp(argv[i], "-3ds")) { do3ds = true; printf ("loading .3ds files\n"); } else if (!strcmp(argv[i], "-materialfile")) { strcpy(g_materialFile, argv[i+1]); printf("Setting material file to %s\n", g_materialFile); i++; } /* else if (!strcmpi(argv[i], "-newgen")) { if (i < argc-4) { printf("run new triangle grouping routine here\n"); NewGen(argv[i+1],argv[i+2],atoi(argv[i+3]),atoi(argv[i+4])); } else { printf("qdata -newskin <base.hrc> <skin.pcx> width height\n"); } return 0; } */ else if (!strcmpi(argv[i], "-genskin")) { i++; if (i < argc-3) { GenSkin(argv[i],argv[i+1],atol(argv[i+2]),atol(argv[i+3])); } else { printf("qdata -genskin <base.hrc> <skin.pcx> <desired width> <desired height>\n"); } return 0; } else if (!strcmpi(argv[i], "-noopts")) { g_no_opimizations = true; printf("not performing optimizations\n"); } else if (!strcmpi(argv[i], "-md2")) { g_forcemodel = MODEL_MD2; } else if (!strcmpi(argv[i], "-fm")) { g_forcemodel = MODEL_FM; } else if (!strcmpi(argv[i], "-verbose")) { g_verbose = true; } else if (!strcmpi(argv[i], "-oldskin")) { g_allow_newskin = false; } else if (!strcmpi(argv[i], "-ignoreUV")) { g_ignoreTriUV = true; } else if (!strcmpi(argv[i], "-publish")) { g_publishOutput = true; } else if (!strcmpi(argv[i], "-nomkdir")) { g_nomkdir = true; } else if (argv[i][0] == '-') Error ("Unknown option \"%s\"", argv[i]); else break; } if (i >= argc) { Error ("usage: qdata [-archive <directory>]\n" " [-release <directory>]\n" " [-base <directory>]\n" " [-compress]\n" " [-pak <file>]\n" " [-only <model>]\n" " [-keypress]\n" " [-3ds]\n" " [-materialfile <file>]\n" " [-noopts]\n" " [-md2]\n" " [-fm]\n" " [-verbose]\n" " [-ignoreUV]\n" " [-oldskin]\n" " [-publish]\n" " [-nomkdir]\n" " file.qdt\n" "or\n" " qdata -genskin <base.hrc> <skin.pcx> <desired width> <desired height>"); } 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"); DefaultExtension(g_materialFile, ".mat"); SetQdirFromPath (path); printf("workingdir='%s'\n", gamedir); if (basedir) { qdir[0] = 0; g_outputDir = basedir; } printf("outputdir='%s'\n", g_outputDir); QFile_ReadMaterialTypes(g_materialFile); LoadScriptFile (ExpandArg(path)); // // parse it // ParseScript (); // write out the last model FinishModel (); FMFinishModel (); FinishSprite (); } if (total_textures) { printf("\n"); printf("Total textures processed: %d\n",total_textures); printf("Average size: %d x %d\n",total_x / total_textures, total_y / total_textures); } if (g_pak) FinishPak (); endtime = I_FloatTime(); printf("Time elapsed: %f\n", endtime-starttime); if (g_dokeypress) { printf("Success! ... Hit a key: "); getchar(); } return 0; }