Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

bspc.c File Reference

#include <unistd.h>
#include <glob.h>
#include <sys/stat.h>
#include "qbsp.h"
#include "l_mem.h"
#include "../botlib/aasfile.h"
#include "../botlib/be_aas_cluster.h"
#include "../botlib/be_aas_optimize.h"
#include "aas_create.h"
#include "aas_store.h"
#include "aas_file.h"
#include "aas_cfg.h"
#include "be_aas_bspc.h"

Include dependency graph for bspc.c:

Include dependency graph

Go to the source code of this file.

Defines

#define COMP_AASINFO   6
#define COMP_AASOPTIMIZE   5
#define COMP_BSP2AAS   2
#define COMP_BSP2MAP   1
#define COMP_CLUSTER   4
#define COMP_REACH   3

Functions

void AASOuputFile (quakefile_t *qf, char *outputpath, char *filename)
void CreateAASFilesForAllBSPFiles (char *quakepath)
quakefile_tGetArgumentFiles (int argc, char *argv[], int *i, char *ext)
int main (int argc, char **argv)

Variables

aas_settings_t aassettings
int calcgrapplereach
qboolean cancelconversion
qboolean capsule_collision = 0
qboolean create_aas
int entity_num
qboolean forcesidesvisible
qboolean freetree
qboolean fulldetail
qboolean glview
qboolean leaktest
qboolean lessbrushes
vec_t microvolume = 1.0
char name [1024]
qboolean nobrushmerge
qboolean nocsg
qboolean nodetail
qboolean noliquids
qboolean nomerge
qboolean noprune
qboolean noshare
qboolean nosubdiv
qboolean notjunc
qboolean nowater
qboolean noweld
qboolean onlyents
qboolean optimize
char outbase [32]
char source [1024]
float subdivide_size = 240
int use_nodequeue
qboolean verboseentities


Define Documentation

#define COMP_AASINFO   6
 

Definition at line 502 of file bspc.c.

Referenced by main().

#define COMP_AASOPTIMIZE   5
 

Definition at line 501 of file bspc.c.

Referenced by main().

#define COMP_BSP2AAS   2
 

Definition at line 498 of file bspc.c.

Referenced by main().

#define COMP_BSP2MAP   1
 

Definition at line 497 of file bspc.c.

Referenced by main().

#define COMP_CLUSTER   4
 

Definition at line 500 of file bspc.c.

Referenced by main().

#define COMP_REACH   3
 

Definition at line 499 of file bspc.c.

Referenced by main().


Function Documentation

void AASOuputFile quakefile_t qf,
char *  outputpath,
char *  filename
 

Definition at line 321 of file bspc.c.

References access(), AppendPathSeperator(), CreatePath(), ExtractFileBase(), ExtractFileExtension(), quakefile_s::filename, MAX_PATH, quakefile_s::origname, quakefile_t, strcat(), strcpy(), and strlen().

Referenced by main().

00322 {
00323     char ext[MAX_PATH];
00324 
00325     //
00326     if (strlen(outputpath))
00327     {
00328         strcpy(filename, outputpath);
00329         //append the bsp file base
00330         AppendPathSeperator(filename, MAX_PATH);
00331         ExtractFileBase(qf->origname, &filename[strlen(filename)]);
00332         //append .aas
00333         strcat(filename, ".aas");
00334         return;
00335     } //end if
00336     //
00337     ExtractFileExtension(qf->filename, ext);
00338     if (!stricmp(ext, "pk3") || !stricmp(ext, "pak") || !stricmp(ext, "sin"))
00339     {
00340         strcpy(filename, qf->filename);
00341         while(strlen(filename) &&
00342                 filename[strlen(filename)-1] != '\\' &&
00343                 filename[strlen(filename)-1] != '/')
00344         {
00345             filename[strlen(filename)-1] = '\0';
00346         } //end while
00347         strcat(filename, "maps");
00348         if (access(filename, 0x04)) CreatePath(filename);
00349         //append the bsp file base
00350         AppendPathSeperator(filename, MAX_PATH);
00351         ExtractFileBase(qf->origname, &filename[strlen(filename)]);
00352         //append .aas
00353         strcat(filename, ".aas");
00354     } //end if
00355     else
00356     {
00357         strcpy(filename, qf->filename);
00358         while(strlen(filename) &&
00359                 filename[strlen(filename)-1] != '.')
00360         {
00361             filename[strlen(filename)-1] = '\0';
00362         } //end while
00363         strcat(filename, "aas");
00364     } //end else
00365 } //end of the function AASOutputFile

Here is the call graph for this function:

void CreateAASFilesForAllBSPFiles char *  quakepath  ) 
 

Definition at line 372 of file bspc.c.

References _MAX_PATH, AppendPathSeperator(), FindQuakeFiles(), j, Log_Print(), quakefile_s::next, NULL, quakefile_s::origname, quakefile_s::pakfile, quakefile_t, sprintf(), strcat(), strcpy(), and strlen().

Referenced by main().

00373 {
00374 #if defined(WIN32)|defined(_WIN32)
00375     WIN32_FIND_DATA filedata;
00376     HWND handle;
00377     struct _stat statbuf;
00378 #else
00379     glob_t globbuf;
00380     struct stat statbuf;
00381     int j;
00382 #endif
00383     int done;
00384     char filter[_MAX_PATH], bspfilter[_MAX_PATH], aasfilter[_MAX_PATH];
00385     char aasfile[_MAX_PATH], buf[_MAX_PATH], foldername[_MAX_PATH];
00386     quakefile_t *qf, *qf2, *files, *bspfiles, *aasfiles;
00387 
00388     strcpy(filter, quakepath);
00389     AppendPathSeperator(filter, sizeof(filter));
00390     strcat(filter, "*");
00391 
00392 #if defined(WIN32)|defined(_WIN32)
00393     handle = FindFirstFile(filter, &filedata);
00394     done = (handle == INVALID_HANDLE_VALUE);
00395     while(!done)
00396     {
00397         _splitpath(filter, foldername, NULL, NULL, NULL);
00398         _splitpath(filter, NULL, &foldername[strlen(foldername)], NULL, NULL);
00399         AppendPathSeperator(foldername, _MAX_PATH);
00400         strcat(foldername, filedata.cFileName);
00401         _stat(foldername, &statbuf);
00402 #else
00403     glob(filter, 0, NULL, &globbuf);
00404     for (j = 0; j < globbuf.gl_pathc; j++)
00405     {
00406         strcpy(foldername, globbuf.gl_pathv[j]);
00407         stat(foldername, &statbuf);
00408 #endif
00409         //if it is a folder
00410         if (statbuf.st_mode & S_IFDIR)
00411         {
00412             //
00413             AppendPathSeperator(foldername, sizeof(foldername));
00414             //get all the bsp files
00415             strcpy(bspfilter, foldername);
00416             strcat(bspfilter, "maps/*.bsp");
00417             files = FindQuakeFiles(bspfilter);
00418             strcpy(bspfilter, foldername);
00419             strcat(bspfilter, "*.pk3/maps/*.bsp");
00420             bspfiles = FindQuakeFiles(bspfilter);
00421             for (qf = bspfiles; qf; qf = qf->next) if (!qf->next) break;
00422             if (qf) qf->next = files;
00423             else bspfiles = files;
00424             //get all the aas files
00425             strcpy(aasfilter, foldername);
00426             strcat(aasfilter, "maps/*.aas");
00427             files = FindQuakeFiles(aasfilter);
00428             strcpy(aasfilter, foldername);
00429             strcat(aasfilter, "*.pk3/maps/*.aas");
00430             aasfiles = FindQuakeFiles(aasfilter);
00431             for (qf = aasfiles; qf; qf = qf->next) if (!qf->next) break;
00432             if (qf) qf->next = files;
00433             else aasfiles = files;
00434             //
00435             for (qf = bspfiles; qf; qf = qf->next)
00436             {
00437                 sprintf(aasfile, "%s/%s", qf->pakfile, qf->origname);
00438                 Log_Print("found %s\n", aasfile);
00439                 strcpy(&aasfile[strlen(aasfile)-strlen(".bsp")], ".aas");
00440                 for (qf2 = aasfiles; qf2; qf2 = qf2->next)
00441                 {
00442                     sprintf(buf, "%s/%s", qf2->pakfile, qf2->origname);
00443                     if (!stricmp(aasfile, buf))
00444                     {
00445                         Log_Print("found %s\n", buf);
00446                         break;
00447                     } //end if
00448                 } //end for
00449             } //end for
00450         } //end if
00451 #if defined(WIN32)|defined(_WIN32)
00452         //find the next file
00453         done = !FindNextFile(handle, &filedata);
00454     } //end while
00455 #else
00456     } //end for
00457     globfree(&globbuf);
00458 #endif
00459 } //end of the function CreateAASFilesForAllBSPFiles

Here is the call graph for this function:

quakefile_t* GetArgumentFiles int  argc,
char *  argv[],
int *  i,
char *  ext
 

Definition at line 466 of file bspc.c.

References argc, argv, FindQuakeFiles(), i, j, quakefile_s::next, quakefile_t, strcpy(), and strlen().

Referenced by main().

00467 {
00468     quakefile_t *qfiles, *lastqf, *qf;
00469     int j;
00470     char buf[1024];
00471 
00472     qfiles = NULL;
00473     lastqf = NULL;
00474     for (; (*i)+1 < argc && argv[(*i)+1][0] != '-'; (*i)++)
00475     {
00476         strcpy(buf, argv[(*i)+1]);
00477         for (j = strlen(buf)-1; j >= strlen(buf)-4; j--)
00478             if (buf[j] == '.') break;
00479         if (j >= strlen(buf)-4)
00480             strcpy(&buf[j+1], ext);
00481         qf = FindQuakeFiles(buf);
00482         if (!qf) continue;
00483         if (lastqf) lastqf->next = qf;
00484         else qfiles = qf;
00485         lastqf = qf;
00486         while(lastqf->next) lastqf = lastqf->next;
00487     } //end for
00488     return qfiles;
00489 } //end of the function GetArgumentFiles

Here is the call graph for this function:

int main int  argc,
char **  argv
 

Definition at line 504 of file bspc.c.

References AAS_CalcReachAndClusters(), AAS_Create(), AAS_FreeMaxAAS(), AAS_InitBotImport(), AAS_InitClustering(), AAS_LoadAASFile(), AAS_Optimize(), AAS_ShowTotals(), AAS_WriteAASFile(), AASOuputFile(), aasworld, access(), AppendPathSeperator(), argc, argv, atoi, BSPC_VERSION, calcgrapplereach, capsule_collision, COMP_AASINFO, COMP_AASOPTIMIZE, COMP_BSP2AAS, COMP_BSP2MAP, COMP_CLUSTER, COMP_REACH, create_aas, CreateAASFilesForAllBSPFiles(), DefaultCfg(), Error(), exit(), ExtractFileBase(), quakefile_s::filename, forcesidesvisible, freetree, GetArgumentFiles(), i, I_FloatTime(), quakefile_s::length, LoadCfgFile(), loadedmaptype, LoadMapFromBSP(), Log_Close(), Log_Open(), Log_Print(), MAX_PATH, myargc, myargv, quakefile_s::next, nobrushmerge, nocsg, noliquids, aas_s::numclusters, numthreads, quakefile_s::offset, optimize, quakefile_s::origname, quakefile_t, strcat(), strcpy(), strlen(), quakefile_s::type, use_nodequeue, verbose, Warning(), and WriteMapFile().

Referenced by alloc_funny_pointers(), jinit_d_main_controller(), make_funny_pointers(), process_data_context_main(), process_data_simple_main(), set_bottom_pointers(), set_wraparound_pointers(), and start_pass_main().

00505 {
00506     int i, comp = 0;
00507     char outputpath[MAX_PATH] = "";
00508     char filename[MAX_PATH] = "unknown";
00509     quakefile_t *qfiles, *qf;
00510     double start_time;
00511 
00512     myargc = argc;
00513     myargv = argv;
00514 
00515     start_time = I_FloatTime();
00516 
00517     Log_Open("bspc.log");       //open a log file
00518     Log_Print("BSPC version "BSPC_VERSION", %s %s\n", __DATE__, __TIME__);
00519 
00520     DefaultCfg();
00521     for (i = 1; i < argc; i++)
00522     {
00523         if (!stricmp(argv[i],"-threads"))
00524         {
00525             if (i + 1 >= argc) {i = 0; break;}
00526             numthreads = atoi(argv[++i]);
00527             Log_Print("threads = %d\n", numthreads);
00528         } //end if
00529         else if (!stricmp(argv[i], "-noverbose"))
00530         {
00531             Log_Print("verbose = false\n");
00532             verbose = false;
00533         } //end else if
00534         else if (!stricmp(argv[i], "-nocsg"))
00535         {
00536             Log_Print("nocsg = true\n");
00537             nocsg = true;
00538         } //end else if
00539         else if (!stricmp(argv[i], "-optimize"))
00540         {
00541             Log_Print("optimize = true\n");
00542             optimize = true;
00543         } //end else if
00544         /*
00545         else if (!stricmp(argv[i],"-glview"))
00546         {
00547             glview = true;
00548         } //end else if
00549         else if (!stricmp(argv[i], "-draw"))
00550         {
00551             Log_Print("drawflag = true\n");
00552             drawflag = true;
00553         } //end else if
00554         else if (!stricmp(argv[i], "-noweld"))
00555         {
00556             Log_Print("noweld = true\n");
00557             noweld = true;
00558         } //end else if
00559         else if (!stricmp(argv[i], "-noshare"))
00560         {
00561             Log_Print("noshare = true\n");
00562             noshare = true;
00563         } //end else if
00564         else if (!stricmp(argv[i], "-notjunc"))
00565         {
00566             Log_Print("notjunc = true\n");
00567             notjunc = true;
00568         } //end else if
00569         else if (!stricmp(argv[i], "-nowater"))
00570         {
00571             Log_Print("nowater = true\n");
00572             nowater = true;
00573         } //end else if
00574         else if (!stricmp(argv[i], "-noprune"))
00575         {
00576             Log_Print("noprune = true\n");
00577             noprune = true;
00578         } //end else if
00579         else if (!stricmp(argv[i], "-nomerge"))
00580         {
00581             Log_Print("nomerge = true\n");
00582             nomerge = true;
00583         } //end else if
00584         else if (!stricmp(argv[i], "-nosubdiv"))
00585         {
00586             Log_Print("nosubdiv = true\n");
00587             nosubdiv = true;
00588         } //end else if
00589         else if (!stricmp(argv[i], "-nodetail"))
00590         {
00591             Log_Print("nodetail = true\n");
00592             nodetail = true;
00593         } //end else if
00594         else if (!stricmp(argv[i], "-fulldetail"))
00595         {
00596             Log_Print("fulldetail = true\n");
00597             fulldetail = true;
00598         } //end else if
00599         else if (!stricmp(argv[i], "-onlyents"))
00600         {
00601             Log_Print("onlyents = true\n");
00602             onlyents = true;
00603         } //end else if
00604         else if (!stricmp(argv[i], "-micro"))
00605         {
00606             if (i + 1 >= argc) {i = 0; break;}
00607             microvolume = atof(argv[++i]);
00608             Log_Print("microvolume = %f\n", microvolume);
00609         } //end else if
00610         else if (!stricmp(argv[i], "-leaktest"))
00611         {
00612             Log_Print("leaktest = true\n");
00613             leaktest = true;
00614         } //end else if
00615         else if (!stricmp(argv[i], "-verboseentities"))
00616         {
00617             Log_Print("verboseentities = true\n");
00618             verboseentities = true;
00619         } //end else if
00620         else if (!stricmp(argv[i], "-chop"))
00621         {
00622             if (i + 1 >= argc) {i = 0; break;}
00623             subdivide_size = atof(argv[++i]);
00624             Log_Print("subdivide_size = %f\n", subdivide_size);
00625         } //end else if
00626         else if (!stricmp (argv[i], "-tmpout"))
00627         {
00628             strcpy (outbase, "/tmp");
00629             Log_Print("temp output\n");
00630         } //end else if
00631         */
00632 #ifdef ME
00633         else if (!stricmp(argv[i], "-freetree"))
00634         {
00635             freetree = true;
00636             Log_Print("freetree = true\n");
00637         } //end else if
00638         else if (!stricmp(argv[i], "-grapplereach"))
00639         {
00640             calcgrapplereach = true;
00641             Log_Print("grapplereach = true\n");
00642         } //end else if
00643         else if (!stricmp(argv[i], "-nobrushmerge"))
00644         {
00645             nobrushmerge = true;
00646             Log_Print("nobrushmerge = true\n");
00647         } //end else if
00648         else if (!stricmp(argv[i], "-noliquids"))
00649         {
00650             noliquids = true;
00651             Log_Print("noliquids = true\n");
00652         } //end else if
00653         else if (!stricmp(argv[i], "-forcesidesvisible"))
00654         {
00655             forcesidesvisible = true;
00656             Log_Print("forcesidesvisible = true\n");
00657         } //end else if
00658         else if (!stricmp(argv[i], "-output"))
00659         {
00660             if (i + 1 >= argc) {i = 0; break;}
00661             if (access(argv[i+1], 0x04)) Warning("the folder %s does not exist", argv[i+1]);
00662             strcpy(outputpath, argv[++i]);
00663         } //end else if
00664         else if (!stricmp(argv[i], "-breadthfirst"))
00665         {
00666             use_nodequeue = true;
00667             Log_Print("breadthfirst = true\n");
00668         } //end else if
00669         else if (!stricmp(argv[i], "-capsule"))
00670         {
00671             capsule_collision = true;
00672             Log_Print("capsule_collision = true\n");
00673         } //end else if
00674         else if (!stricmp(argv[i], "-cfg"))
00675         {
00676             if (i + 1 >= argc) {i = 0; break;}
00677             if (!LoadCfgFile(argv[++i]))
00678                 exit(0);
00679         } //end else if
00680         else if (!stricmp(argv[i], "-bsp2map"))
00681         {
00682             if (i + 1 >= argc) {i = 0; break;}
00683             comp = COMP_BSP2MAP;
00684             qfiles = GetArgumentFiles(argc, argv, &i, "bsp");
00685         } //end else if
00686         else if (!stricmp(argv[i], "-bsp2aas"))
00687         {
00688             if (i + 1 >= argc) {i = 0; break;}
00689             comp = COMP_BSP2AAS;
00690             qfiles = GetArgumentFiles(argc, argv, &i, "bsp");
00691         } //end else if
00692         else if (!stricmp(argv[i], "-aasall"))
00693         {
00694             if (i + 1 >= argc) {i = 0; break;}
00695             CreateAASFilesForAllBSPFiles(argv[++i]);
00696         } //end else if
00697         else if (!stricmp(argv[i], "-reach"))
00698         {
00699             if (i + 1 >= argc) {i = 0; break;}
00700             comp = COMP_REACH;
00701             qfiles = GetArgumentFiles(argc, argv, &i, "bsp");
00702         } //end else if
00703         else if (!stricmp(argv[i], "-cluster"))
00704         {
00705             if (i + 1 >= argc) {i = 0; break;}
00706             comp = COMP_CLUSTER;
00707             qfiles = GetArgumentFiles(argc, argv, &i, "bsp");
00708         } //end else if
00709         else if (!stricmp(argv[i], "-aasinfo"))
00710         {
00711             if (i + 1 >= argc) {i = 0; break;}
00712             comp = COMP_AASINFO;
00713             qfiles = GetArgumentFiles(argc, argv, &i, "aas");
00714         } //end else if
00715         else if (!stricmp(argv[i], "-aasopt"))
00716         {
00717             if (i + 1 >= argc) {i = 0; break;}
00718             comp = COMP_AASOPTIMIZE;
00719             qfiles = GetArgumentFiles(argc, argv, &i, "aas");
00720         } //end else if
00721 #endif //ME
00722         else
00723         {
00724             Log_Print("unknown parameter %s\n", argv[i]);
00725             break;
00726         } //end else
00727     } //end for
00728 
00729     //if there are parameters and there's no mismatch in one of the parameters
00730     if (argc > 1 && i == argc)
00731     {
00732         switch(comp)
00733         {
00734             case COMP_BSP2MAP:
00735             {
00736                 if (!qfiles) Log_Print("no files found\n");
00737                 for (qf = qfiles; qf; qf = qf->next)
00738                 {
00739                     //copy the output path
00740                     strcpy(filename, outputpath);
00741                     //append the bsp file base
00742                     AppendPathSeperator(filename, MAX_PATH);
00743                     ExtractFileBase(qf->origname, &filename[strlen(filename)]);
00744                     //append .map
00745                     strcat(filename, ".map");
00746                     //
00747                     Log_Print("bsp2map: %s to %s\n", qf->origname, filename);
00748                     if (qf->type != QFILETYPE_BSP) Warning("%s is probably not a BSP file\n", qf->origname);
00749                     //
00750                     LoadMapFromBSP(qf);
00751                     //write the map file
00752                     WriteMapFile(filename);
00753                 } //end for
00754                 break;
00755             } //end case
00756             case COMP_BSP2AAS:
00757             {
00758                 if (!qfiles) Log_Print("no files found\n");
00759                 for (qf = qfiles; qf; qf = qf->next)
00760                 {
00761                     AASOuputFile(qf, outputpath, filename);
00762                     //
00763                     Log_Print("bsp2aas: %s to %s\n", qf->origname, filename);
00764                     if (qf->type != QFILETYPE_BSP) Warning("%s is probably not a BSP file\n", qf->origname);
00765                     //set before map loading
00766                     create_aas = 1;
00767                     LoadMapFromBSP(qf);
00768                     //create the AAS file
00769                     AAS_Create(filename);
00770                     //if it's a Quake3 map calculate the reachabilities and clusters
00771                     if (loadedmaptype == MAPTYPE_QUAKE3) AAS_CalcReachAndClusters(qf);
00772                     //
00773                     if (optimize) AAS_Optimize();
00774                     //
00775                     //write out the stored AAS file
00776                     if (!AAS_WriteAASFile(filename))
00777                     {
00778                         Error("error writing %s\n", filename);
00779                     } //end if
00780                     //deallocate memory
00781                     AAS_FreeMaxAAS();
00782                 } //end for
00783                 break;
00784             } //end case
00785             case COMP_REACH:
00786             {
00787                 if (!qfiles) Log_Print("no files found\n");
00788                 for (qf = qfiles; qf; qf = qf->next)
00789                 {
00790                     AASOuputFile(qf, outputpath, filename);
00791                     //
00792                     Log_Print("reach: %s to %s\n", qf->origname, filename);
00793                     if (qf->type != QFILETYPE_BSP) Warning("%s is probably not a BSP file\n", qf->origname);
00794                     //if the AAS file exists in the output directory
00795                     if (!access(filename, 0x04))
00796                     {
00797                         if (!AAS_LoadAASFile(filename, 0, 0))
00798                         {
00799                             Error("error loading aas file %s\n", filename);
00800                         } //end if
00801                         //assume it's a Quake3 BSP file
00802                         loadedmaptype = MAPTYPE_QUAKE3;
00803                     } //end if
00804                     else
00805                     {
00806                         Warning("AAS file %s not found in output folder\n", filename);
00807                         Log_Print("creating %s...\n", filename);
00808                         //set before map loading
00809                         create_aas = 1;
00810                         LoadMapFromBSP(qf);
00811                         //create the AAS file
00812                         AAS_Create(filename);
00813                     } //end else
00814                     //if it's a Quake3 map calculate the reachabilities and clusters
00815                     if (loadedmaptype == MAPTYPE_QUAKE3)
00816                     {
00817                         AAS_CalcReachAndClusters(qf);
00818                     } //end if
00819                     //
00820                     if (optimize) AAS_Optimize();
00821                     //write out the stored AAS file
00822                     if (!AAS_WriteAASFile(filename))
00823                     {
00824                         Error("error writing %s\n", filename);
00825                     } //end if
00826                     //deallocate memory
00827                     AAS_FreeMaxAAS();
00828                 } //end for
00829                 break;
00830             } //end case
00831             case COMP_CLUSTER:
00832             {
00833                 if (!qfiles) Log_Print("no files found\n");
00834                 for (qf = qfiles; qf; qf = qf->next)
00835                 {
00836                     AASOuputFile(qf, outputpath, filename);
00837                     //
00838                     Log_Print("cluster: %s to %s\n", qf->origname, filename);
00839                     if (qf->type != QFILETYPE_BSP) Warning("%s is probably not a BSP file\n", qf->origname);
00840                     //if the AAS file exists in the output directory
00841                     if (!access(filename, 0x04))
00842                     {
00843                         if (!AAS_LoadAASFile(filename, 0, 0))
00844                         {
00845                             Error("error loading aas file %s\n", filename);
00846                         } //end if
00847                         //assume it's a Quake3 BSP file
00848                         loadedmaptype = MAPTYPE_QUAKE3;
00849                         //if it's a Quake3 map calculate the clusters
00850                         if (loadedmaptype == MAPTYPE_QUAKE3)
00851                         {
00852                             aasworld.numclusters = 0;
00853                             AAS_InitBotImport();
00854                             AAS_InitClustering();
00855                         } //end if
00856                     } //end if
00857                     else
00858                     {
00859                         Warning("AAS file %s not found in output folder\n", filename);
00860                         Log_Print("creating %s...\n", filename);
00861                         //set before map loading
00862                         create_aas = 1;
00863                         LoadMapFromBSP(qf);
00864                         //create the AAS file
00865                         AAS_Create(filename);
00866                         //if it's a Quake3 map calculate the reachabilities and clusters
00867                         if (loadedmaptype == MAPTYPE_QUAKE3) AAS_CalcReachAndClusters(qf);
00868                     } //end else
00869                     //
00870                     if (optimize) AAS_Optimize();
00871                     //write out the stored AAS file
00872                     if (!AAS_WriteAASFile(filename))
00873                     {
00874                         Error("error writing %s\n", filename);
00875                     } //end if
00876                     //deallocate memory
00877                     AAS_FreeMaxAAS();
00878                 } //end for
00879                 break;
00880             } //end case
00881             case COMP_AASOPTIMIZE:
00882             {
00883                 if (!qfiles) Log_Print("no files found\n");
00884                 for (qf = qfiles; qf; qf = qf->next)
00885                 {
00886                     AASOuputFile(qf, outputpath, filename);
00887                     //
00888                     Log_Print("optimizing: %s to %s\n", qf->origname, filename);
00889                     if (qf->type != QFILETYPE_AAS) Warning("%s is probably not a AAS file\n", qf->origname);
00890                     //
00891                     AAS_InitBotImport();
00892                     //
00893                     if (!AAS_LoadAASFile(qf->filename, qf->offset, qf->length))
00894                     {
00895                         Error("error loading aas file %s\n", qf->filename);
00896                     } //end if
00897                     AAS_Optimize();
00898                     //write out the stored AAS file
00899                     if (!AAS_WriteAASFile(filename))
00900                     {
00901                         Error("error writing %s\n", filename);
00902                     } //end if
00903                     //deallocate memory
00904                     AAS_FreeMaxAAS();
00905                 } //end for
00906                 break;
00907             } //end case
00908             case COMP_AASINFO:
00909             {
00910                 if (!qfiles) Log_Print("no files found\n");
00911                 for (qf = qfiles; qf; qf = qf->next)
00912                 {
00913                     AASOuputFile(qf, outputpath, filename);
00914                     //
00915                     Log_Print("aas info for: %s\n", filename);
00916                     if (qf->type != QFILETYPE_AAS) Warning("%s is probably not a AAS file\n", qf->origname);
00917                     //
00918                     AAS_InitBotImport();
00919                     //
00920                     if (!AAS_LoadAASFile(qf->filename, qf->offset, qf->length))
00921                     {
00922                         Error("error loading aas file %s\n", qf->filename);
00923                     } //end if
00924                     AAS_ShowTotals();
00925                 } //end for
00926             } //end case
00927             default:
00928             {
00929                 Log_Print("don't know what to do\n");
00930                 break;
00931             } //end default
00932         } //end switch
00933     } //end if
00934     else
00935     {
00936         Log_Print("Usage:   bspc [-<switch> [-<switch> ...]]\n"
00937 #if defined(WIN32) || defined(_WIN32)
00938             "Example 1: bspc -bsp2aas d:\\quake3\\baseq3\\maps\\mymap?.bsp\n"
00939             "Example 2: bspc -bsp2aas d:\\quake3\\baseq3\\pak0.pk3\\maps/q3dm*.bsp\n"
00940 #else
00941             "Example 1: bspc -bsp2aas /quake3/baseq3/maps/mymap?.bsp\n"
00942             "Example 2: bspc -bsp2aas /quake3/baseq3/pak0.pk3/maps/q3dm*.bsp\n"
00943 #endif
00944             "\n"
00945             "Switches:\n"
00946             //"   bsp2map  <[pakfilter/]filter.bsp>    = convert BSP to MAP\n"
00947             //"   aasall   <quake3folder>              = create AAS files for all BSPs\n"
00948             "   bsp2aas  <[pakfilter/]filter.bsp>    = convert BSP to AAS\n"
00949             "   reach    <filter.bsp>                = compute reachability & clusters\n"
00950             "   cluster  <filter.aas>                = compute clusters\n"
00951             "   aasopt   <filter.aas>                = optimize aas file\n"
00952             "   aasinfo  <filter.aas>                = show AAS file info\n"
00953             "   output   <output path>               = set output path\n"
00954             "   threads  <X>                         = set number of threads to X\n"
00955             "   cfg      <filename>                  = use this cfg file\n"
00956             "   optimize                             = enable optimization\n"
00957             "   noverbose                            = disable verbose output\n"
00958             "   breadthfirst                         = breadth first bsp building\n"
00959             "   nobrushmerge                         = don't merge brushes\n"
00960             "   noliquids                            = don't write liquids to map\n"
00961             "   freetree                             = free the bsp tree\n"
00962             "   nocsg                                = disables brush chopping\n"
00963             "   forcesidesvisible                    = force all sides to be visible\n"
00964             "   grapplereach                         = calculate grapple reachabilities\n"
00965 
00966 /*          "   glview     = output a GL view\n"
00967             "   draw       = enables drawing\n"
00968             "   noweld     = disables weld\n"
00969             "   noshare    = disables sharing\n"
00970             "   notjunc    = disables juncs\n"
00971             "   nowater    = disables water brushes\n"
00972             "   noprune    = disables node prunes\n"
00973             "   nomerge    = disables face merging\n"
00974             "   nosubdiv   = disables subdeviding\n"
00975             "   nodetail   = disables detail brushes\n"
00976             "   fulldetail = enables full detail\n"
00977             "   onlyents   = only compile entities with bsp\n"
00978             "   micro <volume>\n"
00979             "              = sets the micro volume to the given float\n"
00980             "   leaktest   = perform a leak test\n"
00981             "   verboseentities\n"
00982             "              = enable entity verbose mode\n"
00983             "   chop <subdivide_size>\n"
00984             "              = sets the subdivide size to the given float\n"*/
00985             "\n");
00986     } //end else
00987     Log_Print("BSPC run time is %5.0f seconds\n", I_FloatTime() - start_time);
00988     Log_Close();                        //close the log file
00989     return 0;
00990 } //end of the function main

Here is the call graph for this function:


Variable Documentation

aas_settings_t aassettings
 

Definition at line 54 of file bspc.c.

int calcgrapplereach
 

Definition at line 85 of file be_aas_reach.c.

Referenced by AAS_InitReachability(), and main().

qboolean cancelconversion
 

Definition at line 75 of file bspc.c.

qboolean capsule_collision = 0
 

Definition at line 78 of file bspc.c.

qboolean create_aas
 

Definition at line 72 of file bspc.c.

Referenced by main().

int entity_num
 

Definition at line 53 of file bspc.c.

Referenced by AAS_Create(), AddTriangleModels(), and ProcessModels().

qboolean forcesidesvisible
 

Definition at line 77 of file bspc.c.

Referenced by main().

qboolean freetree
 

Definition at line 71 of file bspc.c.

Referenced by main().

qboolean fulldetail
 

Definition at line 59 of file bspc.c.

Referenced by main().

qboolean glview
 

Definition at line 57 of file bspc.c.

Referenced by main(), OutputPortal(), OutputWinding(), WriteGLView(), and WriteGLView_r().

qboolean leaktest
 

Definition at line 69 of file bspc.c.

Referenced by main().

qboolean lessbrushes
 

Definition at line 74 of file bspc.c.

vec_t microvolume = 1.0
 

Definition at line 51 of file bspc.c.

Referenced by main().

char name[1024]
 

Definition at line 50 of file bspc.c.

Referenced by AAS_ShowNumReachabilities(), AddPakDir(), idCameraDef::addTarget(), afunction(), ASE_GetSurfaceAnimation(), ASE_KeyGEOMOBJECT(), BindingIDFromName(), BotAddressedToBot(), BotAISetupClient(), BotChat_Death(), BotChat_EndLevel(), BotChat_EnemySuicide(), BotChat_EnterGame(), BotChat_ExitGame(), BotChat_HitNoDeath(), BotChat_HitNoKill(), BotChat_HitTalking(), BotChat_Kill(), BotChat_Random(), BotChat_StartLevel(), BotChatTest(), BotCreateGroup(), BotCreateWayPoint(), BotCTFOrders_BothFlagsAtBase(), BotCTFOrders_BothFlagsNotAtBase(), BotCTFOrders_EnemyFlagNotAtBase(), BotCTFOrders_FlagNotAtBase(), BotDeathmatchAI(), BotDumpAvoidGoals(), BotDumpGoalStack(), BotFindWayPoint(), BotFirstClientInRankings(), BotGetLevelItemGoal(), BotGetMapLocationGoal(), BotGetTeamMateTaskPreference(), BotGoalName(), BotLastClientInRankings(), BotNearestVisibleItem(), BotRandomOpponentName(), BotSayTeamOrderAlways(), BotSetChatName(), BotSetTeamMateTaskPreference(), CG_DrawAttacker(), CG_DrawCrosshairNames(), CG_DrawFollow(), CG_DrawWeaponSelect(), CG_HeadModelVoiceChats(), CG_RegisterGraphics(), CG_RegisterSounds(), CG_VoiceChatListForClient(), CIN_PlayCinematic(), CL_PlayDemo_f(), CL_Record_f(), CL_SetModel_f(), CL_WalkDemoExt(), idCameraDef::clear(), ClientFromName(), ClientName(), ClientOnSameTeamFromName(), CM_LoadMap(), Cmd_Give_f(), COM_BeginParseSession(), Com_Filter(), Com_FilterPath(), Controls_DrawKeyBinding(), Controls_GetCvarDefault(), Controls_GetCvarValue(), CreateEntityLights(), DrawBrushEntityName(), DumpPACKDirectory(), EasyClientName(), Eclass_ForName(), emitSymbol(), exists(), fieldref(), filename(), FindChunk(), FindClientByName(), FindEnemyByName(), FindField(), FindFuzzyWeight(), FindMiptex(), FindNextChunk(), FindPakDir(), FindQuakeFilesInPak(), FS_AddFileToList(), FS_FOpenFileAppend(), FS_FOpenFileRead(), FS_FOpenFileWrite(), FS_GetModList(), FS_ListFilteredFiles(), FS_LoadZipFile(), FS_Path_f(), FS_SV_FOpenFileRead(), FS_SV_FOpenFileWrite(), G_AddBot(), G_FindConfigstringIndex(), G_GetBotInfoByName(), G_ItemDisabled(), G_ModelIndex(), G_Say(), G_SayTo(), G_SoundIndex(), gather(), idCameraDef::getName(), idSplineList::getName(), GetPackTextureDirs(), GL_TextureMode(), GLW_LoadOpenGL(), Group_Alloc(), Group_ForName(), h(), HL_TextureContents(), idSplineList::idSplineList(), IN_StartupJoystick(), InsertASEModel(), install(), Item_RunScript(), LAN_AddServer(), Load256Image(), Load32BitImage(), LoadBMP(), loadCamera(), LoadImage(), LoadPortals(), LoadScriptMemory(), LoadSourceMemory(), LoadTGA(), logGetString(), logLoadName(), logPushName(), lookup(), main(), Menu_GetMatchingItemByNumber(), Menu_ItemsMatchingGroup(), Menu_SetFeederSelection(), mksymbol(), NameToDstBlendMode(), NameToSrcBlendMode(), newfield(), OnlyEnts(), OnlyTextures(), openfile(), OpenPakFile(), PakLoadAnyFile(), ParseRawBrush(), ParseShaderFile(), ParseSurfaceParm(), PC_FindDefine(), PC_FindDefineParm(), PC_FindHashedDefine(), PC_NameHash(), PC_ReadDirective(), PC_ReadDollarDirective(), PC_RemoveGlobalDefine(), PlayerSettings_DrawName(), Pointfile_Check(), Pointfile_Delete(), Prepname(), print(), PrintContents(), prtype(), Q1_TextureContents(), QERApp_GetTexture(), QERApp_Texture_ForName(), QERApp_TryTextureForName(), qglGetString(), qglLoadName(), qglPushName(), qwglGetProcAddress(), R_CreateImage(), R_FindImageFile(), R_FindShader(), R_FindShaderByName(), R_LoadImage(), R_TakeScreenshot(), RandomString(), RE_LoadWorldMap(), RE_RegisterFont(), RE_RegisterModel(), RE_RegisterShader(), RE_RegisterShaderFromImage(), RE_RegisterShaderLightMap(), RE_RegisterShaderNoMip(), RE_RegisterSkin(), ReadPACKDirectory(), relocate(), RunBsp(), S_FindName(), S_FindWavChunk(), S_HashSFXName(), S_Play_f(), S_RegisterSound(), S_StartBackgroundTrack(), Save256Image(), ScaleWeight(), Script_Close(), Script_FadeIn(), Script_FadeOut(), Script_Hide(), Script_Open(), Script_Orbit(), Script_SetAsset(), Script_SetBackground(), Script_SetColor(), Script_SetFocus(), Script_SetItemColor(), Script_SetPlayerHead(), Script_SetPlayerModel(), Script_Show(), Script_Transition(), idCameraDef::setActiveTargetByName(), SetCfgLibVars(), texdef_t::SetName(), idCameraDef::setName(), idSplineList::setName(), Spk_Open(), suffix(), SV_MasterHeartbeat(), SV_RankUserValidate(), SV_SetBrushModel(), Svcmd_AddBot_f(), Svcmd_BotList_f(), Sys_LoadDll(), Sys_PrintBinVersion(), Sys_ProcessorCount(), tempname(), Terrain_HasTexture(), Terrain_ParseFace(), TestExpandBrushes(), texdef_t::texdef_t(), Texture_CreateSolid(), Texture_Draw2(), Texture_ForName(), Texture_ForNamePath(),