コード例 #1
0
ファイル: bspinfo.c プロジェクト: JoelTroch/am_src_30jan2011
void main (int argc, char **argv)
{
	int			i;
	char		source[1024];
	int			size;
	FILE		*f;

	printf( "bspinfo.exe v2.1 (%s)\n", __DATE__ );
	printf ("---- bspinfo ----\n" );


	if (argc == 1)
		Error ("usage: bspinfo bspfile [bspfiles]");
		
	for (i=1 ; i<argc ; i++)
	{
		printf ("---------------------\n");
		strcpy (source, argv[i]);
		DefaultExtension (source, ".bsp");
		f = fopen (source, "rb");
		if (f)
		{
			size = filelength (f);
			fclose (f);
		}
		else
			size = 0;
		printf ("%s: %i\n", source, size);
		
		LoadBSPFile (source);		
		PrintBSPFileSizes ();
		printf ("---------------------\n");
	}
}
コード例 #2
0
ファイル: bsp.c プロジェクト: kingtiger01/OpenMOHAA
/*
============
Bspinfo
============
*/
void Bspinfo( int count, char **fileNames ) {
	int		i;
	char	source[1024];
	int			size;
	FILE		*f;

	if ( count < 1 ) {
		_printf( "No files to dump info for.\n");
		return;
	}

	for ( i = 0 ; i < count ; i++ ) {
		_printf ("---------------------\n");
		strcpy (source, fileNames[ i ] );
		DefaultExtension (source, ".bsp");
		f = fopen (source, "rb");
		if (f)
		{
			size = Q_filelength (f);
			fclose (f);
		}
		else
			size = 0;
		_printf ("%s: %i\n", source, size);
		
		LoadBSPFile (source);		
		PrintBSPFileSizes ();
		_printf ("---------------------\n");
	}
}
コード例 #3
0
ファイル: writebsp.c プロジェクト: atphalix/eviltoys
/*
==================
FinishBSPFile
==================
*/
void FinishBSPFile (void)
{
  printf ("--- FinishBSPFile ---\n");
  printf ("WriteBSPFile: %s\n", bspfilename);
	
  WriteMiptex ();

  PrintBSPFileSizes ();
  WriteBSPFile (bspfilename);
}
コード例 #4
0
void FinishBSPFile( void )
{
	printf( "--- BSP file information ---\n" );
	PrintBSPFileSizes ();

	qprintf( "--- WriteBSPFile: %s ---\n", filename_bsp );
	WriteBSPFile(filename_bsp);

	qfree( planemapping );
}
コード例 #5
0
ファイル: writebsp.c プロジェクト: 6779660/halflife
/*
==================
FinishBSPFile
==================
*/
void FinishBSPFile (void)
{
	int		i;

	qprintf ("--- FinishBSPFile ---\n");

	if (verbose)
		PrintBSPFileSizes ();
	WriteBSPFile (bspfilename);
}
コード例 #6
0
ファイル: main.c プロジェクト: ChunHungLiu/GtkRadiant
int BSPInfo( int count, char **fileNames )
{
	int			i;
	char		source[ 1024 ], ext[ 64 ];
	int			size;
	FILE		*f;
	
	
	/* dummy check */
	if( count < 1 )
	{
		Sys_Printf( "No files to dump info for.\n");
		return -1;
	}
	
	/* enable info mode */
	infoMode = qtrue;
	
	/* walk file list */
	for( i = 0; i < count; i++ )
	{
		Sys_Printf( "---------------------------------\n" );
		
		/* mangle filename and get size */
		strcpy( source, fileNames[ i ] );
		ExtractFileExtension( source, ext );
		if( !Q_stricmp( ext, "map" ) )
			StripExtension( source );
		DefaultExtension( source, ".bsp" );
		f = fopen( source, "rb" );
		if( f )
		{
			size = Q_filelength (f);
			fclose( f );
		}
		else
			size = 0;
		
		/* load the bsp file and print lump sizes */
		Sys_Printf( "%s\n", source );
		LoadBSPFile( source );		
		PrintBSPFileSizes();
		
		/* print sizes */
		Sys_Printf( "\n" );
		Sys_Printf( "          total         %9d\n", size );
		Sys_Printf( "                        %9d KB\n", size / 1024 );
		Sys_Printf( "                        %9d MB\n", size / (1024 * 1024) );
		
		Sys_Printf( "---------------------------------\n" );
	}
	
	/* return count */
	return i;
}
コード例 #7
0
ファイル: bspinfo.c プロジェクト: atphalix/eviltoys
int main (int argc, char **argv)
{
	int			i;
	char		source[1024];

	if (argc == 1)
		Error ("usage: bspinfo bspfile [bspfiles]");
		
	for (i=1 ; i<argc ; i++)
	{
		printf ("---------------------\n");
		strcpy (source, argv[i]);
		DefaultExtension (source, ".bsp");
		printf ("%s\n", source);
		
		LoadBSPFile (source);		
		PrintBSPFileSizes ();
		printf ("---------------------\n");
	}
	return 0;
}
コード例 #8
0
ファイル: qrad.c プロジェクト: jpiolho/halflife
int main (int argc, char **argv)
{
	int		i;
	double		start, end;

	printf( "qrad.exe v 1.5 (%s)\n", __DATE__ );
	printf ("----- Radiosity ----\n");

	verbose = true;  // Originally FALSE
	smoothing_threshold = cos(45.0*(Q_PI/180)); // Originally zero.

	for (i=1 ; i<argc ; i++)
	{
		if (!strcmp(argv[i],"-dump"))
			dumppatches = true;
		else if (!strcmp(argv[i],"-bounce"))
		{
			if ( ++i < argc )
			{
				numbounce = atoi (argv[i]);
				if ( numbounce < 0 )
				{
					fprintf(stderr, "Error: expected non-negative value after '-bounce'\n" );
					return 1;
				}
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-bounce'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-verbose"))
		{
			verbose = true;
		}
		else if (!strcmp(argv[i],"-terse"))
		{
			verbose = false;
		}
		else if (!strcmp(argv[i],"-threads"))
		{
			if ( ++i < argc )
			{
				numthreads = atoi (argv[i]);
				if ( numthreads <= 0 )
				{
					fprintf(stderr, "Error: expected positive value after '-threads'\n" );
					return 1;
				}
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-threads'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-maxchop"))
		{
			if ( ++i < argc )
			{
				maxchop = (float)atof (argv[i]);
				if ( maxchop < 2 )
				{
					fprintf(stderr, "Error: expected positive value after '-maxchop'\n" );
					return 1;
				}
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-maxchop'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-chop"))
		{
			if ( ++i < argc )
			{
				minchop = (float)atof (argv[i]);
				if ( minchop < 1 )
				{
					fprintf(stderr, "Error: expected positive value after '-chop'\n" );
					return 1;
				}
				if ( minchop < 32 )
				{
					fprintf(stderr, "WARNING: Chop values below 32 are not recommended.  Use -extra instead.\n");
				}
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-chop'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-scale"))
		{
			if ( ++i < argc )
			{
				lightscale = (float)atof (argv[i]);
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-scale'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-ambient"))
		{
			if ( i+3 < argc )
			{
 				ambient[0] = (float)atof (argv[++i]) * 128;
 				ambient[1] = (float)atof (argv[++i]) * 128;
 				ambient[2] = (float)atof (argv[++i]) * 128;
			}
			else
			{
				fprintf( stderr, "Error: expected three color values after '-ambient'\n" );
				return 1;
			}
		}
		else if( !strcmp(argv[i], "-proj") )
		{
			if ( ++i < argc && *argv[i] )
				strcpy( qproject, argv[i] );
			else
			{
				fprintf(stderr, "Error: expected path name after '-proj'\n" );
				return 1;
			}
		}
		else if ( !strcmp(argv[i], "-maxlight") )
		{
			if ( ++i < argc && *argv[i] )
			{
				maxlight = (float)atof (argv[i]) * 128;
				if ( maxlight <= 0 )
				{
					fprintf(stderr, "Error: expected positive value after '-maxlight'\n" );
					return 1;
				}
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-maxlight'\n" );
				return 1;
			}
		}
		else if ( !strcmp(argv[i], "-lights" ) )
		{
			if ( ++i < argc && *argv[i] )
			{
				strcpy( designer_lights, argv[i] );
			}
			else
			{
				fprintf( stderr, "Error: expected a filepath after '-lights'\n" );
				return 1;
			}
		}
		else if ( !strcmp(argv[i], "-inc" ) )
		{
			incremental = true;
		} 
		else if (!strcmp(argv[i],"-gamma"))
		{
			if ( ++i < argc )
			{
				gamma = (float)atof (argv[i]);
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-gamma'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-dlight"))
		{
			if ( ++i < argc )
			{
				dlight_threshold = (float)atof (argv[i]);
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-dlight'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-extra"))
		{
			extra = true;
		}
		else if (!strcmp(argv[i],"-sky"))
		{
			if ( ++i < argc )
			{
				indirect_sun = (float)atof (argv[i]);
			}
			else
			{
				fprintf( stderr, "Error: expected a value after '-gamma'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-smooth"))
		{
			if ( ++i < argc )
			{
				smoothing_threshold = (float)cos(atof(argv[i])*(Q_PI/180.0));
			}
			else
			{
				fprintf( stderr, "Error: expected an angle after '-smooth'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-coring"))
		{
			if ( ++i < argc )
			{
				coring = (float)atof( argv[i] );
			}
			else
			{
				fprintf( stderr, "Error: expected a light threshold after '-coring'\n" );
				return 1;
			}
		}
		else if (!strcmp(argv[i],"-notexscale"))
		{
			texscale = false;
		}
		else
		{
			break;
		}
	}

	ThreadSetDefault ();

	if (maxlight > 255)
		maxlight = 255;

	if (i != argc - 1)
		Error ("usage: qrad [-dump] [-inc] [-bounce n] [-threads n] [-verbose] [-terse] [-chop n] [-maxchop n] [-scale n] [-ambient red green blue] [-proj file] [-maxlight n] [-threads n] [-lights file] [-gamma n] [-dlight n] [-extra] [-smooth n] [-coring n] [-notexscale] bspfile");

	start = I_FloatTime ();

	strcpy (source, argv[i]);
	StripExtension (source);
	SetQdirFromPath (source);

	// Set the required global lights filename
	strcat( strcpy( global_lights, gamedir ), "lights.rad" );
	if ( _access( global_lights, 0x04) == -1 ) 
	{
		// try looking in qproject
		strcat( strcpy( global_lights, qproject ), "lights.rad" );
		if ( _access( global_lights, 0x04) == -1 ) 
		{
			// try looking in the directory we were run from
			GetModuleFileName( NULL, global_lights, sizeof( global_lights ) );
			ExtractFilePath( global_lights, global_lights );
			strcat( global_lights, "lights.rad" );
		}
	}

	// Set the optional level specific lights filename
	DefaultExtension( strcpy( level_lights, source ), ".rad" );
	if ( _access( level_lights, 0x04) == -1 ) *level_lights = 0;	

	ReadLightFile(global_lights);							// Required
	if ( *designer_lights ) ReadLightFile(designer_lights);	// Command-line
	if ( *level_lights )	ReadLightFile(level_lights);	// Optional & implied

	strcpy(incrementfile, source);
	DefaultExtension(incrementfile, ".r0");
	DefaultExtension(source, ".bsp");

	LoadBSPFile (source);
	ParseEntities ();

	if (!visdatasize)
	{
		printf ("No vis information, direct lighting only.\n");
		numbounce = 0;
		ambient[0] = ambient[1] = ambient[2] = 0.1f;
	}

	RadWorld ();

	if (verbose)
		PrintBSPFileSizes ();

	WriteBSPFile (source);

	if ( incremental )
	{
		if ( !IsIncremental(incrementfile) )
		{
			SaveIncremental(incrementfile);
		}
	}
	else
	{
		unlink(incrementfile);
	}

	end = I_FloatTime ();
	printf ("%5.0f seconds elapsed\n", end-start);
	
	return 0;
}