本文整理汇总了C++中idLexer::ParseInt方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::ParseInt方法的具体用法?C++ idLexer::ParseInt怎么用?C++ idLexer::ParseInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::ParseInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseNodes
/*
================
idAASFileLocal::ParseNodes
================
*/
bool idAASFileLocal::ParseNodes( idLexer &src )
{
int numNodes, i;
aasNode_t node;
numNodes = src.ParseInt();
nodes.Resize( numNodes );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numNodes; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
node.planeNum = src.ParseInt();
node.children[0] = src.ParseInt();
node.children[1] = src.ParseInt();
src.ExpectTokenString( ")" );
nodes.Append( node );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例2: ParsePortals
/*
================
idAASFileLocal::ParsePortals
================
*/
bool idAASFileLocal::ParsePortals( idLexer &src )
{
int numPortals, i;
aasPortal_t portal;
numPortals = src.ParseInt();
portals.Resize( numPortals );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numPortals; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
portal.areaNum = src.ParseInt();
portal.clusters[0] = src.ParseInt();
portal.clusters[1] = src.ParseInt();
portal.clusterAreaNum[0] = src.ParseInt();
portal.clusterAreaNum[1] = src.ParseInt();
src.ExpectTokenString( ")" );
portals.Append( portal );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例3: ParsePlanes
/*
================
idAASFileLocal::ParsePlanes
================
*/
bool idAASFileLocal::ParsePlanes( idLexer &src )
{
int numPlanes, i;
idPlane plane;
idVec4 vec;
numPlanes = src.ParseInt();
planeList.Resize( numPlanes );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numPlanes; i++ )
{
src.ParseInt();
if ( !src.Parse1DMatrix( 4, vec.ToFloatPtr() ) )
{
return false;
}
plane.SetNormal( vec.ToVec3() );
plane.SetDist( vec[3] );
planeList.Append( plane );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例4: ParseEdges
/*
================
idAASFileLocal::ParseEdges
================
*/
bool idAASFileLocal::ParseEdges( idLexer &src )
{
int numEdges, i;
aasEdge_t edge;
numEdges = src.ParseInt();
edges.Resize( numEdges );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numEdges; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
edge.vertexNum[0] = src.ParseInt();
edge.vertexNum[1] = src.ParseInt();
src.ExpectTokenString( ")" );
edges.Append( edge );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例5: ParseVertices
/*
================
idAASFileLocal::ParseVertices
================
*/
bool idAASFileLocal::ParseVertices( idLexer &src )
{
int numVertices, i;
idVec3 vec;
numVertices = src.ParseInt();
vertices.Resize( numVertices );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numVertices; i++ )
{
src.ParseInt();
if ( !src.Parse1DMatrix( 3, vec.ToFloatPtr() ) )
{
return false;
}
vertices.Append( vec );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例6: ParseIndex
/*
================
idAASFileLocal::ParseIndex
================
*/
bool idAASFileLocal::ParseIndex( idLexer &src, idList<aasIndex_t> &indexes )
{
int numIndexes, i;
aasIndex_t index;
numIndexes = src.ParseInt();
indexes.Resize( numIndexes );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numIndexes; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
index = src.ParseInt();
src.ExpectTokenString( ")" );
indexes.Append( index );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例7: Reachability_Read
/*
================
Reachability_Read
================
*/
bool Reachability_Read( idLexer &src, idReachability *reach ) {
reach->travelType = src.ParseInt();
reach->toAreaNum = src.ParseInt();
src.Parse1DMatrix( 3, reach->start.ToFloatPtr() );
src.Parse1DMatrix( 3, reach->end.ToFloatPtr() );
reach->edgeNum = src.ParseInt();
reach->travelTime = src.ParseInt();
return true;
}
示例8: ParseAreas
/*
================
idAASFileLocal::ParseAreas
================
*/
bool idAASFileLocal::ParseAreas( idLexer &src )
{
int numAreas, i;
aasArea_t area;
numAreas = src.ParseInt();
areas.Resize( numAreas );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numAreas; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
area.flags = src.ParseInt();
area.contents = src.ParseInt();
area.firstFace = src.ParseInt();
area.numFaces = src.ParseInt();
area.cluster = src.ParseInt();
area.clusterAreaNum = src.ParseInt();
src.ExpectTokenString( ")" );
areas.Append( area );
ParseReachabilities( src, i );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
LinkReversedReachability();
return true;
}
示例9: ParseReachabilities
/*
================
idAASFileLocal::ParseReachabilities
================
*/
bool idAASFileLocal::ParseReachabilities( idLexer &src, int areaNum )
{
int num, j;
aasArea_t *area;
idReachability reach, *newReach;
idReachability_Special *special;
area = &areas[areaNum];
num = src.ParseInt();
src.ExpectTokenString( "{" );
area->reach = NULL;
area->rev_reach = NULL;
area->travelFlags = AreaContentsTravelFlags( areaNum );
for ( j = 0; j < num; j++ )
{
Reachability_Read( src, &reach );
switch( reach.travelType )
{
case TFL_SPECIAL:
newReach = special = new idReachability_Special();
Reachability_Special_Read( src, special );
break;
default:
newReach = new idReachability();
break;
}
newReach->CopyBase( reach );
newReach->fromAreaNum = areaNum;
newReach->next = area->reach;
area->reach = newReach;
}
src.ExpectTokenString( "}" );
return true;
}
示例10: ParseInt
/*
============
idAASSettings::ParseInt
============
*/
bool idAASSettings::ParseInt( idLexer &src, int &i ) {
if ( !src.ExpectTokenString( "=" ) ) {
return false;
}
i = src.ParseInt();
return true;
}
示例11:
/*
====================
idRenderModelMD5::ParseJoint
====================
*/
void idRenderModelMD5::ParseJoint( idLexer& parser, idMD5Joint* joint, idJointQuat* defaultPose )
{
//
// parse name
//
idToken token;
parser.ReadToken( &token );
joint->name = token;
//
// parse parent
//
int num = parser.ParseInt();
if( num < 0 )
{
joint->parent = NULL;
}
else
{
if( num >= joints.Num() - 1 )
{
parser.Error( "Invalid parent for joint '%s'", joint->name.c_str() );
}
joint->parent = &joints[ num ];
}
//
// parse default pose
//
parser.Parse1DMatrix( 3, defaultPose->t.ToFloatPtr() );
parser.Parse1DMatrix( 3, defaultPose->q.ToFloatPtr() );
defaultPose->q.w = defaultPose->q.CalcW();
}
示例12: ParseFaces
/*
================
idAASFileLocal::ParseFaces
================
*/
bool idAASFileLocal::ParseFaces( idLexer &src )
{
int numFaces, i;
aasFace_t face;
numFaces = src.ParseInt();
faces.Resize( numFaces );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numFaces; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
face.planeNum = src.ParseInt();
face.flags = src.ParseInt();
face.areas[0] = src.ParseInt();
face.areas[1] = src.ParseInt();
face.firstEdge = src.ParseInt();
face.numEdges = src.ParseInt();
src.ExpectTokenString( ")" );
faces.Append( face );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例13: ParseClusters
/*
================
idAASFileLocal::ParseClusters
================
*/
bool idAASFileLocal::ParseClusters( idLexer &src )
{
int numClusters, i;
aasCluster_t cluster;
numClusters = src.ParseInt();
clusters.Resize( numClusters );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numClusters; i++ )
{
src.ParseInt();
src.ExpectTokenString( "(" );
cluster.numAreas = src.ParseInt();
cluster.numReachableAreas = src.ParseInt();
cluster.firstPortal = src.ParseInt();
cluster.numPortals = src.ParseInt();
src.ExpectTokenString( ")" );
clusters.Append( cluster );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例14: 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" ) )
{
//.........这里部分代码省略.........
示例15: ReadEffect
bool idEFXFile::ReadEffect( idLexer &src, idSoundEffect *effect ) {
idToken name, token;
if ( !src.ReadToken( &token ) )
return false;
// reverb effect
if ( token != "reverb" ) {
// other effect (not supported at the moment)
src.Error( "idEFXFile::ReadEffect: Unknown effect definition" );
return false;
}
src.ReadTokenOnLine( &token );
name = token;
if ( !src.ReadToken( &token ) )
return false;
if ( token != "{" ) {
src.Error( "idEFXFile::ReadEffect: { not found, found %s", token.c_str() );
return false;
}
ALenum err;
alGetError();
EFXprintf("Loading EFX effect '%s' (#%u)\n", name.c_str(), effect->effect);
do {
if ( !src.ReadToken( &token ) ) {
src.Error( "idEFXFile::ReadEffect: EOF without closing brace" );
return false;
}
if ( token == "}" ) {
effect->name = name;
break;
}
if ( token == "environment" ) {
// <+KittyCat> the "environment" token should be ignored (efx has nothing equatable to it)
src.ParseInt();
} else if ( token == "environment size" ) {
float size = src.ParseFloat();
efxf(AL_EAXREVERB_DENSITY, (size < 2.0f) ? (size - 1.0f) : 1.0f);
} else if ( token == "environment diffusion" ) {
efxf(AL_EAXREVERB_DIFFUSION, src.ParseFloat());
} else if ( token == "room" ) {
efxf(AL_EAXREVERB_GAIN, mB_to_gain(src.ParseInt(), GAIN));
} else if ( token == "room hf" ) {
efxf(AL_EAXREVERB_GAINHF, mB_to_gain(src.ParseInt(), GAINHF));
} else if ( token == "room lf" ) {
efxf(AL_EAXREVERB_GAINLF, mB_to_gain(src.ParseInt(), GAINLF));
} else if ( token == "decay time" ) {
efxf(AL_EAXREVERB_DECAY_TIME, src.ParseFloat());
} else if ( token == "decay hf ratio" ) {
efxf(AL_EAXREVERB_DECAY_HFRATIO, src.ParseFloat());
} else if ( token == "decay lf ratio" ) {
efxf(AL_EAXREVERB_DECAY_LFRATIO, src.ParseFloat());
} else if ( token == "reflections" ) {
efxf(AL_EAXREVERB_REFLECTIONS_GAIN, mB_to_gain(src.ParseInt(), REFLECTIONS_GAIN));
} else if ( token == "reflections delay" ) {
efxf(AL_EAXREVERB_REFLECTIONS_DELAY, src.ParseFloat());
} else if ( token == "reflections pan" ) {
efxfv(AL_EAXREVERB_REFLECTIONS_PAN, src.ParseFloat(), src.ParseFloat(), src.ParseFloat());
} else if ( token == "reverb" ) {
efxf(AL_EAXREVERB_LATE_REVERB_GAIN, mB_to_gain(src.ParseInt(), LATE_REVERB_GAIN));
} else if ( token == "reverb delay" ) {
efxf(AL_EAXREVERB_LATE_REVERB_DELAY, src.ParseFloat());
} else if ( token == "reverb pan" ) {
efxfv(AL_EAXREVERB_LATE_REVERB_PAN, src.ParseFloat(), src.ParseFloat(), src.ParseFloat());
} else if ( token == "echo time" ) {
efxf(AL_EAXREVERB_ECHO_TIME, src.ParseFloat());
} else if ( token == "echo depth" ) {
efxf(AL_EAXREVERB_ECHO_DEPTH, src.ParseFloat());
} else if ( token == "modulation time" ) {
efxf(AL_EAXREVERB_MODULATION_TIME, src.ParseFloat());
} else if ( token == "modulation depth" ) {
efxf(AL_EAXREVERB_MODULATION_DEPTH, src.ParseFloat());
} else if ( token == "air absorption hf" ) {
efxf(AL_EAXREVERB_AIR_ABSORPTION_GAINHF, mB_to_gain(src.ParseFloat(), AIR_ABSORPTION_GAINHF));
} else if ( token == "hf reference" ) {
efxf(AL_EAXREVERB_HFREFERENCE, src.ParseFloat());
} else if ( token == "lf reference" ) {
efxf(AL_EAXREVERB_LFREFERENCE, src.ParseFloat());
} else if ( token == "room rolloff factor" ) {
efxf(AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, src.ParseFloat());
} else if ( token == "flags" ) {
src.ReadTokenOnLine( &token );
unsigned int flags = token.GetUnsignedLongValue();
efxi(AL_EAXREVERB_DECAY_HFLIMIT, (flags & 0x20) ? AL_TRUE : AL_FALSE);
// the other SCALE flags have no equivalent in efx
} else {
src.ReadTokenOnLine( &token );
src.Error( "idEFXFile::ReadEffect: Invalid parameter in reverb definition" );
}
} while ( 1 );
//.........这里部分代码省略.........