示例#1
0
/*
=================
ProcessFile

=================
*/
void ProcessFile (char *sourcebase, char *bspfilename1)
{
// create filenames
	strcpy (bspfilename, bspfilename1);
	StripExtension (bspfilename);
	strcat (bspfilename, ".bsp");

	strcpy (hullfilename, bspfilename1);
	StripExtension (hullfilename);
	strcat (hullfilename, ".h0");

	strcpy (portfilename, bspfilename1);
	StripExtension (portfilename);
	strcat (portfilename, ".prt");
	
	strcpy (pointfilename, bspfilename1);
	StripExtension (pointfilename);
	strcat (pointfilename, ".pts");

	if (!onlyents)
	{
		remove (bspfilename);
		if (!usehulls)
		{
			hullfilename[strlen(hullfilename)-1] = '1';
			remove (hullfilename);
			hullfilename[strlen(hullfilename)-1] = '2';
			remove (hullfilename);
		}
		remove (portfilename);
		remove (pointfilename);
	}
	
// load brushes and entities
	LoadMapFile (sourcebase);
	if (onlyents)
	{
		UpdateEntLump ();
		return;
	}
	
// init the tables to be shared by all models
	BeginBSPFile ();

// the clipping hulls will be written out to text files by forked processes
	CreateHulls ();

	ReadClipHull (1);
	ReadClipHull (2);

	WriteEntitiesToString();
	FinishBSPFile ();
}
示例#2
0
/*
=================
ProcessFile

=================
*/
static void ProcessFile (char *sourcebase, char *bspfilename1)
{
    int		i;
//	FILE	*FH;
//	char	radfilename[1024];

    // create filenames
    strcpy (bspfilename, bspfilename1);
    StripExtension (bspfilename);
    strcat (bspfilename, ".bsp");

    strcpy (hullfilename, bspfilename1);
    StripExtension (hullfilename);
    strcat (hullfilename, ".h0");

    strcpy (portfilename, bspfilename1);
    StripExtension (portfilename);
    strcat (portfilename, ".prt");

    strcpy (pointfilename, bspfilename1);
    StripExtension (pointfilename);
    strcat (pointfilename, ".pts");

    if (!onlyents)
    {
        remove (bspfilename);
        if (!usehulls && hullnum == 0)
        {
            hullfilename[strlen(hullfilename)-1] = '1';
            remove (hullfilename);
            hullfilename[strlen(hullfilename)-1] = '2';
            remove (hullfilename);
            hullfilename[strlen(hullfilename)-1] = '3';
            remove (hullfilename);
            hullfilename[strlen(hullfilename)-1] = '4';
            remove (hullfilename);
            hullfilename[strlen(hullfilename)-1] = '5';
            remove (hullfilename);
        }
        remove (portfilename);
        remove (pointfilename);
    }

// load brushes and entities
    LoadMapFile (sourcebase);
    if (onlyents)
    {
        UpdateEntLump ();
        return;
    }

// init the tables to be shared by all models
    BeginBSPFile ();

    for (i = 0 ; i < MAX_MAP_CLIPNODES ; i++)
        LightValues[i] = -2;

// the clipping hulls will be written out to text files by forked processes
    CreateHulls ();

    ReadClipHull (1);
    ReadClipHull (2);
    ReadClipHull (3);
    ReadClipHull (4);
    ReadClipHull (5);

    WriteEntitiesToString();
    FinishBSPFile ();

    /*	strcpy (radfilename, bspfilename1);
    	StripExtension (radfilename);
    	strcat (radfilename, ".rad");

    	FH = fopen(radfilename,"w");
    	for (i = 0 ; i < numfaces ; i++)
    		fprintf(FH,"%d\n",LightValues[i]);
    	fclose(FH);
    */
}