本文整理汇总了C++中idLexer::ExpectAnyToken方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::ExpectAnyToken方法的具体用法?C++ idLexer::ExpectAnyToken怎么用?C++ idLexer::ExpectAnyToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::ExpectAnyToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseBody
//.........这里部分代码省略.........
!src.ExpectTokenString( "," ) ||
!body->v2.Parse( src ) ||
!src.ExpectTokenString( "," ) ) {
return false;
}
body->numSides = src.ParseInt();
if ( !src.ExpectTokenString( ")" ) ) {
return false;
}
} else if ( !token.Icmp( "bone" ) ) {
body->modelType = TRM_BONE;
if ( !src.ExpectTokenString( "(" ) ||
!body->v1.Parse( src ) ||
!src.ExpectTokenString( "," ) ||
!body->v2.Parse( src ) ||
!src.ExpectTokenString( "," ) ) {
return false;
}
body->width = src.ParseFloat();
if ( !src.ExpectTokenString( ")" ) ) {
return false;
}
} else if ( !token.Icmp( "custom" ) ) {
src.Error( "custom models not yet implemented" );
return false;
} else {
src.Error( "unkown model type %s", token.c_str() );
return false;
}
} else if ( !token.Icmp( "origin" ) ) {
if ( !body->origin.Parse( src ) ) {
return false;
}
} else if ( !token.Icmp( "angles" ) ) {
if ( !angles.Parse( src ) ) {
return false;
}
body->angles = idAngles( angles.ToVec3().x, angles.ToVec3().y, angles.ToVec3().z );
} else if ( !token.Icmp( "joint" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
body->jointName = token;
hasJoint = true;
} else if ( !token.Icmp( "mod" ) ) {
if ( !src.ExpectAnyToken( &token ) ) {
return false;
}
body->jointMod = JointModFromString( token.c_str() );
} else if ( !token.Icmp( "density" ) ) {
body->density = src.ParseFloat();
} else if ( !token.Icmp( "inertiaScale" ) ) {
src.Parse1DMatrix( 9, body->inertiaScale[0].ToFloatPtr() );
} else if ( !token.Icmp( "friction" ) ) {
body->linearFriction = src.ParseFloat();
src.ExpectTokenString( "," );
body->angularFriction = src.ParseFloat();
src.ExpectTokenString( "," );
body->contactFriction = src.ParseFloat();
} else if ( !token.Icmp( "contents" ) ) {
ParseContents( src, body->contents );
} else if ( !token.Icmp( "clipMask" ) ) {
ParseContents( src, body->clipMask );
} else if ( !token.Icmp( "selfCollision" ) ) {
body->selfCollision = src.ParseBool();
} else if ( !token.Icmp( "containedjoints" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
body->containedJoints = token;
} else if ( !token.Icmp( "frictionDirection" ) ) {
if ( !body->frictionDirection.Parse( src ) ) {
return false;
}
} else if ( !token.Icmp( "contactMotorDirection" ) ) {
if ( !body->contactMotorDirection.Parse( src ) ) {
return false;
}
} else if ( token == "}" ) {
break;
} else {
src.Error( "unknown token %s in body", token.c_str() );
return false;
}
}
if ( body->modelType == TRM_INVALID ) {
src.Error( "no model set for body" );
return false;
}
if ( !hasJoint ) {
src.Error( "no joint set for body" );
return false;
}
body->clipMask |= CONTENTS_MOVEABLECLIP;
return true;
}
示例2: ParseShader
/*
===============
idSoundShader::ParseShader
===============
*/
bool idSoundShader::ParseShader( idLexer &src )
{
int i;
idToken token;
parms.minDistance = 1;
parms.maxDistance = 10;
parms.volume = 1;
parms.shakes = 0;
parms.soundShaderFlags = 0;
parms.soundClass = 0;
speakerMask = 0;
altSound = NULL;
for( i = 0; i < SOUND_MAX_LIST_WAVS; i++ )
{
leadins[i] = NULL;
entries[i] = NULL;
}
numEntries = 0;
numLeadins = 0;
int maxSamples = idSoundSystemLocal::s_maxSoundsPerShader.GetInteger();
if ( com_makingBuild.GetBool() || maxSamples <= 0 || maxSamples > SOUND_MAX_LIST_WAVS )
{
maxSamples = SOUND_MAX_LIST_WAVS;
}
while ( 1 )
{
if ( !src.ExpectAnyToken( &token ) )
{
return false;
}
// end of definition
else if ( token == "}" )
{
break;
}
// minimum number of sounds
else if ( !token.Icmp( "minSamples" ) )
{
maxSamples = idMath::ClampInt( src.ParseInt(), SOUND_MAX_LIST_WAVS, maxSamples );
}
// description
else if ( !token.Icmp( "description" ) )
{
src.ReadTokenOnLine( &token );
desc = token.c_str();
}
// mindistance
else if ( !token.Icmp( "mindistance" ) )
{
parms.minDistance = src.ParseFloat();
}
// maxdistance
else if ( !token.Icmp( "maxdistance" ) )
{
parms.maxDistance = src.ParseFloat();
}
// shakes screen
else if ( !token.Icmp( "shakes" ) )
{
src.ExpectAnyToken( &token );
if ( token.type == TT_NUMBER )
{
parms.shakes = token.GetFloatValue();
}
else
{
src.UnreadToken( &token );
parms.shakes = 1.0f;
}
}
// reverb
else if ( !token.Icmp( "reverb" ) )
{
int reg0 = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) )
{
src.FreeSource();
return false;
}
int reg1 = src.ParseFloat();
// no longer supported
}
// volume
else if ( !token.Icmp( "volume" ) )
{
parms.volume = src.ParseFloat();
}
// leadinVolume is used to allow light breaking leadin sounds to be much louder than the broken loop
else if ( !token.Icmp( "leadinVolume" ) )
{
//.........这里部分代码省略.........
示例3: ParseShader
/*
===============
idSoundShader::ParseShader
===============
*/
bool idSoundShader::ParseShader( idLexer &src ) {
idToken token;
parms.minDistance = 1;
parms.maxDistance = 10;
parms.volume = 1;
parms.shakes = 0;
parms.soundShaderFlags = 0;
parms.soundClass = 0;
speakerMask = 0;
altSound = NULL;
entries.Clear();
while ( 1 ) {
if ( !src.ExpectAnyToken( &token ) ) {
return false;
}
// end of definition
else if ( token == "}" ) {
break;
}
// minimum number of sounds
else if ( !token.Icmp( "minSamples" ) ) {
src.ParseInt();
}
// description
else if ( !token.Icmp( "description" ) ) {
src.ReadTokenOnLine( &token );
}
// mindistance
else if ( !token.Icmp( "mindistance" ) ) {
parms.minDistance = src.ParseFloat();
}
// maxdistance
else if ( !token.Icmp( "maxdistance" ) ) {
parms.maxDistance = src.ParseFloat();
}
// shakes screen
else if ( !token.Icmp( "shakes" ) ) {
src.ExpectAnyToken( &token );
if ( token.type == TT_NUMBER ) {
parms.shakes = token.GetFloatValue();
} else {
src.UnreadToken( &token );
parms.shakes = 1.0f;
}
}
// reverb
else if ( !token.Icmp( "reverb" ) ) {
src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
src.FreeSource();
return false;
}
src.ParseFloat();
// no longer supported
}
// volume
else if ( !token.Icmp( "volume" ) ) {
parms.volume = src.ParseFloat();
}
// leadinVolume is used to allow light breaking leadin sounds to be much louder than the broken loop
else if ( !token.Icmp( "leadinVolume" ) ) {
leadinVolume = src.ParseFloat();
leadin = true;
}
// speaker mask
else if ( !token.Icmp( "mask_center" ) ) {
speakerMask |= 1<<SPEAKER_CENTER;
}
// speaker mask
else if ( !token.Icmp( "mask_left" ) ) {
speakerMask |= 1<<SPEAKER_LEFT;
}
// speaker mask
else if ( !token.Icmp( "mask_right" ) ) {
speakerMask |= 1<<SPEAKER_RIGHT;
}
// speaker mask
else if ( !token.Icmp( "mask_backright" ) ) {
speakerMask |= 1<<SPEAKER_BACKRIGHT;
}
// speaker mask
else if ( !token.Icmp( "mask_backleft" ) ) {
speakerMask |= 1<<SPEAKER_BACKLEFT;
}
// speaker mask
else if ( !token.Icmp( "mask_lfe" ) ) {
speakerMask |= 1<<SPEAKER_LFE;
}
// soundClass
else if ( !token.Icmp( "soundClass" ) ) {
parms.soundClass = src.ParseInt();
//.........这里部分代码省略.........