X-Git-Url: https://harrygodden.com/git/?p=csRadar.git;a=blobdiff_plain;f=vmf.h;h=ea91d17ed7e78e59cb180c2f88eca79aea522266;hp=4793e0bda61af53b28c06a4bc521193369c9bc0a;hb=2b5ab41c3193d52eba04269f236d30a71aa0dd9d;hpb=1bdd02062cda9b107c4d66586d3c036ea15f6ae2 diff --git a/vmf.h b/vmf.h index 4793e0b..ea91d17 100644 --- a/vmf.h +++ b/vmf.h @@ -831,3 +831,37 @@ void vmf_entity_transform( vdf_node *ent, m4x3f mat ) // Scale m4x3_scale( mat, scale ); } + +u32 vmf_visgroup_id( vdf_node *root, const char *name ) +{ + vdf_node *dict = vdf_next( root, "visgroups", NULL ); + + if( dict ) + { + vdf_foreach( dict, "visgroup", group ) + { + if( !strcmp( kv_get( group, "name", "" ), name ) ) + { + return kv_get_int( group, "visgroupid", 0 ); + } + } + } + + return 0; +} + +int vmf_visgroup_match( vdf_node *ent, u32 target ) +{ + vdf_node *editor = vdf_next( ent, "editor", NULL ); + + if( editor ) + { + kv_foreach( editor, "visgroupid", groupe ) + { + if( target == atoi( groupe ) ) + return 1; + } + } + + return 0; +}