/* ================ idDeclAF::ParseContents ================ */ bool idDeclAF::ParseContents( idLexer &src, int &c ) const { idToken token; idStr str; while( src.ReadToken( &token ) ) { str += token; if ( !src.CheckTokenString( "," ) ) { break; } str += ","; } c = ContentsFromString( str ); return true; }
/* ================ idCollisionModelManagerLocal::ParseBrushes ================ */ void idCollisionModelManagerLocal::ParseBrushes( idLexer *src, cm_model_t *model ) { cm_brush_t *b; int i, numPlanes; idVec3 normal; idToken token; if( src->CheckTokenType( TT_NUMBER, 0, &token ) ) { model->brushBlock = static_cast<cm_brushBlock_t *>( Mem_Alloc( sizeof( cm_brushBlock_t ) + token.GetIntValue() ) ); model->brushBlock->bytesRemaining = token.GetIntValue(); model->brushBlock->next = ( reinterpret_cast<byte *>( model->brushBlock ) ) + sizeof( cm_brushBlock_t ); } src->ExpectTokenString( "{" ); while( !src->CheckTokenString( "}" ) ) { // parse brush numPlanes = src->ParseInt(); b = AllocBrush( model, numPlanes ); b->numPlanes = numPlanes; src->ExpectTokenString( "{" ); for( i = 0; i < b->numPlanes; i++ ) { src->Parse1DMatrix( 3, normal.ToFloatPtr() ); b->planes[i].SetNormal( normal ); b->planes[i].SetDist( src->ParseFloat() ); } src->ExpectTokenString( "}" ); src->Parse1DMatrix( 3, b->bounds[0].ToFloatPtr() ); src->Parse1DMatrix( 3, b->bounds[1].ToFloatPtr() ); src->ReadToken( &token ); if( token.type == TT_NUMBER ) { b->contents = token.GetIntValue(); // old .cm files use a single integer } else { b->contents = ContentsFromString( token ); } b->checkcount = 0; b->primitiveNum = 0; // filter brush into tree R_FilterBrushIntoTree( model, model->node, NULL, b ); } }