/*
 * ==================
 * main
 * light modelfile
 * ==================
 */
int
main(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
	WriteBSPFile(source, bsp_version);

    if (colored && litfile)
	WriteLitFile(source, LIT_VERSION);

    end = I_FloatTime();
    logprint("%5.1f seconds elapsed\n", end - start);

    close_log();

    return 0;
}
Beispiel #2
0
/*
========
main

light modelfile
========
*/
int main (int argc, char **argv)
{
	int		i;
	double		start, end;
	char		source[1024];

	printf ("----- LightFaces ----\n");

	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;
			printf ("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 (argv[i][0] == '-')
			Error ("Unknown option \"%s\"", argv[i]);
		else
			break;
	}

	if (i != argc - 1)
		Error ("usage: light [-threads num] [-extra] bspfile");

	InitThreads ();

	start = I_FloatTime ();

	strcpy (source, argv[i]);
	StripExtension (source);
	DefaultExtension (source, ".bsp");
	
	LoadBSPFile (source);
	LoadEntities ();
		
	MakeTnodes (&dmodels[0]);

	LightWorld ();

	WriteEntitiesToString ();	
	WriteBSPFile (source);

	end = I_FloatTime ();
	printf ("%5.1f seconds elapsed\n", end-start);
	
	return 0;
}
Beispiel #3
0
/*
========
Light_Main

light modelfile
========
*/
int Light_Main( int argc, char **argv )
{
	double start, end;
	int i;

	extrasamplesbit = 0;
	lightvis = true;
	relight = false;
	globallightscale = 1.0;
	globallightradiusscale = 1.0;
	minlight = 0;
	ambientlight = 0;
	defaultlighttype = LIGHTTYPE_MINUSX;
	overridelighttypes = false;

	for( i = 1; i < argc; i++ ) {
		if( !strcmp( argv[i],"-extra" ) ) {
			extrasamplesbit = 1;
			printf( "2x2 sampling enabled (tip: -extra4x4 is even higher quality)\n" );
		} else if( !strcmp( argv[i],"-extra4x4" ) ) {
			extrasamplesbit = 2;
			printf( "4x4 sampling enabled\n" );
		} else if( !strcmp( argv[i],"-extra8x8" ) ) {
			extrasamplesbit = 3;
			printf( "8x8 sampling enabled\n" );
		} else if( !strcmp( argv[i],"-nolightvis" ) ) {
			printf( "use of vis data to optimize lighting disabled\n" );
			lightvis = false;
		} else if( !strcmp( argv[i],"-relight" ) ) {
			if (ismcbsp)
				printf( "-relight is not valid with Martial Concert bsp format, ignoring\n" );
			else
			{
				printf( "relighting map to create .lit file without modifying .bsp\n" );
				relight = true;
			}
		} else if( !strcmp( argv[i],"-intensity" ) ) {
			i++;
			if( i >= argc )
				Error( "no value was given to -intensity\n" );
			globallightscale = atof( argv[i] );
			if( globallightscale < 0.01 )
				globallightscale = 0.01;
		} else if( !strcmp( argv[i],"-radiusscale" ) ) {
			i++;
			if( i >= argc )
				Error( "no value was given to -radiusscale\n" );
			globallightradiusscale = atof( argv[i] );
			if( globallightradiusscale < 0.01 )
				globallightradiusscale = 0.01;
		} else if( !strcmp( argv[i],"-minlight" ) ) {
			i++;
			if( i >= argc )
				Error( "no value was given to -minlight\n" );
			minlight = atof( argv[i] );
			if( minlight < 0 )
				minlight = 0;
		} else if( !strcmp( argv[i], "-ambientlight" ) ) {
			i++;
			if( i >= argc )
				Error( "no value was given to -ambientlight\n" );
			ambientlight = atof( argv[i] );
			if( ambientlight < 0 )
				ambientlight = 0;
		} else if( !strcmp( argv[i],"-defaulttype" ) ) {
			i++;
			if( i >= argc )
				Error( "no value was given to -defaulttype\n" );
			defaultlighttype = atoi( argv[i] );
			if( defaultlighttype < 0 || defaultlighttype >= LIGHTTYPE_TOTAL )
				Error( "invalid value given to -defaulttype\n" );
		} else if( !strcmp( argv[i],"-overridetypes" ) ) {
			printf( "overriding all light types with current default\n" );
			overridelighttypes = true;
		}
		else if( !strcmp( argv[i],"-harshshade" ) )
		{
			harshshade = 1;
			printf( "harsh shading enabled\n" );
		}
		else if( argv[i][0] == '-' )
			Error( "Unknown option \"%s\"", argv[i] );
		else
			break;
	}

	extrasamplesscale = 1.0f / (1 << (extrasamplesbit * 2));

	if( i != argc - 1 )
		Error( "%s",
"usage: hmap2 [-mc] -light [options] bspfile\n"
"Compiles lighting data in a .bsp and also makes .lit colored lighting data\n"
"\n"
"Quick usage notes for entities: (place these in key/value pairs)\n"
"wait - falloff rate: 1.0 default, 0.5 = double radius, 2 = half radius\n"
"_color - red green blue, specifies color of light, example 1 0.6 0.3 is orange\n"
"_lightradius - forces light to be this radius (useful with 1/ types)\n"
"delay - light type: (x = distance of surface from light, r = radius)\n"
"0: 1-(x/r)    fast, quake lighting, the default, tyrlite compatible\n"
"1: 1/(x)      slow, tyrlite compatible\n"
"2: 1/(x*x)    slow, realistic, tyrlite compatible\n"
"3: 1          fast, no fade, useful for sky lights, tyrlite compatible\n"
"4: sun        slow, directional sunlight, uses target direction like spotlights\n"
"5: 1-x/r*x/r  fast, looks like darkplaces/tenebrae lights\n"
"\n"
"-mc           uses \"Martial Concert\" format bsp\n"
"\n"
"What the options do:\n"
"-extra        antialiased lighting, takes much longer, higher quality\n"
"-extra4x4     antialiased lighting, even slower and better than -extra\n"
"-extra8x8     antialiased lighting, even slower and better than -extra4x4\n"
"-nolightvis   disables use of visibility data to optimize lighting\n"
"-relight      make a .lit file for an existing .bsp without modifying the .bsp\n"
"-harshshade   harsh shading rather than the normal soft shading\n"
"Options from here on are incompatible with darkplaces realtime lighting mode\n"
"(it does not know if these options are used, and will require manual rtlights\n"
" editing to look good)\n"
"-intensity    scales brightness of all lights\n"
"-radiusscale  scales size of all lights (including 1/ types)\n"
"-defaulttype <number> sets default light type by number, see delay above\n"
"-overridetypes forces all lights to use the -defaulttype setting\n"
"-minlight     raises darkest areas of the map to this light level (0-255)\n"
"-ambientlight raises all of the map by this light level (0-255)\n"
		);

	// init memory
	Q_InitMem ();

	printf( "----- LightFaces ----\n" );

//	InitThreads ();

	start = I_DoubleTime ();

	LoadBSPFile( filename_bsp );

	memset( dlightdata, 0, sizeof( dlightdata ) );
	memset( drgblightdata, 0, sizeof( drgblightdata ) );

	if( !visdatasize ) {
		printf( "no visibility data found (run -vis before -light to compile faster)\n" );
		lightvis = false;
	}

	ParseEntities ();
	printf( "%i entities read\n", num_entities );

	ParseLightEntities ();

	LightWorld ();

#ifdef WRITE_LIGHTSFILE
	WriteLights ();
#endif

	UnparseEntities ();

	WriteBSPFile( filename_bsp, relight );

	end = I_DoubleTime ();
	printf( "%5.2f seconds elapsed\n\n", end - start );

	// print memory stats
	Q_PrintMem ();

#if _MSC_VER && _DEBUG
	printf( "press any key\n" );
	getchar();
#endif

	// free allocated memory
	Q_ShutdownMem ();

	return 0;
}
Beispiel #4
0
/*
========
main

light modelfile
========
*/
int main (int argc, char **argv)
{
	int		i;
	int		wantthreads;
	double		start, end;
	char		source[1024];

	printf ("----- LightFaces ----\n");

	ValidateByteorder ();

	wantthreads = 1;	// default to single threaded

	for (i = 1 ; i < argc ; i++)
	{
		if (!strcmp(argv[i],"-threads"))
		{
			if (i >= argc - 1)
				COM_Error("Missing argument to \"%s\"", argv[i]);
			wantthreads = atoi (argv[++i]);
		}
		else if (!strcmp(argv[i],"-extra"))
		{
			extrasamples = true;
			printf ("extra sampling enabled\n");
		}
		else if (!strcmp(argv[i],"-dist"))
		{
			if (i >= argc - 1)
				COM_Error("Missing argument to \"%s\"", argv[i]);
			scaledist = (float)atof (argv[++i]);
		}
		else if (!strcmp(argv[i],"-range"))
		{
			if (i >= argc - 1)
				COM_Error("Missing argument to \"%s\"", argv[i]);
			rangescale = (float)atof (argv[++i]);
		}
		else if (argv[i][0] == '-')
			COM_Error ("Unknown option \"%s\"", argv[i]);
		else
			break;
	}

	if (i != argc - 1)
		COM_Error ("usage: light [-threads num] [-extra] [-dist ?] [-range ?] bspfile");

	InitThreads (wantthreads, 0);

	start = COM_GetTime ();

	strcpy (source, argv[i]);
	StripExtension (source);
	DefaultExtension (source, ".bsp", sizeof(source));

	LoadBSPFile (source);
	LoadEntities ();

	MakeTnodes (&dmodels[0]);

	LightWorld ();

	WriteEntitiesToString ();
	WriteBSPFile (source);

	end = COM_GetTime ();
	printf ("%5.1f seconds elapsed\n", end-start);

	return 0;
}
Beispiel #5
0
/*
========
main

light modelfile
========
*/
int main (int argc, char **argv)
{
	int		i;
	double		start, end;
	char		source[1024];

	printf("Light.exe Version 1.3 Id Software and valve (%s)\n", __DATE__ );
	printf ("----- LightFaces ----\n");

	// default to 24-bit light info
	hicolor = true;

	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;
			printf ("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],"-lowcolor"))
		{
			hicolor = false;
		}
		else if (!strcmp( argv[ i ], "-noclamp" ) )
		{
			clamp192 = false;
		}
		else if (argv[i][0] == '-')
			Error ("Unknown option \"%s\"", argv[i]);
		else
			break;
	}

	if (i != argc - 1)
		Error ("usage: light [-threads num] [-extra] [-lowcolor] bspfile");

	ThreadSetDefault ();

	start = I_FloatTime ();

	strcpy (source, argv[i]);
	StripExtension (source);
	DefaultExtension (source, ".bsp");
	
	LoadBSPFile (source);
	LoadEntities ();
		
	MakeTnodes (&dmodels[0]);

	LightWorld ();

	WriteBSPFile (source);

	end = I_FloatTime ();
	printf ("%5.1f seconds elapsed\n", end-start);
	
	return 0;
}
Beispiel #6
0
/*
========
main

light modelfile
========
*/
int main (int argc, char **argv)
{
	int	 i, ModeCnt = 0, Val;
	char	 source[1024], *Option, *NextOption;
	float	 FVal;
	qboolean NoGlobRange = false;

	logfile = fopen (LOGFILENAME, "w");
	logprintf ("----- Light 1.43 ---- Modified by Bengt Jardrup\n");
	logprintf ("----- Release 2  ---- Coloured light and LIT support by MH\n\n");

	for (i = 1; i < argc; i++)
	{
		Option = argv[i];
		NextOption = i + 1 < argc ? argv[i + 1] : NULL;

		if (Option[0] != '-')
			break;

		++Option;

		if (!stricmp (Option, "fast"))
		{
			FastLight = 2;

			if (NextOption != NULL && isdigit (NextOption[0]) && i + 2 < argc)
			{
				Val = atoi (NextOption);
				i++;

				if (Val > 2)
					FastLight = Val;
			}

			logprintf ("Fast light %d enabled\n", FastLight);
		}
		else if (!stricmp (Option, "soft"))
		{
			SoftLight = 0;

			if (NextOption != NULL && isdigit (NextOption[0]) && i + 2 < argc)
			{
				SoftLight = atoi (NextOption);
				i++;
			}
		}
		else if (!stricmp (Option, "softdist"))
		{
			SoftDist = GetArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "extra") || !stricmp (Option, "extra4"))
		{
			OverSample = Option[5] == '4' ? 4 : 2;
			logprintf ("Extra %dx%d sampling enabled\n", OverSample, OverSample);
		}
		else if (!stricmp (Option, "threads"))
		{
			numthreads = GetFloatArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "dist"))
		{
			scaledist = GetFloatArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "range"))
		{
			rangescale = GetFloatArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "globrange"))
		{
			GlobRange = true;
			logprintf ("Global range enabled\n");
		}
		else if (!stricmp (Option, "noglobrange"))
			NoGlobRange = true;
		else if (!stricmp (Option, "light"))
		{
			worldminlight = GetArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "maxlight"))
		{
			worldmaxlight = GetArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "nolight"))
		{
			NoLight = true;
			logprintf ("Light entities disabled\n");
		}
		else if (!stricmp (Option, "srclight"))
		{
			SrcLight = true;
			logprintf ("Unsourced light entities disabled\n");
		}
		else if (!stricmp (Option, "sunlight"))
		{
			SunLight[0] = GetArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "sunlight2"))
		{
			SunLight[1] = GetArgument (Option, NextOption);
			i++;
		}
		else if (!stricmp (Option, "sunlight3"))
		{
			SunLight[1] = GetArgument (Option, NextOption);

			if (ShadowSense == -1)
				ShadowSense = SHADOWSENSE;

			i++;
		}
		else if (!stricmp (Option, "sunmangle"))
		{
			ChkArgument (Option, NextOption);

			if (sscanf (NextOption, "%d,%d", &SunMangleVal[0], &SunMangleVal[1]) != 2)
				Error ("Missing arguments for '%s'", Option);

			SunMangleVal[2] = 0;
			i++;
		}
		else if (!stricmp (Option, "nowarnings"))
			NoWarnings = true;
		else if (!stricmp (Option, "rate"))
		{
			ChkArgument (Option, NextOption);

			if (sscanf (NextOption, "%d,%f,%d,%d", &SecRate, &FVal, &NewLine, &TotTime) > 1)
				PercRate = (FVal + 0.05) * 10; // Fix roundoff

			AutoRate = false;
			i++;
		}
		else if (!stricmp (Option, "barpercent"))
		{
			SimpPercent = true;
			NumPercent = false;
		}
		else if (!stricmp (Option, "numpercent"))
		{
			SimpPercent = true;
			NumPercent = true;
		}
		else if (!stricmp (Option, "oldlight"))
		{
			OldLight = NoAnti = true;
			logprintf ("Oldlight mode enabled\n");
			++ModeCnt;
		}
		else if (!stricmp (Option, "tyrlite"))
		{
			TyrLiteMode = GlobRange = true;
			logprintf ("TyrLite mode enabled\n");
			++ModeCnt;
		}
		else if (!stricmp (Option, "tyrlite95"))
		{
			TyrLite95Mode = TyrLiteMode = GlobRange = true;
			logprintf ("TyrLite95 mode enabled\n");
			++ModeCnt;
		}
		else if (!stricmp (Option, "arghlite"))
		{
			ArghLiteMode = GlobRange = AddMinLight = true;
			logprintf ("ArghLite mode enabled\n");
			++ModeCnt;
		}
		else if (!stricmp (Option, "addmin"))
		{
			AddMinLight = true;
			logprintf ("Additive minlight enabled\n");
		}
		else if (!stricmp (Option, "iklite"))
		{
			IKLiteMode = IKAngle = OldLight = NoAnti = true;
			logprintf ("IKLite mode enabled\n");
			++ModeCnt;
		}
		else if (!stricmp (Option, "ikangle"))
		{
			IKAngle = true;
			logprintf ("IKLite angle sensitivity enabled\n");
		}
		else if (!stricmp (Option, "anglesense"))
		{
			FVal = GetFloatArgument (Option, NextOption);
			i++;

			if (FVal >= 0 && FVal <= 1 && FVal != scalecos)
				logprintf ("Angle sensitivity %g set\n", scalecos = FVal);
		}
		else if (!stricmp (Option, "shadowsense"))
		{
			FVal = GetFloatArgument (Option, NextOption);
			i++;

			if (FVal >= 0 && FVal <= 1)
				ShadowSense = FVal;
		}
		else if (!stricmp (Option, "gate"))
		{
			FVal = GetFloatArgument (Option, NextOption);
			i++;

			if (FVal >= 0 && FVal != GateVal)
				logprintf ("Fade Gate %g set\n", GateVal = FVal);
		}
		else if (!stricmp (Option, "dlx"))
		{
			LightDLXMode = OldLight = true;
			logprintf ("LightDLX mode enabled\n");
			++ModeCnt;
		}
		else if (!stricmp (Option, "kinn"))
		{
			KinnDelay = true;
			logprintf ("Kinn translation enabled\n");
		}
		else if (!stricmp (Option, "solidsky"))
		{
			SolidSky = true;
			logprintf ("Solid sky brushes enabled\n");
		}
		else if (!stricmp (Option, "unsup"))
			UnsupDetails = DetectKeys = true;
		else if (!stricmp (Option, "detect"))
			DetectKeys = true;
		else if (!stricmp (Option, "noskill"))
			NoSkillChk = true;
		else if (!stricmp (Option, "noflash"))
			NoFlash = true;
		else if (!stricmp (Option, "noanti"))
			NoAnti = NoAntiOption = true;
		else if (!stricmp (Option, "lightcap"))
		{
			Val = GetArgument (Option, NextOption);
			i++;

			if (Val >= 0 && Val != LightCap)
				logprintf ("LightCap %d enabled\n", LightCap = Val);
		}
		else if (!stricmp (Option, "onlyents"))
			OnlyEnts = true;
		else if (!stricmp (Option, "nowrite"))
			NoWrite = true;
		else if (!stricmp (Option, "norev"))
			NoReverse = true;
		else if (!stricmp (Option, "etp"))
		{
			EnhancedTP = true;
			logprintf ("Enhanced Texture Positioning enabled\n");
		}
		else if (!stricmp (Option, "priority"))
		{
			SetQPriority (GetArgument (Option, NextOption));
			i++;
		}
		else if (!stricmp (Option, "oldhformat"))
			OldHFormat = true;
		else if (!stricmp (Option, "?") || !stricmp (Option, "help"))
			PrintOptions ();
		else if (!stricmp (Option, "fakeGISun2"))
		{
			FakeGISunlight2 = true;
			logprintf ("Additive sunlight2 enabled\n");
		}
		else if (!stricmp (Option, "fakeGIMode"))
		{
			FakeGIMode = true;
			logprintf ("FakeGI mode enabled\n");
		}
		else
			Error ("Unknown option '%s'", Option);
	}

	if (i != argc - 1)
		PrintOptions ();

	if (GlobRange && NoGlobRange)
	{
		GlobRange = false;
		logprintf ("Global range disabled\n");
	}

	if (ModeCnt > 1)
		Error ("Only one emulation mode allowed");

	if (SoftLight >= 0)
	{
		if (SoftLight == 0)
			SoftLight = OverSample / 2 + 1; // Auto mode

		logprintf ("Soft light %d enabled\n", SoftLight);

		if (SoftDist != SOFTDIST)
			logprintf ("Soft distance %d set\n", SoftDist);
	}

	if (SoftLight > 0)
	{
		// Soft option is in charge
		SingleDist = -SoftDist;
		SkyDist = -SOFTDIST;
	}
	else
	{
		if (TyrLite95Mode)
		{
			SingleDist = 0;
			SkyDist = -ANGLE_EPSILON;
		}
		else
			SingleDist = SkyDist = 1; // Classic (no) soft distance
	}

	if (OverSample <= 2)
	{
		// Set compatibility modes
		GenCompatible = OldLight || TyrLiteMode || ArghLiteMode || IKLiteMode || LightDLXMode;
		ATCompatible = TyrLiteMode || ArghLiteMode;
		TyrCompatible = TyrLiteMode;
	}

	InitThreads ();

	if (!OnlyEnts && !NoWrite)
		start = I_FloatTime ();

	strcpy (source, argv[i]);
	StripExtension (source);
	DefaultExtension (source, ".bsp");

	if (!NoWrite)
		WriteChk (source);

	logprintf ("File: %s\n", source);

	LoadBSPFile (source);

	LoadEntities ();

	if (OnlyEnts)
		logprintf ("Updating entities lump...\n");
	else if (!NoWrite)
	{
		MakeTnodes (&dmodels[0]);

		FindFaceOffsets ();
		LightWorld ();
	}

	if (!NoWrite)
	{
		WriteEntitiesToString ();
		WriteBSPFile (source);
	}

	PrintFinish ();

	return 0;
}