コード例 #1
0
bool FeaturesStatistics::Init()
{
	if (InitConnections()==false)
		return false;
	if (InitThreads()==false)
		return false;
	if (SplitMLThreadDataRange(con->GetRecordCount())==false)
		return false;
	if (con->CreateMlRecord(MainRecord)==false)
	{
		notif->Error("[%s] -> Unable to create MainRecord",ObjectName);
		return false;
	}
	if (ComputedData.Create(con->GetFeatureCount(),true)==false)
	{
		notif->Error("[%s] -> Unable to create ComputedData",ObjectName);
		return false;	
	}
	if (Feats.Create(con->GetFeatureCount(),true)==false)
	{
		notif->Error("[%s] -> Unable to create Feats Global information",ObjectName);
		return false;	
	}
	for (UInt32 tr=0;tr<con->GetFeatureCount();tr++)
	{
		if ((ComputedData[tr].fnValue = new double[statFuncCount])==NULL)
		{
			notif->Error("[%s] -> Unable to alloc data for ComputedData Values",ObjectName);
			return false;		
		}
	}
	return true;
}
コード例 #2
0
ファイル: ATKCode.cpp プロジェクト: johnhowe/Cutemaze
int inithtk(int argc, char *argv[],const char * app_version, bool noGraphics)
{
	InitThreads(HT_MSGMON);   // enable msg driven monitoring
	if(InitShell(argc,argv,app_version)<SUCCESS) return FAIL;
	// CommonInit() expanded with incompatible things commented out: 
		InitMem();   InitLabel();
		InitMath();  InitSigP(); InitUtil();
		InitWave();  /*InitAudio();*/ InitModel();
		if(InitParm()<SUCCESS) return FAIL;
		InitGraf((Boolean)noGraphics);
		InitDict();  InitNet();   InitLM();
		InitRec();  InitLat();  /*InitAdapt();*/
		
		EnableBTrees();   /* allows unseen triphones to be synthesised */
		/*
		Register(abuffer_version);
		Register(acode_version);
		Register(acomponent_version);
		Register(adict_version);
		Register(agram_version);
		Register(angram_version);
		Register(ahmms_version);
		Register(ahtk_version);
		Register(amonitor_version);
		Register(apacket_version);
		Register(arec_version);
		Register(aresource_version);
		Register(arman_version);
		Register(asource_version);
		*/
		InfoPrinted();
		return SUCCESS;
}
コード例 #3
0
ファイル: RageThreads.cpp プロジェクト: Prcuvu/StepMania-3.95
void RageThread::Create( int (*fn)(void *), void *data )
{
	/* Don't create a thread that's already running: */
	ASSERT( m_pSlot == NULL );

	InitThreads();

	/* Lock unused slots, so nothing else uses our slot before we mark it used. */
	LockMut(g_ThreadSlotsLock);

	int slotno = FindEmptyThreadSlot();
	m_pSlot = &g_ThreadSlots[slotno];
	
	if( name == "" )
	{
		if( LOG )
			LOG->Warn("Created a thread without naming it first.");

		/* If you don't name it, I will: */
		strcpy( m_pSlot->name, "Joe" );
	} else {
		strcpy( m_pSlot->name, name.c_str() );
	}

	if( LOG )
		LOG->Trace( "Starting thread: %s", name.c_str() );
	sprintf( m_pSlot->ThreadFormattedOutput, "Thread: %s", name.c_str() );

	/* Start a thread using our own startup function.  We pass the id to fill in,
	 * to make sure it's set before the thread actually starts.  (Otherwise, early
	 * checkpoints might not have a completely set-up thread slot.) */
	m_pSlot->pImpl = MakeThread( fn, data, &m_pSlot->id );
}
コード例 #4
0
ファイル: CoWork.cpp プロジェクト: koz4k/soccer
CoWork::Pool::Pool()
{
	ASSERT(!IsWorker());

	InitThreads(CPU_Cores() + 2);

	free = NULL;
	for(int i = 0; i < SCHEDULED_MAX; i++)
		Free(slot[i]);
	
	quit = false;
}
コード例 #5
0
ファイル: RageThreads.cpp プロジェクト: Prcuvu/StepMania-3.95
static ThreadSlot *GetThreadSlotFromID( uint64_t iID )
{
	InitThreads();

	for( int entry = 0; entry < MAX_THREADS; ++entry )
	{
		if( !g_ThreadSlots[entry].used )
			continue;
		if( g_ThreadSlots[entry].id == iID )
			return &g_ThreadSlots[entry];
	}
	return NULL;
}
コード例 #6
0
ファイル: HNetTest.c プロジェクト: deardaniel/PizzaTest
void Initialise(int argc, char *argv[])
{
   InitThreads(HT_MSGMON);
	if(InitShell(argc,argv,hnettest_version)<SUCCESS)
		HError(999,"Initialise: couldnt init HShell");
	InitMem();   InitLabel();
	InitMath();  InitSigP();
	InitWave();  InitAudio();
	if(InitParm()<SUCCESS)
		HError(999,"Initialise: couldnt init HParm");
	InitGraf(FALSE);  InitModel();
	InitDict();  InitNet();
	EnableBTrees();   /* allows unseen triphones to be synthesised */
	if (!InfoPrinted() && NumArgs() == 0)
		ReportUsage();
}
コード例 #7
0
ファイル: HThreadTest.c プロジェクト: deardaniel/PizzaTest
int main(int argc, char *argv[])
{
	int n,a1,a2,a3,a4;

	InitThreads(sMon);
	if(InitShell(argc,argv,hthreadtest_version)<SUCCESS)
		HError(1100,"HThreadTest: InitShell failed");
	if (NumArgs() < 1) ReportUsage();
	InitMem();   InitLabel();
	InitMath();  InitSigP();
	InitWave();  InitAudio();
	InitVQ();
	if(InitParm()<SUCCESS)
		HError(3200,"HThreadTest: InitParm failed");
	InitGraf(FALSE);
   if (sMon==HT_MSGMON) HCreateMonitor(tmon4,(void *)0);
	if (NextArg() == INTARG){
		n = GetIntArg();
		switch(n){
		case 1:
			a1 = GetIntArg(); a2 = GetIntArg();
			ParallelForkAndJoin(a1,a2); break;
		case 2:
			a1 = GetIntArg(); a2 = GetIntArg();
			SimpleMutex(a1,a2); break;
		case 3:
			SimpleSignal(); break;
		case 4:
			a1 = GetIntArg(); a2 = GetIntArg();
			a3 = GetIntArg(); a4 = GetIntArg();
			BufferTest(a1,a2,a3,a4,GetStrArg()); break;
		default:
			printf("Bad test number %d\n",n); ReportUsage();
		}
	}
	if (sMon>0){
		AccessStatus();
		PrintThreadStatus("Final");
		ReleaseStatusAccess();
		if (sMon==HT_MSGMON)HJoinMonitor();
	}
}
コード例 #8
0
bool FeatureValuesStatistics::Init()
{
	if (InitConnections()==false)
		return false;
	if (InitLabels()==false)
		return false;
	if (InitThreads()==false)
		return false;
	if (SplitMLThreadDataRange(con->GetRecordCount())==false)
		return false;
	if (Vi.Create(con->GetRecordCount(),true)==false)
	{
		notif->Error("[%s] -> Unable to create value array",ObjectName);
		return false;	
	}
	if (con->CreateMlRecord(MainRecord)==false)
	{
		notif->Error("[%s] -> Unable to create MainRecord",ObjectName);
		return false;
	}
	// Add extra initialization here
	return true;
}
コード例 #9
0
ファイル: ThreadTests.c プロジェクト: olokshyn/Evolution
int threads_tests() {
    int status = 0;
    status = InitThreads(2);
    printf("InitThreads returned %d\n", status);

    task_info tasks[] = {
            {test_routine1, (void*)1},
            {test_routine1, (void*)2},
            {test_routine1, (void*)3},
            {test_routine1, (void*)4},
            {test_routine1, (void*)5}
    };

    status = AddTasks(tasks, sizeof(tasks) / sizeof(task_info));
    printf("AddTasks returned %d\n", status);

    status = JoinTasks();
    printf("JoinTasks returned %d\n", status);

    status = DestroyThreads();
    printf("DestroyTreads returned %d\n", status);

    return status;
}
コード例 #10
0
ファイル: descent.cpp プロジェクト: paud/d2x-xl
static int InitializePoll (CMenu& menu, int& key, int nCurItem, int nState)
{
if (nState)
	return nCurItem;

paletteManager.LoadEffect ();
switch (loadOp) {
	case 0:
		/*---*/PrintLog ("Creating default tracker list\n");
		tracker.CreateList ();
		break;
	case 1:
		/*---*/PrintLog ("Loading ban list\n");
		banList.Load ();
		break;
	case 2:
		/*---*/PrintLog ("Initializing control types\n");
		SetControlType ();
		break;
	case 3:
		/*---*/PrintLog ("Initializing keyboard\n");
		KeyInit ();
		break;
	case 4:
		/*---*/PrintLog ("Initializing joystick\n");
		DoJoystickInit ();
		break;
	case 5:
		int i;
		if ((i = FindArg ("-xcontrol")) > 0)
			externalControls.Init (strtol (pszArgList [i+1], NULL, 0), strtol (pszArgList [i+2], NULL, 0));
		break;
	case 6:
		/*---*/PrintLog ("Initializing movies\n");
		if (FindArg ("-nohires") || FindArg ("-nohighres") || !GrVideoModeOK (MENU_HIRES_MODE))
			gameOpts->movies.bHires = 
			gameStates.menus.bHires = 
			gameStates.menus.bHiresAvailable = 0;
		else
			gameStates.menus.bHires = gameStates.menus.bHiresAvailable = 1;
		movieManager.InitLibs ();		//init movie libraries
		break;
	case 7:
		BMInit ();
		break;
	case 8:
		/*---*/PrintLog ("Initializing sound\n");
		audio.Setup (1);
		break;
	case 9:
		/*---*/PrintLog ("Loading hoard data\n");
		LoadHoardData ();
		break;
	case 10:
		error_init (ShowInGameWarning, NULL);
		break;
	case 11:
		break;
		g3_init ();
	case 12:
		/*---*/PrintLog ("Initializing texture merge buffer\n");
		TexMergeInit (100); // 100 cache bitmaps
		break;
	case 13:
		InitPowerupTables ();
		break;
	case 14:
		LoadGameBackground ();
		atexit (CloseGame);
		break;
	case 15:
		InitThreads ();
		break;
	case 16:
		PiggyInitMemory ();
		break;
	case 17:
		if (!FindArg ("-nomouse"))
			MouseInit ();
		break;
	case 18:
		/*---*/PrintLog ("Enabling TrackIR support\n");
		TIRLoad ();
		break;
	}
loadOp++;
if (gameStates.app.bProgressBars && gameOpts->menus.nStyle) {
	if (loadOp == InitGaugeSize ())
		key = -2;
	else {
		menu [0].m_value++;
		menu [0].m_bRebuild = 1;
		key = 0;
		}
	}
paletteManager.LoadEffect ();
return nCurItem;
}
コード例 #11
0
ファイル: LIGHT.C プロジェクト: ChunHungLiu/Quake-Tools
/*
========
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;
}
コード例 #12
0
ファイル: TFlite.cpp プロジェクト: deardaniel/PizzaTest
int main(int argc, char **argv)
{
    cst_voice *v;
    const char *filename;
    const char *outtype;
    int i;
    float durs;
    int flite_verbose, flite_loop, flite_bench;
    int explicit_filename, explicit_text, explicit_phones;
#define ITER_MAX 3
    int bench_iter = 0;
    cst_features *extra_feats;

   InitThreads(HT_NOMONITOR);   // enable msg driven monitoring
   if(InitShell(argc,argv,version)<SUCCESS) return FAIL;
   InitMem();   InitLabel();
   InitMath();  InitSigP(); InitUtil();
   InitWave();  InitAudio();


    filename = 0;
    outtype = "play";   /* default is to play */
    flite_verbose = FALSE;
    flite_loop = FALSE;
    flite_bench = FALSE;
    explicit_text = explicit_filename = explicit_phones = FALSE;
    extra_feats = new_features();

    flite_init();

    for (i=1; i<argc; i++)
    {
	if (cst_streq(argv[i],"--version"))
	{
	    flite_version();
	    return 1;
	}
	else if (cst_streq(argv[i],"-h") ||
		 cst_streq(argv[i],"--help") ||
		 cst_streq(argv[i],"-?"))
	    flite_usage();
	else if (cst_streq(argv[i],"-v"))
	    flite_verbose = TRUE;
	else if (cst_streq(argv[i],"-l"))
	    flite_loop = TRUE;
	else if (cst_streq(argv[i],"-b"))
	{
	    flite_bench = TRUE;
	    break; /* ignore other arguments */
	}
	else if ((cst_streq(argv[i],"-o")) && (i+1 < argc))
	{
	    outtype = argv[i+1];
	    i++;
	}
	else if (cst_streq(argv[i],"-f") && (i+1 < argc))
	{
	    filename = argv[i+1];
	    explicit_filename = TRUE;
	    i++;
	}
	else if ((cst_streq(argv[i],"-set") || cst_streq(argv[i],"-s"))
		 && (i+1 < argc))
	{
	    ef_set(extra_feats,argv[i+1],0);
	    i++;
	}
	else if (cst_streq(argv[i],"--seti") && (i+1 < argc))
	{
	    ef_set(extra_feats,argv[i+1],"int");
	    i++;
	}
	else if (cst_streq(argv[i],"--setf") && (i+1 < argc))
	{
	    ef_set(extra_feats,argv[i+1],"float");
	    i++;
	}
	else if (cst_streq(argv[i],"--sets") && (i+1 < argc))
	{
	    ef_set(extra_feats,argv[i+1],"string");
	    i++;
	}
	else if (cst_streq(argv[i],"-p") && (i+1 < argc))
	{
	    filename = argv[i+1];
	    explicit_phones = TRUE;
	    i++;
	}
	else if (cst_streq(argv[i],"-t") && (i+1 < argc))
	{
	    filename = argv[i+1];
	    explicit_text = TRUE;
	    i++;
	}
	else if (filename)
	    outtype = argv[i];
	else
	    filename = argv[i];
    }

    if (filename == NULL) filename = "-";  /* stdin */
    v = register_cmu_us_kal16(NULL);
    feat_copy_into(extra_feats,v->features);
    durs = 0.0;

    if (flite_bench)
    {
	outtype = "none";
	filename = "A whole joy was reaping, but they've gone south, you should fetch azure mike.";
	explicit_text = TRUE;
    }

loop:
    if (explicit_phones)
	durs = flite_phones_to_speech(filename,v,outtype);
    else if ((strchr(filename,' ') && !explicit_filename) || explicit_text)
	durs = flite_text_to_speech(filename,v,outtype);
    else
	durs = flite_file_to_speech(filename,v,outtype);

    if (flite_loop || (flite_bench && bench_iter++ < ITER_MAX))
	    goto loop;

    delete_features(extra_feats);
    unregister_cmu_us_kal16(v);

    return 0;
}
コード例 #13
0
ファイル: light.c プロジェクト: svn2github/uhexen2
/*
========
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;
}
コード例 #14
0
ファイル: pa4c.c プロジェクト: rhlin/unix-homework-CSE120-PA4
void initThreads() {
    useDefault? InitThreads(): MyInitThreads();
}
コード例 #15
0
// We need this mostly so that we can not use it in tests. Apparently the
// GoogleTest framework goes apeshit on us if we enable threads by default.
void CompilationDatabase::EnableThreading() {
  threading_enabled_ = true;
  InitThreads();
}
コード例 #16
0
ファイル: LIGHT.C プロジェクト: necros0/ne_ag_LightMHColourR2
/*
========
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;
}