本文整理汇总了C++中idLexer::Warning方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::Warning方法的具体用法?C++ idLexer::Warning怎么用?C++ idLexer::Warning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::Warning方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyVariable
/*
================
idTypeInfoTools::VerifyVariable
================
*/
void idTypeInfoTools::VerifyVariable( const char *varName, const char *varType, const char *scope, const char *prefix, const char *postfix, const char *value, const void *varPtr, int varSize ) {
idToken token;
if ( typeError ) {
return;
}
src->SkipUntilString( "=" );
src->ExpectTokenType( TT_STRING, 0, &token );
if ( token.Cmp( value ) != 0 ) {
// NOTE: skip several things
if ( IsRenderHandleVariable( varName, varType, scope, prefix, postfix, value ) ) {
return;
}
if ( IsAllowedToChangedFromSaveGames( varName, varType, scope, prefix, postfix, value ) ) {
return;
}
src->Warning( "state diff for %s%s::%s%s\n%s\n%s", prefix, scope, varName, postfix, token.c_str(), value );
typeError = true;
}
}
示例2: ParseShader
//.........这里部分代码省略.........
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();
if ( parms.soundClass < 0 || parms.soundClass >= SOUND_MAX_CLASSES )
{
src.Warning( "SoundClass out of range" );
return false;
}
}
// altSound
else if ( !token.Icmp( "altSound" ) )
{
if ( !src.ExpectAnyToken( &token ) )
{
return false;
}
altSound = declManager->FindSound( token.c_str() );
}
// ordered
else if ( !token.Icmp( "ordered" ) )
{
// no longer supported
}
// no_dups
else if ( !token.Icmp( "no_dups" ) )
{
parms.soundShaderFlags |= SSF_NO_DUPS;
}
// no_flicker
else if ( !token.Icmp( "no_flicker" ) )
{
parms.soundShaderFlags |= SSF_NO_FLICKER;
}
// plain
else if ( !token.Icmp( "plain" ) )
{
// no longer supported
}
示例3: model
//.........这里部分代码省略.........
//
parser.ExpectTokenString( "numtris" );
count = parser.ParseInt();
if( count < 0 )
{
parser.Error( "Invalid size: %d", count );
}
idList<int> tris;
tris.SetNum( count * 3 );
numTris = count;
for( int i = 0; i < count; i++ )
{
parser.ExpectTokenString( "tri" );
parser.ParseInt();
tris[ i * 3 + 0 ] = parser.ParseInt();
tris[ i * 3 + 1 ] = parser.ParseInt();
tris[ i * 3 + 2 ] = parser.ParseInt();
}
//
// parse weights
//
parser.ExpectTokenString( "numweights" );
count = parser.ParseInt();
if( count < 0 )
{
parser.Error( "Invalid size: %d", count );
}
if( maxweight > count )
{
parser.Warning( "Vertices reference out of range weights in model (%d of %d weights).", maxweight, count );
}
idList<vertexWeight_t> tempWeights;
tempWeights.SetNum( count );
assert( numJoints < 256 ); // so we can pack into bytes
for( int i = 0; i < count; i++ )
{
parser.ExpectTokenString( "weight" );
parser.ParseInt();
int jointnum = parser.ParseInt();
if( ( jointnum < 0 ) || ( jointnum >= numJoints ) )
{
parser.Error( "Joint Index out of range(%d): %d", numJoints, jointnum );
}
tempWeights[ i ].joint = jointnum;
tempWeights[ i ].jointWeight = parser.ParseFloat();
parser.Parse1DMatrix( 3, tempWeights[ i ].offset.ToFloatPtr() );
}
// create pre-scaled weights and an index for the vertex/joint lookup
idVec4* scaledWeights = ( idVec4* ) Mem_Alloc16( numWeights * sizeof( scaledWeights[0] ), TAG_MD5_WEIGHT );
int* weightIndex = ( int* ) Mem_Alloc16( numWeights * 2 * sizeof( weightIndex[0] ), TAG_MD5_INDEX );
memset( weightIndex, 0, numWeights * 2 * sizeof( weightIndex[0] ) );
count = 0;
for( int i = 0; i < texCoords.Num(); i++ )
{
int num = firstWeightForVertex[i];
示例4: ParseSingleFXAction
//.........这里部分代码省略.........
continue;
}
if ( !token.Icmp( "useModel" ) ) {
src.ReadToken( &token );
FXAction.data = token;
for( int i = 0; i < events.Num(); i++ ) {
if ( events[i].name.Icmp( FXAction.data ) == 0 ) {
FXAction.sibling = i;
}
}
FXAction.type = FX_MODEL;
// precache the model
renderModelManager->FindModel( FXAction.data );
continue;
}
if ( !token.Icmp( "light" ) ) {
src.ReadToken( &token );
FXAction.data = token;
src.ExpectTokenString( "," );
FXAction.lightColor[0] = src.ParseFloat();
src.ExpectTokenString( "," );
FXAction.lightColor[1] = src.ParseFloat();
src.ExpectTokenString( "," );
FXAction.lightColor[2] = src.ParseFloat();
src.ExpectTokenString( "," );
FXAction.lightRadius = src.ParseFloat();
FXAction.type = FX_LIGHT;
// precache the light material
declManager->FindMaterial( FXAction.data );
continue;
}
if ( !token.Icmp( "model" ) ) {
src.ReadToken( &token );
FXAction.data = token;
FXAction.type = FX_MODEL;
// precache it
renderModelManager->FindModel( FXAction.data );
continue;
}
if ( !token.Icmp( "particle" ) ) { // FIXME: now the same as model
src.ReadToken( &token );
FXAction.data = token;
FXAction.type = FX_PARTICLE;
// precache it
renderModelManager->FindModel( FXAction.data );
continue;
}
if ( !token.Icmp( "decal" ) ) {
src.ReadToken( &token );
FXAction.data = token;
FXAction.type = FX_DECAL;
// precache it
declManager->FindMaterial( FXAction.data );
continue;
}
if ( !token.Icmp( "particleTrackVelocity" ) ) {
FXAction.particleTrackVelocity = true;
continue;
}
if ( !token.Icmp( "sound" ) ) {
src.ReadToken( &token );
FXAction.data = token;
FXAction.type = FX_SOUND;
// precache it
declManager->FindSound( FXAction.data );
continue;
}
if ( !token.Icmp( "ignoreMaster" ) ) {
FXAction.shakeIgnoreMaster = true;
continue;
}
if ( !token.Icmp( "shockwave" ) ) {
src.ReadToken( &token );
FXAction.data = token;
FXAction.type = FX_SHOCKWAVE;
// precache the entity def
declManager->FindType( DECL_ENTITYDEF, FXAction.data );
continue;
}
src.Warning( "FX File: bad token" );
continue;
}
}
示例5: model
//.........这里部分代码省略.........
}
numWeights += numWeightsForVertex[ i ];
if ( numWeightsForVertex[ i ] + firstWeightForVertex[ i ] > maxweight ) {
maxweight = numWeightsForVertex[ i ] + firstWeightForVertex[ i ];
}
}
//
// parse tris
//
parser.ExpectTokenString( "numtris" );
count = parser.ParseInt();
if ( count < 0 ) {
parser.Error( "Invalid size: %d", count );
}
tris.SetNum( count * 3 );
numTris = count;
for( i = 0; i < count; i++ ) {
parser.ExpectTokenString( "tri" );
parser.ParseInt();
tris[ i * 3 + 0 ] = parser.ParseInt();
tris[ i * 3 + 1 ] = parser.ParseInt();
tris[ i * 3 + 2 ] = parser.ParseInt();
}
//
// parse weights
//
parser.ExpectTokenString( "numweights" );
count = parser.ParseInt();
if ( count < 0 ) {
parser.Error( "Invalid size: %d", count );
}
if ( maxweight > count ) {
parser.Warning( "Vertices reference out of range weights in model (%d of %d weights).", maxweight, count );
}
tempWeights.SetNum( count );
for( i = 0; i < count; i++ ) {
parser.ExpectTokenString( "weight" );
parser.ParseInt();
jointnum = parser.ParseInt();
if ( ( jointnum < 0 ) || ( jointnum >= numJoints ) ) {
parser.Error( "Joint Index out of range(%d): %d", numJoints, jointnum );
}
tempWeights[ i ].joint = jointnum;
tempWeights[ i ].jointWeight = parser.ParseFloat();
parser.Parse1DMatrix( 3, tempWeights[ i ].offset.ToFloatPtr() );
}
// create pre-scaled weights and an index for the vertex/joint lookup
scaledWeights = (idVec4 *) Mem_Alloc16( numWeights * sizeof( scaledWeights[0] ) );
weightIndex = (int *) Mem_Alloc16( numWeights * 2 * sizeof( weightIndex[0] ) );
memset( weightIndex, 0, numWeights * 2 * sizeof( weightIndex[0] ) );
count = 0;
for( i = 0; i < texCoords.Num(); i++ ) {
num = firstWeightForVertex[i];
for( j = 0; j < numWeightsForVertex[i]; j++, num++, count++ ) {
scaledWeights[count].ToVec3() = tempWeights[num].offset * tempWeights[num].jointWeight;
scaledWeights[count].w = tempWeights[num].jointWeight;
weightIndex[count * 2 + 0] = tempWeights[num].joint * sizeof( idJointMat );
}
weightIndex[count * 2 - 1] = 1;
}
tempWeights.Clear();
numWeightsForVertex.Clear();
firstWeightForVertex.Clear();
parser.ExpectTokenString( "}" );
// update counters
c_numVerts += texCoords.Num();
c_numWeights += numWeights;
c_numWeightJoints++;
for ( i = 0; i < numWeights; i++ ) {
c_numWeightJoints += weightIndex[i*2+1];
}
//
// build the information that will be common to all animations of this mesh:
// silhouette edge connectivity and normal / tangent generation information
//
idDrawVert *verts = (idDrawVert *) _alloca16( texCoords.Num() * sizeof( idDrawVert ) );
for ( i = 0; i < texCoords.Num(); i++ ) {
verts[i].Clear();
verts[i].st = texCoords[i];
}
TransformVerts( verts, joints );
deformInfo = R_BuildDeformInfo( texCoords.Num(), verts, tris.Num(), tris.Ptr(), shader->UseUnsmoothedTangents() );
}
示例6: ParseShader
//.........这里部分代码省略.........
// 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();
if ( parms.soundClass < 0 || parms.soundClass >= SOUND_MAX_CLASSES ) {
src.Warning( "SoundClass out of range" );
return false;
}
}
// altSound
else if ( !token.Icmp( "altSound" ) ) {
if ( !src.ExpectAnyToken( &token ) ) {
return false;
}
altSound = declManager->FindSound( token.c_str() );
}
// ordered
else if ( !token.Icmp( "ordered" ) ) {
// no longer supported
}
// no_dups
else if ( !token.Icmp( "no_dups" ) ) {
parms.soundShaderFlags |= SSF_NO_DUPS;
}
// no_flicker
else if ( !token.Icmp( "no_flicker" ) ) {
parms.soundShaderFlags |= SSF_NO_FLICKER;
}
// plain
else if ( !token.Icmp( "plain" ) ) {
// no longer supported
}
// looping
else if ( !token.Icmp( "looping" ) ) {
parms.soundShaderFlags |= SSF_LOOPING;
}
// no occlusion
else if ( !token.Icmp( "no_occlusion" ) ) {
示例7: CompareGameState
/*
================
idTypeInfoTools::CompareGameState
================
*/
void idTypeInfoTools::CompareGameState( const char *fileName ) {
int entityNum;
idToken token;
src = new idLexer();
src->SetFlags( LEXFL_NOSTRINGESCAPECHARS );
if ( !src->LoadFile( fileName ) ) {
common->Warning( "couldn't load %s", fileName );
delete src;
src = NULL;
return;
}
fp = NULL;
Write = VerifyVariable;
#ifdef DUMP_GAMELOCAL
if ( !src->ExpectTokenString( "gameLocal" ) || !src->ExpectTokenString( "{" ) ) {
delete src;
src = NULL;
return;
}
WriteClass_r( (void *)&gameLocal, "", "idGameLocal", "idGameLocal", "", 0 );
if ( !src->ExpectTokenString( "}" ) ) {
delete src;
src = NULL;
return;
}
#endif
while( src->ReadToken( &token ) ) {
if ( token != "entity" ) {
break;
}
if ( !src->ExpectTokenType( TT_NUMBER, TT_INTEGER, &token ) ) {
break;
}
entityNum = token.GetIntValue();
if ( entityNum < 0 || entityNum >= gameLocal.num_entities ) {
src->Warning( "entity number %d out of range", entityNum );
break;
}
typeError = false;
idEntity *ent = gameLocal.entities[entityNum];
if ( !ent ) {
src->Warning( "entity %d is not spawned", entityNum );
src->SkipBracedSection( true );
continue;
}
if ( !src->ExpectTokenType( TT_NAME, 0, &token ) ) {
break;
}
if ( token.Cmp( ent->GetType()->classname ) != 0 ) {
src->Warning( "entity %d has wrong type", entityNum );
src->SkipBracedSection( true );
continue;
}
if ( !src->ExpectTokenString( "{" ) ) {
src->Warning( "entity %d missing leading {", entityNum );
break;
}
WriteClass_r( (void *)ent, "", ent->GetType()->classname, ent->GetType()->classname, "", 0 );
if ( !src->SkipBracedSection( false ) ) {
src->Warning( "entity %d missing trailing }", entityNum );
break;
}
}
delete src;
src = NULL;
}