Example #1
0
void Startup(LPSTR     lpCmdLine)
{
	char cmd[512],name[256];
	BOOL bModifyOptions		= FALSE;

	strcpy(cmd,lpCmdLine);
	strlwr(cmd);
	if (strstr(cmd,"-?") || strstr(cmd,"-h"))			{ Help(); return; }
	if (strstr(cmd,"-f")==0)							{ Help(); return; }
	if (strstr(cmd,"-o"))								bModifyOptions = TRUE;

	// Give a LOG-thread a chance to startup
	InitCommonControls	();
	thread_spawn		(logThread,	"log-update", 1024*1024,0);
	Sleep				(150);
	
	// Load project
	name[0]=0; sscanf	(strstr(cmd,"-f")+2,"%s",name);
	//FS.update_path	(name,"$game_levels$",name);
	FS.get_path			("$level$")->_set	(name);

	CTimer				dwStartupTime; dwStartupTime.Start();
	xrCompiler			(0);

	// Show statistic
	char	stats[256];
	extern	std::string make_time(u32 sec);
	extern  HWND logWindow;
	sprintf				(stats,"Time elapsed: %s",make_time((dwStartupTime.GetElapsed_ms())/1000).c_str());
	MessageBox			(logWindow,stats,"Congratulation!",MB_OK|MB_ICONINFORMATION);

	bClose				= TRUE;
	Sleep				(500);
}
Example #2
0
File: xrAI.cpp Project: 2asoft/xray
void execute	(LPSTR cmd)
{
	// Load project
	string4096 name;
	name[0]=0; 
	if (strstr(cmd,"-f"))
		sscanf	(strstr(cmd,"-f")+2,"%s",name);
	else
		if (strstr(cmd,"-s"))
			sscanf	(strstr(cmd,"-s")+2,"%s",name);
		else
			if (strstr(cmd,"-t"))
				sscanf	(strstr(cmd,"-t")+2,"%s",name);
			else
				if (strstr(cmd,"-verify"))
					sscanf	(strstr(cmd,"-verify")+xr_strlen("-verify"),"%s",name);

	if (xr_strlen(name))
		strcat			(name,"\\");

	string_path			prjName;
	prjName				[0] = 0;
	bool				can_use_name = false;
	if (xr_strlen(name) < sizeof(string_path)) {
		can_use_name	= true;
		FS.update_path	(prjName,"$game_levels$",name);
	}

	FS.update_path		(INI_FILE,"$game_config$",GAME_CONFIG);
	
	if (strstr(cmd,"-f")) {
		R_ASSERT3		(can_use_name,"Too big level name",name);
		
		char			*output = strstr(cmd,"-out");
		string256		temp0;
		if (output) {
			output		+= xr_strlen("-out");
			sscanf		(output,"%s",temp0);
			_TrimLeft	(temp0);
			output		= temp0;
		}
		else
			output		= (pstr)LEVEL_GRAPH_NAME;

		xrCompiler		(prjName,!!strstr(cmd,"-draft"),!!strstr(cmd,"-pure_covers"),output);
	}
	else {
		if (strstr(cmd,"-s")) {
			if (xr_strlen(name))
				name[xr_strlen(name) - 1] = 0;
			char				*output = strstr(cmd,"-out");
			string256			temp0, temp1;
			if (output) {
				output			+= xr_strlen("-out");
				sscanf			(output,"%s",temp0);
				_TrimLeft		(temp0);
				output			= temp0;
			}
			char				*start = strstr(cmd,"-start");
			if (start) {
				start			+= xr_strlen("-start");
				sscanf			(start,"%s",temp1);
				_TrimLeft		(temp1);
				start			= temp1;
			}
			char				*no_separator_check = strstr(cmd,"-no_separator_check");
			clear_temp_folder	();
			CGameSpawnConstructor(name,output,start,!!no_separator_check);
		}
		else
			if (strstr(cmd,"-verify")) {
				R_ASSERT3			(can_use_name,"Too big level name",name);
				verify_level_graph	(prjName,!strstr(cmd,"-noverbose"));
			}
	}
}