/* ============== 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; }