Exemple #1
0
VOID
main (
    IN SHORT argc,
    IN PSZ argv[]
    )
{

    Initialize();           // Init any data

    //
    // Parse the command line
    //

    ParseParms(argc, argv);

    if ( Operation == Invalid) {
        printf( "Must specify an operation\n");
        Usage( );
    }

    switch (Operation) {
       case Clear:

          TestElfClearLogFile();

       case Read:

          if (ReadFlags & EVENTLOG_SEEK_READ) {
              TestReadEventLog(1, ReadFlags, NumberofRecords) ;
          }
          else {
              TestReadEventLog(NumberofRecords, ReadFlags, 0) ;
          }
          break;

    }
}
/*
================
idDeclParticle::ParseParticleStage
================
*/
idParticleStage* idDeclParticle::ParseParticleStage( idLexer& src )
{
	idToken token;
	
	idParticleStage* stage = new( TAG_DECL ) idParticleStage;
	stage->Default();
	
	while( 1 )
	{
		if( src.HadError() )
		{
			break;
		}
		if( !src.ReadToken( &token ) )
		{
			break;
		}
		if( !token.Icmp( "}" ) )
		{
			break;
		}
		if( !token.Icmp( "material" ) )
		{
			src.ReadToken( &token );
			stage->material = declManager->FindMaterial( token.c_str() );
			continue;
		}
		if( !token.Icmp( "count" ) )
		{
			stage->totalParticles = src.ParseInt();
			continue;
		}
		if( !token.Icmp( "time" ) )
		{
			stage->particleLife = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "cycles" ) )
		{
			stage->cycles = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "timeOffset" ) )
		{
			stage->timeOffset = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "deadTime" ) )
		{
			stage->deadTime = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "randomDistribution" ) )
		{
			stage->randomDistribution = src.ParseBool();
			continue;
		}
		if( !token.Icmp( "bunching" ) )
		{
			stage->spawnBunching = src.ParseFloat();
			continue;
		}
		
		if( !token.Icmp( "distribution" ) )
		{
			src.ReadToken( &token );
			if( !token.Icmp( "rect" ) )
			{
				stage->distributionType = PDIST_RECT;
			}
			else if( !token.Icmp( "cylinder" ) )
			{
				stage->distributionType = PDIST_CYLINDER;
			}
			else if( !token.Icmp( "sphere" ) )
			{
				stage->distributionType = PDIST_SPHERE;
			}
			else
			{
				src.Error( "bad distribution type: %s\n", token.c_str() );
			}
			ParseParms( src, stage->distributionParms, sizeof( stage->distributionParms ) / sizeof( stage->distributionParms[0] ) );
			continue;
		}
		
		if( !token.Icmp( "direction" ) )
		{
			src.ReadToken( &token );
			if( !token.Icmp( "cone" ) )
			{
				stage->directionType = PDIR_CONE;
			}
			else if( !token.Icmp( "outward" ) )
			{
				stage->directionType = PDIR_OUTWARD;
			}
			else
			{
				src.Error( "bad direction type: %s\n", token.c_str() );
			}
			ParseParms( src, stage->directionParms, sizeof( stage->directionParms ) / sizeof( stage->directionParms[0] ) );
			continue;
		}
		
		if( !token.Icmp( "orientation" ) )
		{
			src.ReadToken( &token );
			if( !token.Icmp( "view" ) )
			{
				stage->orientation = POR_VIEW;
			}
			else if( !token.Icmp( "aimed" ) )
			{
				stage->orientation = POR_AIMED;
			}
			else if( !token.Icmp( "x" ) )
			{
				stage->orientation = POR_X;
			}
			else if( !token.Icmp( "y" ) )
			{
				stage->orientation = POR_Y;
			}
			else if( !token.Icmp( "z" ) )
			{
				stage->orientation = POR_Z;
			}
			else
			{
				src.Error( "bad orientation type: %s\n", token.c_str() );
			}
			ParseParms( src, stage->orientationParms, sizeof( stage->orientationParms ) / sizeof( stage->orientationParms[0] ) );
			continue;
		}
		
		if( !token.Icmp( "customPath" ) )
		{
			src.ReadToken( &token );
			if( !token.Icmp( "standard" ) )
			{
				stage->customPathType = PPATH_STANDARD;
			}
			else if( !token.Icmp( "helix" ) )
			{
				stage->customPathType = PPATH_HELIX;
			}
			else if( !token.Icmp( "flies" ) )
			{
				stage->customPathType = PPATH_FLIES;
			}
			else if( !token.Icmp( "spherical" ) )
			{
				stage->customPathType = PPATH_ORBIT;
			}
			else
			{
				src.Error( "bad path type: %s\n", token.c_str() );
			}
			ParseParms( src, stage->customPathParms, sizeof( stage->customPathParms ) / sizeof( stage->customPathParms[0] ) );
			continue;
		}
		
		if( !token.Icmp( "speed" ) )
		{
			ParseParametric( src, &stage->speed );
			continue;
		}
		if( !token.Icmp( "rotation" ) )
		{
			ParseParametric( src, &stage->rotationSpeed );
			continue;
		}
		if( !token.Icmp( "angle" ) )
		{
			stage->initialAngle = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "entityColor" ) )
		{
			stage->entityColor = src.ParseBool();
			continue;
		}
		if( !token.Icmp( "size" ) )
		{
			ParseParametric( src, &stage->size );
			continue;
		}
		if( !token.Icmp( "aspect" ) )
		{
			ParseParametric( src, &stage->aspect );
			continue;
		}
		if( !token.Icmp( "fadeIn" ) )
		{
			stage->fadeInFraction = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "fadeOut" ) )
		{
			stage->fadeOutFraction = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "fadeIndex" ) )
		{
			stage->fadeIndexFraction = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "color" ) )
		{
			stage->color[0] = src.ParseFloat();
			stage->color[1] = src.ParseFloat();
			stage->color[2] = src.ParseFloat();
			stage->color[3] = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "fadeColor" ) )
		{
			stage->fadeColor[0] = src.ParseFloat();
			stage->fadeColor[1] = src.ParseFloat();
			stage->fadeColor[2] = src.ParseFloat();
			stage->fadeColor[3] = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "offset" ) )
		{
			stage->offset[0] = src.ParseFloat();
			stage->offset[1] = src.ParseFloat();
			stage->offset[2] = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "animationFrames" ) )
		{
			stage->animationFrames = src.ParseInt();
			continue;
		}
		if( !token.Icmp( "animationRate" ) )
		{
			stage->animationRate = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "boundsExpansion" ) )
		{
			stage->boundsExpansion = src.ParseFloat();
			continue;
		}
		if( !token.Icmp( "gravity" ) )
		{
			src.ReadToken( &token );
			if( !token.Icmp( "world" ) )
			{
				stage->worldGravity = true;
			}
			else
			{
				src.UnreadToken( &token );
			}
			stage->gravity = src.ParseFloat();
			continue;
		}
		
		src.Error( "unknown token %s\n", token.c_str() );
	}
	
	// derive values
	stage->cycleMsec = ( stage->particleLife + stage->deadTime ) * 1000;
	
	return stage;
}