예제 #1
0
//Windows pain in the butt CONTROL
void rc2wxr::ParseControlMS()
{
    wxString tok;
    wxString label=GetQuoteField();
    wxString varname=GetToken();
    wxString kindctrl=GetQuoteField();

    kindctrl.MakeUpper();
    if (kindctrl==_T("MSCTLS_TRACKBAR32"))
        ParseSlider(label,varname);
    if (kindctrl==_T("MSCTLS_PROGRESS32"))
        ParseProgressBar(label,varname);
    if (kindctrl==_T("BUTTON"))
        ParseCtrlButton(label,varname);
}
예제 #2
0
/*
================
idDeclAF::Parse
================
*/
bool idDeclAF::Parse( const char *text, const int textLength ) {
	int i, j;
	idLexer src;
	idToken token;

	src.LoadMemory( text, textLength, GetFileName(), GetLineNum() );
	src.SetFlags( DECL_LEXER_FLAGS );
	src.SkipUntilString( "{" );

	while( src.ReadToken( &token ) ) {

		if ( !token.Icmp( "settings" ) ) {
			if ( !ParseSettings( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "body" ) ) {
			if ( !ParseBody( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "fixed" ) ) {
			if ( !ParseFixed( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "ballAndSocketJoint" ) ) {
			if ( !ParseBallAndSocketJoint( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "universalJoint" ) ) {
			if ( !ParseUniversalJoint( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "hinge" ) ) {
			if ( !ParseHinge( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "slider" ) ) {
			if ( !ParseSlider( src ) ) {
				return false;
			}
		} else if ( !token.Icmp( "spring" ) ) {
			if ( !ParseSpring( src ) ) {
				return false;
			}
		} else if ( token == "}" ) {
			break;
		} else {
			src.Error( "unknown keyword %s", token.c_str() );
			return false;
		}
	}

	for ( i = 0; i < bodies.Num(); i++ ) {
		// check for multiple bodies with the same name
		for ( j = i+1; j < bodies.Num(); j++ ) {
			if ( bodies[i]->name == bodies[j]->name ) {
				src.Error( "two bodies with the same name \"%s\"", bodies[i]->name.c_str() );
			}
		}
	}

	for ( i = 0; i < constraints.Num(); i++ ) {
		// check for multiple constraints with the same name
		for ( j = i+1; j < constraints.Num(); j++ ) {
			if ( constraints[i]->name == constraints[j]->name ) {
				src.Error( "two constraints with the same name \"%s\"", constraints[i]->name.c_str() );
			}
		}
		// check if there are two valid bodies set
		if ( constraints[i]->body1 == "" ) {
			src.Error( "no valid body1 specified for constraint '%s'", constraints[i]->name.c_str() );
		}
		if ( constraints[i]->body2 == "" ) {
			src.Error( "no valid body2 specified for constraint '%s'", constraints[i]->name.c_str() );
		}
	}

	// make sure the body which modifies the origin comes first
	for ( i = 0; i < bodies.Num(); i++ ) {
		if ( bodies[i]->jointName == "origin" ) {
			if ( i != 0 ) {
				idDeclAF_Body *b = bodies[0];
				bodies[0] = bodies[i];
				bodies[i] = b;
			}
			break;
		}
	}

	return true;
}